1+ name : Build and publish wheels on PyPI
2+
13on :
24 release :
35 types : [created]
@@ -14,17 +16,16 @@ jobs:
1416 runs-on : ${{ matrix.os }}
1517
1618 steps :
17- - uses : actions/checkout@v2
18- - uses : actions/setup-python@v2
19+ - name : Checkout code
20+ uses : actions/checkout@v2
21+ - name : Setup python
22+ uses : actions/setup-python@v2
1923 with :
2024 python-version : ${{ matrix.python-version }}
21-
22- # install pip prerequisites
23- - name : Install cffi and virtualenv
25+ - name : Install prerequisites cffi and virtualenv
2426 run : pip install cffi virtualenv
25-
26- # install rust toolchoin
27- - uses : actions-rs/toolchain@v1
27+ - name : install Rust toolchain
28+ uses : actions-rs/toolchain@v1
2829 id : rustup
2930 with :
3031 profile : minimal
@@ -46,17 +47,28 @@ jobs:
4647 echo "CXX=${bindir}/clang++" >> "${GITHUB_ENV}"
4748 echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "${GITHUB_ENV}"
4849
49- # setup linux
50- - name : Install musl tools
51- if : matrix.os == 'ubuntu-latest'
52- run : sudo apt-get install -y musl-tools
53-
54- # build and publish
5550 - name : Install Python dependencies
5651 run : pip install maturin
5752 - name : Build wheels
5853 run : maturin build --release --strip
59- - uses : actions/upload-artifact@v3
54+ - name : Run unit tests on Unix
55+ if : matrix.os != 'windows-latest'
56+ # TODO: can we install the wheel built above instead?
57+ run : |
58+ python -m venv venv
59+ source venv/bin/activate
60+ maturin develop --release
61+ python -m unittest discover tests
62+ - name : Run unit tests on Windows
63+ if : matrix.os == 'windows-latest'
64+ # TODO: can we install the wheel built above instead?
65+ run : |
66+ python -m venv venv
67+ venv/Scripts/activate.ps1
68+ maturin develop --release
69+ python -m unittest discover tests
70+ - name : Collect artifacts
71+ uses : actions/upload-artifact@v3
6072 with :
6173 name : wheels
6274 path : target/wheels/
@@ -67,19 +79,20 @@ jobs:
6779 needs : build-wheels
6880 runs-on : ubuntu-latest
6981 steps :
70- - uses : actions/checkout@v2
71- - uses : actions/setup-python@v1
72- - uses : actions/download-artifact@v3
82+ - name : Collect artifacts
83+ uses : actions/download-artifact@v3
7384 with :
7485 name : wheels
7586 path : wheels/
7687 - name : list contents
7788 run : ls -R
7889 working-directory : wheels/
79- - name : publish
80- uses : pypa/gh-action-pypi-publish@master
90+ - name : Publish to PyPI
91+ uses : pypa/gh-action-pypi-publish@release/v1
8192 with :
8293 user : __token__
8394 password : ${{ secrets.PYPI_TOKEN }}
8495 packages_dir : wheels/
96+ skip_existing : true
97+ verbose : true
8598
0 commit comments