Add more unit tests (#2601) #4916
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 | |
| # adapted from https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| release: | |
| types: | |
| - published | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # builds to skip (e.g. skip 32-bit windows) | |
| CIBW_SKIP: "*-manylinux_i686 *-win32" | |
| # Need to do some setup before repairing the wheel on linux... | |
| CIBW_REPAIR_WHEEL_COMMAND_LINUX: bash scripts/github-actions/repair_command_linux.sh | |
| CIBW_BEFORE_ALL_LINUX: bash scripts/github-actions/repair-linux.sh | |
| # Specify eigen location for windows | |
| CIBW_ENVIRONMENT_WINDOWS: "EXTRA_CMAKE_ARGS=-DEIGEN3_INCLUDE_DIR:PATH=/c/eigen" | |
| # Run tests | |
| CIBW_TEST_REQUIRES: pytest | |
| # Run a very simple test to make sure the wheels are working | |
| CIBW_TEST_COMMAND: pytest {project}/scripts/github-actions/simple_test.py | |
| # We can't currently test Mac arm64 builds on x64 | |
| CIBW_TEST_SKIP: "*_arm64" | |
| # Use bash by default for the run command | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build_wheels: | |
| name: Build wheels for ${{ matrix.os }} | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: linux-intel | |
| runs-on: ubuntu-latest | |
| - os: linux-arm | |
| runs-on: ubuntu-24.04-arm | |
| - os: windows-intel | |
| runs-on: windows-latest | |
| #- os: windows-arm | |
| # runs-on: windows-11-arm | |
| - os: macos-intel | |
| # macos-15-intel is the last x86_64 runner | |
| runs-on: macos-15-intel | |
| - os: macos-arm | |
| # macos-14+ (including latest) are ARM64 runners | |
| runs-on: macos-latest | |
| #- os: pyodide | |
| # runs-on: ubuntu-latest | |
| # platform: pyodide | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| # Grab the whole history so that setuptools-scm can see the tags and | |
| # give it a correct version even on non-tag push. | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: . ./scripts/github-actions/install.sh | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@298ed2fb2c105540f5ed055e8a6ad78d82dd3a7e # v3.3.1 | |
| env: | |
| CIBW_PLATFORM: ${{ matrix.platform || 'auto' }} | |
| CIBW_ARCHS: ${{ matrix.archs || 'auto' }} | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
| path: ./wheelhouse/*.whl | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| # Grab the whole history so that setuptools-scm can see the tags and | |
| # give it a correct version even on non-tag push. | |
| fetch-depth: 0 | |
| - name: Build sdist | |
| run: pipx run build --sdist | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: cibw-sdist | |
| path: dist/*.tar.gz | |
| upload_pypi: | |
| needs: [build_wheels, build_sdist] | |
| name: Upload wheels to PyPI | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/avogadro | |
| permissions: | |
| id-token: write | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| # unpacks all CIBW artifacts into dist/ | |
| pattern: cibw-* | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 | |
| with: | |
| password: ${{ secrets.pypi_api_token }} |