Replace Tox with Pixi #1272
Workflow file for this run
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
| # Reference: | |
| # - https://github.com/actions/cache | |
| # - https://github.com/actions/checkout | |
| # - https://github.com/prefix-dev/setup-pixi | |
| name: ci-tests | |
| on: | |
| pull_request: | |
| push: | |
| branches-ignore: | |
| - "conda-lock-auto-update" | |
| - "pre-commit-ci-update-config" | |
| - "dependabot/*" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| run-tests: | |
| name: "Test ${{ matrix.version }} on ${{ matrix.os }}" | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| CYTHON_COVERAGE: 1 | |
| ENV_NAME: "ci-tests" | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest] | |
| version: [py310, py311, py312, py313] | |
| gitpath-prepend: [""] | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux | |
| - os: ubuntu-latest | |
| version: py313 | |
| posargs: "--cov-report=xml --cov" | |
| - os: macos-latest | |
| version: py313 | |
| platform: osx | |
| # On macos, the up-to-date git may not be first on the path | |
| # N.B. setting includes a final ":", to simplify the path setting command | |
| gitpath-prepend: "/opt/homebrew/bin:" | |
| - os: windows-latest | |
| version: py313 | |
| platform: win | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| # setuptools can't find shared library installed by conda on windows | |
| # so we need to prepare environment variables for it | |
| - name: Export environment variables for UDUNITS2 lookup | |
| if: runner.os == 'Windows' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const path = require('path') | |
| const base = path.join('.pixi/envs/test-${{ matrix.version }}') | |
| core.exportVariable('UDUNITS2_INCDIR', path.join(base, 'Library/include/')); | |
| core.exportVariable('UDUNITS2_LIBDIR', path.join(base, 'Library/lib/')); | |
| core.exportVariable('UDUNITS2_XML_PATH', path.join(base, 'Library/share/udunits/udunits2.xml')); | |
| - name: "Pixi setup" | |
| uses: prefix-dev/setup-pixi@82d477f15f3a381dbcc8adc1206ce643fe110fb7 | |
| with: | |
| environments: "test-${{ matrix.version }}" | |
| frozen: true | |
| activate-environment: true | |
| - name: "Run ${{ matrix.os }} on ${{ matrix.version}} tests" | |
| run: | | |
| export PATH=${{ matrix.gitpath-prepend }}$PATH | |
| which git | |
| git --version | |
| pixi run pytest ${{ matrix.posargs }} | |
| - name: "Upload coverage report to Codecov" | |
| if: contains(matrix.posargs, '--cov') | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |