-
Notifications
You must be signed in to change notification settings - Fork 18
76 lines (65 loc) · 2.31 KB
/
check+deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
on:
push:
branches: [ master ]
pull_request:
release:
types: [ published ]
name: Check & Deploy
jobs:
check-and-deploy:
name: Check & Deploy on Ubuntu (latest)
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v2
with:
submodules: true
path: _src/
- name: Install dependencies
shell: bash
run: |
pushd _src
python3 -m pip install --upgrade pytest
popd
- name: Run checks
shell: bash
run: |
pushd _src
python3 -m pip install .
python3 -m pytest
popd
- name: Verify release version matches source code version
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
pushd _src
export TAG_VERSION=${GITHUB_REF##refs/tags/v}
export SRC_VERSION=$(python3 -c "from wilson._version import __version__; print(__version__)")
if [[ ${TAG_VERSION} != ${SRC_VERSION} ]] ; then
echo "tag/release version and source code version disagree, exiting"
exit 1
fi
popd
- name: Build bdist
shell: bash
run: |
mkdir dist
pushd _src
python3 ./setup.py sdist -d ../dist/
python3 ./setup.py bdist_wheel -d ../dist/
popd
- name: Test installing the wheel
shell: bash
run: |
python3 -m pip install dist/wilson-*.whl
- name: Upload build as artifact
uses: actions/upload-artifact@v1
with:
name: wilson-dist-${{ github.sha }}
path: dist
- name: Upload to PyPI
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.TWINE_USERNAME }}
password: ${{ secrets.TWINE_PASSWORD }}