Skip to content

Commit f25b20d

Browse files
Add a PyPi workflow
1 parent 24b5508 commit f25b20d

File tree

2 files changed

+66
-3
lines changed

2 files changed

+66
-3
lines changed

.github/workflows/pypi.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PyPI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- auto-release
7+
pull_request:
8+
branches: [master]
9+
release:
10+
types: [published]
11+
12+
jobs:
13+
build:
14+
name: Build source distribution
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: "3.8"
23+
- name: Build the sdist
24+
run: |
25+
python setup.py sdist
26+
- name: Check the sdist installs and imports
27+
run: |
28+
mkdir -p test-sdist
29+
cd test-sdist
30+
python -m venv venv-sdist
31+
venv-sdist/bin/python -m pip install ../dist/logical-unification-*.tar.gz
32+
- uses: actions/upload-artifact@v2
33+
with:
34+
name: artifact
35+
path: dist/*
36+
37+
upload_pypi:
38+
name: Upload to PyPI on release
39+
needs: [build]
40+
runs-on: ubuntu-latest
41+
if: github.event_name == 'release' && github.event.action == 'published'
42+
steps:
43+
- uses: actions/download-artifact@v2
44+
with:
45+
name: artifact
46+
path: dist
47+
- uses: pypa/gh-action-pypi-publish@master
48+
with:
49+
user: __token__
50+
password: ${{ secrets.pypi_secret }}

.github/workflows/tests.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
- 'setup.cfg'
3333
- 'requirements.txt'
3434
- '.coveragerc'
35+
- '.pre-commit-config.yaml'
3536
3637
style:
3738
name: Check code style
@@ -50,7 +51,7 @@ jobs:
5051
- changes
5152
- style
5253
runs-on: ubuntu-latest
53-
if: ${{ needs.changes.outputs.changes == 'true' }}
54+
if: ${{ needs.changes.outputs.changes == 'true' && needs.style.result == 'success' }}
5455
strategy:
5556
matrix:
5657
python-version:
@@ -77,8 +78,20 @@ jobs:
7778
parallel: true
7879
flag-name: run-${{ matrix.python-version }}
7980

80-
coveralls_finish:
81-
needs: test
81+
all-checks:
82+
if: ${{ always() }}
83+
runs-on: ubuntu-latest
84+
name: "All tests"
85+
needs: [changes, style, test]
86+
steps:
87+
- name: Check build matrix status
88+
if: ${{ needs.changes.outputs.changes == 'true' && (needs.style.result != 'success' || needs.test.result != 'success') }}
89+
run: exit 1
90+
91+
upload-coverage:
92+
name: "Upload coverage"
93+
needs: [changes, all-checks]
94+
if: ${{ needs.changes.outputs.changes == 'true' && needs.all-checks.result == 'success' }}
8295
runs-on: ubuntu-latest
8396
steps:
8497
- name: Coveralls Finished

0 commit comments

Comments
 (0)