Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "monthly"
cooldown:
default-days: 7
groups:
actions:
patterns:
- "*"
7 changes: 5 additions & 2 deletions .github/workflows/ci-additional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
doctests:
name: Doctests
Expand All @@ -23,13 +25,14 @@ jobs:

steps:
- name: checkout the repository
uses: actions/checkout@v7
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
# need to fetch all tags to get a correct version
fetch-depth: 0 # fetch all branches and tags
persist-credentials: false

- name: setup environment
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # 0.9.6
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6
with:
environments: "ci-py313"

Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
detect-skip-ci-trigger:
name: "Detect CI Trigger: [skip-ci]"
Expand All @@ -20,10 +22,11 @@ jobs:
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1
persist-credentials: false
- uses: xarray-contrib/ci-trigger@10cd2bfec3484946a4058a421ddf9cfad101e715 # v1.2.1
id: detect-trigger
with:
keyword: "[skip-ci]"
Expand Down Expand Up @@ -65,28 +68,31 @@ jobs:
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"]

env:
FORCE_COLOR: 3
ENV: ${{ matrix.env }}
RUNNER_OS: ${{ matrix.os }}

steps:
- name: checkout the repository
uses: actions/checkout@v7
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
# need to fetch all tags to get a correct version
fetch-depth: 0 # fetch all branches and tags
persist-credentials: false

- uses: Parcels-code/pixi-lock/restore@38495788b79a5ff26009aecc15daa9a8310b8832 # v0.1.0
with:
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}

- name: setup environment
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # 0.9.6
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6
with:
pixi-version: "${{ needs.cache-pixi-lock.outputs.pixi-version }}"
frozen: true
Expand All @@ -95,23 +101,22 @@ jobs:

- 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 }}"
echo PYTHON_VERSION=$(pixi run -e $ENV python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') >> $GITHUB_ENV

- name: import pint-xarray
run: |
pixi run -e ${{ matrix.env }} python -c 'import pint_xarray'
pixi run -e $ENV python -c 'import pint_xarray'

- name: run tests
if: success()
id: status
run: |
pixi run -e ${{ matrix.env }} tests --cov-report=xml
pixi run -e $ENV tests --cov-report=xml

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v7.0.0
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: "${{ secrets.CODECOV_TOKEN }}"
token: "${{ secrets.CODECOV_TOKEN }}" # zizmor: ignore[secrets-outside-env] codecov token
files: ./coverage.xml
flags: unittests
env_vars: RUNNER_OS,PYTHON_VERSION
Expand Down
44 changes: 35 additions & 9 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
detect-test-upstream-trigger:
name: "Detect CI Trigger: [test-upstream]"
Expand All @@ -24,10 +26,11 @@ jobs:
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1.2
persist-credentials: false
- uses: xarray-contrib/ci-trigger@10cd2bfec3484946a4058a421ddf9cfad101e715 # v1.2.1
id: detect-trigger
with:
keyword: "[test-upstream]"
Expand Down Expand Up @@ -57,13 +60,14 @@ jobs:

steps:
- name: checkout the repository
uses: actions/checkout@v7
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
# need to fetch all tags to get a correct version
fetch-depth: 0 # fetch all branches and tags
persist-credentials: false

- name: setup environment
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # 0.9.6
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6
with:
environments: "nightly"
locked: false
Expand All @@ -80,11 +84,33 @@ jobs:
run: |
pixi run -e nightly tests -rf --report-log=pytest-log.jsonl

- name: upload the log file
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: log file
path: pytest-log.jsonl

create-issue:
name: Report failures
runs-on: ubuntu-latest
needs: upstream-dev

if: |
always()
&& needs.upstream-dev.result == 'failure'
&& github.repository == 'xarray-contrib/pint-xarray'
&& github.event_name == 'schedule'

permissions:
issues: write # open issues if the tests failed

steps:
- name: download log file
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: log file

- name: report failures
if: |
failure()
&& steps.status.outcome == 'failure'
&& github.event_name == 'schedule'
uses: scientific-python/issue-from-pytest-log@v1
uses: scientific-python/issue-from-pytest-log@8e905db353437cda1d6a773de245343fbfc940dd # v1.5.0
with:
log-path: pytest-log.jsonl
32 changes: 25 additions & 7 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,34 @@ on:
release:
types:
- published
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
build-artifacts:
name: Build packages
runs-on: ubuntu-latest
if: github.repository == 'xarray-contrib/pint-xarray'
if: |
github.repository == 'xarray-contrib/pint-xarray'
&& (
github.event_name == 'release'
|| contains(github.event.pull_request.labels.*.name, 'release')
)

steps:
- uses: actions/checkout@v7
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-python@v6
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
name: Install Python
with:
python-version: "3.x"
Expand All @@ -40,12 +57,13 @@ jobs:
else
echo "✅ Looks good"
fi
- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: releases
path: dist

upload-to-pypi:
name: Upload to PyPI
needs: build-artifacts
if: github.event_name == 'release'
runs-on: ubuntu-latest
Expand All @@ -54,14 +72,14 @@ jobs:
name: pypi
url: https://pypi.org/p/pint-xarray
permissions:
id-token: write
id-token: write # upload packages to pypi

steps:
- uses: actions/download-artifact@v8
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
with:
verbose: true
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ repos:
rev: 26.5.1
hooks:
- id: black-jupyter
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.23.1
hooks:
- id: zizmor
- repo: https://github.com/keewis/blackdoc
rev: v0.4.6
hooks:
Expand Down
Loading