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