[pre-commit.ci] pre-commit autoupdate #721
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
| # adapted from xarray's ci | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| detect-skip-ci-trigger: | |
| name: "Detect CI Trigger: [skip-ci]" | |
| if: github.event_name == 'push' || github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| triggered: ${{ steps.detect-trigger.outputs.trigger-found }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 2 | |
| - uses: xarray-contrib/ci-trigger@v1 | |
| id: detect-trigger | |
| with: | |
| keyword: "[skip-ci]" | |
| ci: | |
| name: ${{ matrix.os }} ${{ matrix.env }} | |
| runs-on: ${{ matrix.os }} | |
| needs: detect-skip-ci-trigger | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| FORCE_COLOR: 3 | |
| if: | | |
| always() | |
| && github.repository == 'xarray-contrib/pint-xarray' | |
| && ( | |
| github.event_name == 'workflow_dispatch' | |
| || needs.detect-skip-ci-trigger.outputs.triggered == 'false' | |
| ) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| env: ["tests-py311", "tests-py312", "tests-py313"] | |
| os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
| steps: | |
| - name: checkout the repository | |
| uses: actions/checkout@v5 | |
| with: | |
| # need to fetch all tags to get a correct version | |
| fetch-depth: 0 # fetch all branches and tags | |
| - name: setup environment | |
| uses: prefix-dev/setup-pixi@82d477f15f3a381dbcc8adc1206ce643fe110fb7 # 0.9.3 | |
| with: | |
| environments: "${{ matrix.env }}" | |
| - name: investigate env variables | |
| run: | | |
| echo PYTHON_VERSION=$(pixi run -e ${{ matrix.env }} python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') >> $GITHUB_ENV | |
| echo RUNNER_OS="${{ matrix.os }}" | |
| - name: import pint-xarray | |
| run: | | |
| pixi run -e ${{ matrix.env }} python -c 'import pint_xarray' | |
| - name: run tests | |
| if: success() | |
| id: status | |
| run: | | |
| pixi run -e ${{ matrix.env }} tests --cov-report=xml | |
| - name: Upload code coverage to Codecov | |
| uses: codecov/[email protected] | |
| with: | |
| token: "${{ secrets.CODECOV_TOKEN }}" | |
| files: ./coverage.xml | |
| flags: unittests | |
| env_vars: RUNNER_OS,PYTHON_VERSION | |
| name: codecov-umbrella | |
| fail_ci_if_error: false |