1+ name : Build wheels and publish to PyPI
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+ build_wheels :
9+ name : Build wheels
10+ runs-on : ubuntu-20.04
11+
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ - uses : actions/setup-python@v5
16+ with :
17+ python-version : ' 3.11'
18+
19+ - name : Build wheel
20+ run : |
21+ python -m pip install build
22+ python -m build --wheel --sdist --outdir wheelhouse
23+
24+ - name : Store wheels
25+ uses : actions/upload-artifact@v4
26+ with :
27+ name : wheels
28+ path : wheelhouse/*
29+
30+ test_unix_wheels :
31+ needs : build_wheels
32+ name : Test wheels on ${{ matrix.os }} with ${{ matrix.python-version }}
33+ runs-on : ${{ matrix.os }}
34+ strategy :
35+ fail-fast : false # to not fail all combinations if just one fail
36+ matrix :
37+ os : [ubuntu-latest, macos-latest]
38+ python-version : ['3.11', '3.12']
39+
40+ steps :
41+ - uses : actions/checkout@v4
42+ - uses : actions/setup-python@v5
43+ with :
44+ python-version : ${{ matrix.python-version }}
45+
46+ - uses : actions/download-artifact@v4
47+ with :
48+ name : wheels
49+ path : wheelhouse
50+
51+ - name : Get wheel filename
52+ run : echo "WHEELNAME=$(ls ./wheelhouse/python-fold-*none-any.whl)" >> $GITHUB_ENV
53+
54+ - name : Install wheel and extras
55+ run : python -m pip install "${{ env.WHEELNAME }}[all_extras,dev]"
56+
57+ - name : Run tests
58+ run : |
59+ pip install -r requirements.txt
60+ pip install pytest
61+ python -m pytest
62+
63+ upload_wheels :
64+ name : Upload wheels to PyPI
65+ runs-on : ubuntu-latest
66+ needs : [build_wheels,test_unix_wheels]
67+
68+ steps :
69+ - uses : actions/download-artifact@v4
70+ with :
71+ name : wheels
72+ path : wheelhouse
73+
74+ - name : Publish package to PyPI
75+ uses : pypa/gh-action-pypi-publish@release/v1
76+ with :
77+ password : ${{ secrets.PYPI_API_TOKEN }}
78+ packages_dir : wheelhouse/
0 commit comments