@@ -3,57 +3,74 @@ name: ci
33on :
44 push :
55 branches : [main]
6- tags : ['*' ]
6+ tags : ["v*" ]
77 pull_request :
88 branches : [main]
99
10+ permissions :
11+ contents : read
12+
1013jobs :
1114 test :
12- runs-on : ubuntu-latest
15+ runs-on : ${{ matrix.os }}
1316 strategy :
14- fail-fast : true
17+ fail-fast : false
1518 matrix :
16- python-version : ["3.8", "3.9", "3.10", "3.11"]
19+ os : [ubuntu-latest, macos-latest, windows-latest]
20+ python-version : ["3.8", "3.13"]
1721 steps :
1822 - uses : actions/checkout@v4
19- - uses : actions/setup-python@v4
23+ - uses : actions/setup-python@v5
2024 with :
2125 python-version : ${{ matrix.python-version }}
22- - run : |
23- python -m pip install --upgrade pip
24- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
26+ - uses : dtolnay/rust-toolchain@stable
27+ - run : python -m pip install maturin pytest
28+ - run : maturin build --locked --out dist
29+ - run : python -m pip install --no-index --find-links dist python-dotenvx
30+ - run : python -m pytest
2531
26- # run only on semantic version tag
27- release :
32+ wheels :
33+ if : startsWith(github.ref, 'refs/tags/v')
2834 needs : test
29- if : startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '.')
30- runs-on : ubuntu-latest
35+ runs-on : ${{ matrix.os }}
3136 strategy :
32- fail-fast : true
37+ fail-fast : false
38+ matrix :
39+ include :
40+ - os : ubuntu-latest
41+ target : x86_64
42+ manylinux : " 2014"
43+ - os : ubuntu-latest
44+ target : aarch64
45+ manylinux : " 2014"
46+ - os : macos-13
47+ target : x86_64
48+ - os : macos-14
49+ target : aarch64
50+ - os : windows-latest
51+ target : x64
3352 steps :
3453 - uses : actions/checkout@v4
35- # GITHUB_ENV operates like a .env file
36- - name : extract version
37- run : |
38- VERSION=${GITHUB_REF#refs/tags/}
39- CLEAN_VERSION=${VERSION#v}
40- echo "VERSION=$VERSION" >> $GITHUB_ENV
41- echo "CLEAN_VERSION=$CLEAN_VERSION" >> $GITHUB_ENV
54+ - uses : PyO3/maturin-action@v1
55+ with :
56+ target : ${{ matrix.target }}
57+ manylinux : ${{ matrix.manylinux }}
58+ args : --release --out dist
59+ - uses : actions/upload-artifact@v4
60+ with :
61+ name : wheels-${{ matrix.os }}-${{ matrix.target }}
62+ path : dist
4263
43- pypi :
44- needs : release
64+ publish :
65+ if : startsWith(github.ref, 'refs/tags/v')
66+ needs : wheels
4567 runs-on : ubuntu-latest
4668 steps :
47- - uses : actions/checkout@v4
48- - uses : actions/setup-python@v4
69+ - uses : actions/download-artifact@v4
70+ with :
71+ pattern : wheels-*
72+ path : dist
73+ merge-multiple : true
74+ - uses : pypa/gh-action-pypi-publish@release/v1
4975 with :
50- python-version : ' 3.11'
51- - run : |
52- python -m pip install --upgrade pip
53- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
54- pip install setuptools wheel twine build
55- - name : publish
56- env :
57- TWINE_USERNAME : __token__
58- TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
59- run : make release
76+ password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments