1+ name : build_wheels+tests
2+
3+ defaults :
4+ run :
5+ shell : bash
6+
7+ on :
8+ pull_request :
9+ branches : [ main ]
10+
11+ jobs :
12+ debug_build_ok :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v4
16+ with :
17+ submodules : recursive
18+ fetch-depth : 0 # https://github.com/pypa/setuptools_scm/issues/480
19+ - run : DEBUG=1 VERBOSE=1 pip install --verbose -e .[tests]
20+ - run : pytest -v -s -We -p no:unraisableexception tests
21+
22+ zenodo_json :
23+ runs-on : ubuntu-latest
24+ steps :
25+ - uses : actions/checkout@v4
26+ - uses : notiz-dev/github-action-json-property@release
27+ with :
28+ path : ' .zenodo.json'
29+ prop_path : ' creators'
30+
31+ build_wheels :
32+ needs : [debug_build_ok, zenodo_json]
33+ name : Build wheels on ${{ matrix.os }}
34+ runs-on : ${{ matrix.os }}
35+ strategy :
36+ matrix :
37+ os : [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest, windows-latest]
38+
39+ steps :
40+ - uses : actions/checkout@v4
41+ with :
42+ submodules : recursive
43+ fetch-depth : 0
44+
45+ # download C and Fortran compiler on windows
46+ - if : matrix.os == 'windows-latest'
47+ uses : msys2/setup-msys2@v2
48+ with :
49+ msystem : MINGW64
50+ update : false
51+ install : >-
52+ mingw-w64-x86_64-gcc-fortran
53+ mingw-w64-x86_64-ninja
54+ m4
55+
56+ - uses : actions/setup-python@v5
57+
58+ - name : Install cibuildwheel
59+ run : python -m pip install cibuildwheel==2.23.2
60+
61+ - name : Build and test wheels
62+ env :
63+ # skip 32-bit, PyPy, and musllinux builds
64+ CIBW_SKIP : " *-win32 *-manylinux_i686 pp* *musllinux*"
65+ CIBW_BEFORE_BUILD_WINDOWS : pip install delvewheel
66+ CIBW_ENVIRONMENT_WINDOWS : CMAKE_ARGS="-DCMAKE_MAKE_PROGRAM=D:/a/_temp/msys64/mingw64/bin/ninja.exe" CMAKE_PROGRAM_PATH="D:/a/_temp/msys64/usr/bin" CMAKE_GENERATOR="Ninja" TEMP="D:/a/_temp/"
67+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS : delvewheel repair -w {dest_dir} {wheel}
68+ CIBW_BEFORE_BUILD_MACOS : brew reinstall gcc
69+ CIBW_ENVIRONMENT_MACOS : MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion` SYSTEM_VERSION_COMPAT=0
70+ CIBW_TEST_REQUIRES : pytest pytest-order
71+ CIBW_TEST_COMMAND : pytest -v -s -We -p no:unraisableexception {package}/tests
72+ run : python -m cibuildwheel --output-dir dist
73+
74+ - uses : actions/upload-artifact@v4
75+ with :
76+ name : dist-${{matrix.os}}-${{matrix.manylinux}}
77+ path : dist
78+
79+ run_example_notebooks :
80+ needs : [build_wheels]
81+ runs-on : ${{ matrix.os }}
82+ name : Run example notebooks on ${{ matrix.os }}
83+ strategy :
84+ matrix :
85+ os : [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest, windows-latest]
86+
87+ steps :
88+ - uses : actions/checkout@v4
89+ with :
90+ submodules : recursive
91+ fetch-depth : 0
92+
93+ 94+ with :
95+ python-version : " 3.13"
96+
97+ - uses : actions/download-artifact@v4
98+ with :
99+ name : dist-${{matrix.os}}-${{matrix.manylinux}}
100+ path : dist
101+
102+ - run : |
103+ temp=`find dist/ -name "*cp313*.whl"`
104+ python -m pip install $temp[examples]
105+ ex -sc 'g/^PyPartMC/d' -cx .binder/requirements.txt
106+ python -m pip install --force-reinstall --no-deps $PIP_INSTALL_OPTS -r .binder/requirements.txt
107+ python -m pip install $PIP_INSTALL_OPTS -r gitmodules/devops_tests/requirements.txt
108+ GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python -m pytest --durations=10 -v -s -We -p no:unraisableexception gitmodules/devops_tests/test_run_notebooks.py
109+
110+ check_annotated_todos :
111+ runs-on : ubuntu-latest
112+ name : Check if todos are annotated
113+
114+ steps :
115+ - uses : actions/checkout@v4
116+ with :
117+ submodules : recursive
118+ fetch-depth : 0
119+
120+ - run : |
121+ python -m pip install pytest
122+ python -m pip install $PIP_INSTALL_OPTS -r gitmodules/devops_tests/requirements.txt
123+ GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python -m pytest --durations=10 -v -s -We -p no:unraisableexception gitmodules/devops_tests/test_todos_annotated.py
124+
125+ dist_check :
126+ runs-on : ${{ matrix.os }}
127+ needs : [build_wheels]
128+ strategy :
129+ matrix :
130+ os : [ubuntu-latest, ubuntu-24.04-arm]
131+ steps :
132+ 133+ with :
134+ python-version : " 3.11"
135+ - run : pip install twine auditwheel
136+ - uses : actions/download-artifact@v4
137+ with :
138+ name : dist-${{matrix.os}}-${{matrix.manylinux}}
139+ path : dist
140+ - run : twine check --strict dist/*
141+ - run : for i in dist/*-manylinux*.whl; do auditwheel show $i; done;
142+
143+ dist_upload :
144+ runs-on : ubuntu-latest
145+ needs : [build_wheels]
146+ permissions :
147+ id-token : write
148+ steps :
149+ - uses : actions/download-artifact@v4
150+ with :
151+ pattern : dist-*
152+ merge-multiple : true
153+ path : dist
154+ - if : github.event_name == 'push' && github.ref == 'refs/heads/main'
155+ uses : pypa/gh-action-pypi-publish@release/v1.12
156+ with :
157+ repository_url : https://test.pypi.org/legacy/
158+ attestations : false
159+ - run : |
160+ echo "github.event_name:" ${{ github.event_name }}
161+ echo "github.event.action:" ${{ github.event.action }}
162+ echo "github.event.prerelease:" ${{ github.event.prerelease }}
163+ echo "env.GITHUB_REF:" ${{ env.GITHUB_REF }}
164+ echo "env.GITHUB_REF:" ${{ env.GITHUB_REF_NAME }}
165+ - if : github.event_name == 'release' && github.event.prerelease == false
166+ uses : pypa/gh-action-pypi-publish@release/v1.12
167+ with :
168+ attestations : false
0 commit comments