Skip to content

strip units instead of dequantifying (#367) #781

strip units instead of dequantifying (#367)

strip units instead of dequantifying (#367) #781

Workflow file for this run

# 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-slim
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1
id: detect-trigger
with:
keyword: "[skip-ci]"
cache-pixi-lock:
name: "Cache pixi lock"
needs: detect-skip-ci-trigger
runs-on: ubuntu-slim
if: |
always()
&& github.repository == 'xarray-contrib/pint-xarray'
&& (
github.event_name == 'workflow_dispatch' || github.event_name == 'push'
|| (
github.event_name == 'pull_request'
&& (
needs.detect-skip-ci-trigger.outputs.triggered == 'false'
&& !contains(github.event.pull_request.labels.*.name, 'skip-ci')
)
)
)
outputs:
cache-key: ${{ steps.pixi-lock.outputs.cache-key }}
pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: Parcels-code/pixi-lock/create-and-cache@5cbd7a155fa24aa0711ec0a9aad9ede0819e84a1 # v0.1.0
id: pixi-lock
ci:
name: ${{ matrix.os }} ${{ matrix.env }}
runs-on: ${{ matrix.os }}
needs: cache-pixi-lock
defaults:
run:
shell: bash -l {0}
env:
FORCE_COLOR: 3
strategy:
fail-fast: false
matrix:
env: ["ci-py311", "ci-py313", "ci-py314"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- name: checkout the repository
uses: actions/checkout@v6
with:
# need to fetch all tags to get a correct version
fetch-depth: 0 # fetch all branches and tags
- uses: Parcels-code/pixi-lock/restore@5cbd7a155fa24aa0711ec0a9aad9ede0819e84a1 # v0.1.0
with:
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
- name: setup environment
uses: prefix-dev/setup-pixi@a0af7a228712d6121d37aba47adf55c1332c9c2e # 0.9.4
with:
pixi-version: "${{ needs.cache-pixi-lock.outputs.pixi-version }}"
frozen: true
cache: true
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/codecov-action@v5.5.2
with:
token: "${{ secrets.CODECOV_TOKEN }}"
files: ./coverage.xml
flags: unittests
env_vars: RUNNER_OS,PYTHON_VERSION
name: codecov-umbrella
fail_ci_if_error: false