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
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ updates:
schedule:
# Check for updates once a week
interval: "weekly"
cooldown:
default-days: 7
106 changes: 7 additions & 99 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
ci:
name: tests
Expand All @@ -21,106 +23,12 @@ jobs:
steps:
- name: clone the repository
uses: actions/checkout@v6
- name: setup python
uses: actions/setup-python@v6
with:
persist-credentials: false
- name: setup environment
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # 7.1.6
with:
python-version: "${{ matrix.python-version }}"
- name: upgrade pip
run: |
python -m pip install --upgrade pip
- name: install dependencies
run: |
python -m pip install -r requirements.txt
python -m pip install .
python -m pip install pytest
- name: run tests
run: |
python -m pytest -rf

e2e:
name: end-to-end
runs-on: [ubuntu-latest]

strategy:
fail-fast: false
matrix:
envs:
- "envs/env1.yaml"
- "envs/env2.yaml"
- |
envs/env1.yaml
envs/env2.yaml
expected-failure: ["false"]
policy-file: ["policy.yaml"]
include:
- envs: |
envs/failing-env1.yaml
policy-file: "policy.yaml"
expected-failure: "true"
- envs: |
envs/env1.yaml
envs/failing-env1.yaml
policy-file: "policy.yaml"
expected-failure: "true"
- envs: "envs/env1.yaml"
policy-file: "policy_no_extra_options.yaml"
expected-failure: "false"
- envs: "pixi:env1"
manifest-path: "envs/pixi.toml"
policy-file: "policy.yaml"
expected-failure: "false"
- envs: |
pixi:env1
pixi:env2
manifest-path: "envs/pixi.toml"
policy-file: "policy.yaml"
expected-failure: "false"
- envs: |
pixi:env1
conda:envs/env2.yaml
manifest-path: "envs/pixi.toml"
policy-file: "policy.yaml"
expected-failure: "false"
- envs: "pixi:failing-env"
manifest-path: "envs/pixi.toml"
policy-file: "policy.yaml"
expected-failure: "true"

steps:
- name: clone the repository
uses: actions/checkout@v6
- name: run action
uses: ./
id: action-run
continue-on-error: true
with:
policy: ${{ matrix.policy-file }}
environments: ${{ matrix.envs }}
today: 2024-12-20
manifest-path: ${{ matrix.manifest-path }}
- name: detect outcome
if: always()
shell: bash -l {0}
run: |
if [[ "${{ steps.action-run.outcome }}" == "success" && ${{ matrix.expected-failure }} == "true" ]]; then
# unexpected pass
echo "workflow xpassed"
export STATUS=1
elif [[ "${{ steps.action-run.outcome }}" == "failure" && ${{ matrix.expected-failure }} == "false" ]]; then
# unexpected failure
echo "workflow failed"
export STATUS=2
elif [[ "${{ steps.action-run.outcome }}" == "success" && ${{ matrix.expected-failure }} == "false" ]]; then
# normal pass
echo "workflow passed"
export STATUS=0
elif [[ "${{ steps.action-run.outcome }}" == "failure" && ${{ matrix.expected-failure }} == "true" ]]; then
# expected failure
echo "workflow xfailed"
export STATUS=0
else
# cancelled
echo "workflow cancelled"
export STATUS=3
fi
exit $STATUS
uv run -m pytest -rf --cov=minimum_versions
65 changes: 65 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and upload to PyPI

on:
release:
types: [published]

permissions: {}

jobs:
build:
name: Build packages
runs-on: ubuntu-latest
if: github.owner == 'xarray-contrib'
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build
run: |
python -m build --outdir dist/ .
- name: Check the built archives
run: |
twine check dist/*
pip install dist/*.whl
minimum-versions --help
- name: Upload build artifacts
uses: actions/upload-artifact@v5
with:
name: packages
path: dist/*

publish:
name: Upload to PyPI
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'

environment:
name: pypi
url: https://pypi.org/p/xarray-minimum-dependency-policy
permissions:
id-token: write

steps:
- name: Download build artifacts
uses: actions/download-artifact@v6
with:
name: packages
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
verify_metadata: true
verbose: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

__pycache__/
.coverage

uv.lock
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.11.0
rev: 25.12.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.7
rev: v0.14.10
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.7.3
rev: v3.7.4
hooks:
- id: prettier
args: ["--cache-location=.prettier_cache"]
Expand All @@ -29,6 +29,10 @@ repos:
rev: v0.24.1
hooks:
- id: validate-pyproject
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.19.0
hooks:
- id: zizmor

ci:
autofix_prs: true
Expand Down
Loading