build_wheels+tests #170
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build_wheels+tests | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 13 * * 4' | |
release: | |
types: [published] | |
jobs: | |
debug_build_ok: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 | |
- run: DEBUG=1 VERBOSE=1 pip install --verbose -e .[tests] | |
- run: pytest -v -s -We -p no:unraisableexception tests | |
zenodo_json: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: notiz-dev/github-action-json-property@release | |
with: | |
path: '.zenodo.json' | |
prop_path: 'creators' | |
build_wheels: | |
needs: [debug_build_ok, zenodo_json] | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
# download C and Fortran compiler on windows | |
- if: matrix.os == 'windows-latest' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: false | |
install: >- | |
mingw-w64-x86_64-gcc-fortran | |
mingw-w64-x86_64-ninja | |
m4 | |
- uses: actions/setup-python@v5 | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.23.2 | |
- name: Build and test wheels | |
env: | |
# skip 32-bit, PyPy, and musllinux builds | |
CIBW_SKIP: "*-win32 *-manylinux_i686 pp* *musllinux*" | |
CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel | |
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/" | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair -w {dest_dir} {wheel} | |
CIBW_BEFORE_BUILD_MACOS: brew reinstall gcc | |
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=`sw_vers -productVersion` SYSTEM_VERSION_COMPAT=0 | |
CIBW_TEST_REQUIRES: pytest pytest-order | |
CIBW_TEST_COMMAND: pytest -v -s -We -p no:unraisableexception {package}/tests | |
run: python -m cibuildwheel --output-dir dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{matrix.os}}-${{matrix.manylinux}} | |
path: dist | |
run_example_notebooks: | |
needs: [build_wheels] | |
runs-on: ${{ matrix.os }} | |
name: Run example notebooks on ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.13" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-${{matrix.os}}-${{matrix.manylinux}} | |
path: dist | |
# install fortran compiler needed by dustpy | |
- if: startsWith(matrix.os, 'macos-') | |
run: | | |
brew reinstall gcc | |
- run: | | |
temp=`find dist/ -name "*cp313*.whl"` | |
python -m pip install $temp[examples] | |
ex -sc 'g/^PyPartMC/d' -cx .binder/requirements.txt | |
python -m pip install --force-reinstall --no-deps $PIP_INSTALL_OPTS -r .binder/requirements.txt | |
python -m pip install $PIP_INSTALL_OPTS -r gitmodules/devops_tests/requirements.txt | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python -m pytest --durations=10 -v -s -We -p no:unraisableexception gitmodules/devops_tests/test_run_notebooks.py | |
check_annotated_todos: | |
runs-on: ubuntu-latest | |
name: Check if todos are annotated | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- run: | | |
python -m pip install pytest | |
python -m pip install $PIP_INSTALL_OPTS -r gitmodules/devops_tests/requirements.txt | |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python -m pytest --durations=10 -v -s -We -p no:unraisableexception gitmodules/devops_tests/test_todos_annotated.py | |
dist_check: | |
runs-on: ${{ matrix.os }} | |
needs: [build_wheels] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, ubuntu-24.04-arm] | |
steps: | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.11" | |
- run: pip install twine auditwheel | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist-${{matrix.os}}-${{matrix.manylinux}} | |
path: dist | |
- run: twine check --strict dist/* | |
- run: for i in dist/*-manylinux*.whl; do auditwheel show $i; done; | |
dist_upload: | |
runs-on: ubuntu-latest | |
needs: [build_wheels] | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
merge-multiple: true | |
path: dist | |
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: pypa/gh-action-pypi-publish@release/v1.12 | |
with: | |
repository_url: https://test.pypi.org/legacy/ | |
attestations: false | |
- run: | | |
echo "github.event_name:" ${{ github.event_name }} | |
echo "github.event.action:" ${{ github.event.action }} | |
echo "github.event.prerelease:" ${{ github.event.prerelease }} | |
echo "env.GITHUB_REF:" ${{ env.GITHUB_REF }} | |
echo "env.GITHUB_REF:" ${{ env.GITHUB_REF_NAME }} | |
- if: github.event_name == 'release' && github.event.prerelease == false | |
uses: pypa/gh-action-pypi-publish@release/v1.12 | |
with: | |
attestations: false |