Repository navigation
Fix Dataset.weighted reductions over a dimension missing from a variable and the weights #23164
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
| name: CI Additional | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| branches: | |
| - "main" | |
| workflow_dispatch: # allows you to trigger manually | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| FORCE_COLOR: 3 | |
| permissions: {} | |
| jobs: | |
| detect-ci-trigger: | |
| name: detect ci trigger | |
| runs-on: ubuntu-slim | |
| if: | | |
| github.repository == 'pydata/xarray' | |
| && (github.event_name == 'push' || github.event_name == 'pull_request') | |
| && !contains(github.event.pull_request.labels.*.name, 'skip-ci') | |
| outputs: | |
| triggered: ${{ steps.detect-trigger.outputs.trigger-found }} | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 2 | |
| persist-credentials: false | |
| - uses: xarray-contrib/ci-trigger@v1.2.1 | |
| id: detect-trigger | |
| with: | |
| keyword: "[skip-ci]" | |
| cache-pixi-lock: | |
| needs: detect-ci-trigger | |
| if: needs.detect-ci-trigger.outputs.triggered == 'false' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| cache-key: ${{ steps.pixi-lock.outputs.cache-key }} | |
| pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }} | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: xarray-contrib/pixi-lock/create-and-cache@v0.1.1 | |
| id: pixi-lock | |
| - uses: actions/upload-artifact@v7.0.2 | |
| with: | |
| name: pixi-lock | |
| path: pixi.lock | |
| doctest: | |
| name: Doctests | |
| runs-on: "ubuntu-latest" | |
| needs: cache-pixi-lock | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| PIXI_ENV: "test-py315" | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches and tags. | |
| persist-credentials: false | |
| - name: set environment variables | |
| run: | | |
| echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| - name: Restore cached pixi lockfile | |
| uses: xarray-contrib/pixi-lock/restore@v0.1.1 | |
| with: | |
| cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} | |
| - uses: prefix-dev/setup-pixi@v0.11.3 | |
| with: | |
| pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} | |
| cache: true | |
| environments: ${{ env.PIXI_ENV }} | |
| cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| - name: Version info | |
| run: | | |
| pixi run -e ${{env.PIXI_ENV}} -- python xarray/util/print_versions.py | |
| - name: Run doctests | |
| run: | | |
| # Raise an error if there are warnings in the doctests, with `-Werror`. | |
| # This is a trial; if it presents a problem, feel free to remove. | |
| # See https://github.com/pydata/xarray/issues/7164 for more info. | |
| # | |
| # If dependencies emit warnings we can't do anything about, ignore them with | |
| # `-W` after `-Werror`. Optional dependencies are imported lazily, so this | |
| # includes warnings raised when importing them. | |
| pixi run -e ${{env.PIXI_ENV}} -- python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror \ | |
| -W "ignore:numpy.ndarray size changed:RuntimeWarning" \ | |
| -W "ignore:The 'generic' unit for NumPy timedelta is deprecated:DeprecationWarning" | |
| mypy: | |
| name: Mypy | |
| runs-on: "ubuntu-latest" | |
| needs: cache-pixi-lock | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| PIXI_ENV: test-py315-with-typing | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches and tags. | |
| persist-credentials: false | |
| - name: Restore cached pixi lockfile | |
| uses: xarray-contrib/pixi-lock/restore@v0.1.1 | |
| with: | |
| cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} | |
| - uses: prefix-dev/setup-pixi@v0.11.3 | |
| with: | |
| pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} | |
| cache: true | |
| environments: ${{ env.PIXI_ENV }} | |
| cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| - name: set environment variables | |
| run: | | |
| echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| echo "PYTHON_VERSION=$(pixi run -e ${{env.PIXI_ENV}} -- python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV | |
| - name: Version info | |
| run: | | |
| pixi run -e ${{env.PIXI_ENV}} -- python xarray/util/print_versions.py | |
| - name: Run mypy | |
| run: | | |
| pixi run -e ${{env.PIXI_ENV}} -- python -m mypy --cobertura-xml-report mypy_report | |
| - name: Upload mypy coverage to Codecov | |
| uses: codecov/codecov-action@v7.1.1 | |
| with: | |
| files: mypy_report/cobertura.xml | |
| flags: mypy | |
| env_vars: PYTHON_VERSION | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| mypy-min: | |
| name: Mypy 3.12 | |
| runs-on: "ubuntu-latest" | |
| needs: cache-pixi-lock | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| PIXI_ENV: test-py312-with-typing | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches and tags. | |
| persist-credentials: false | |
| - name: Restore cached pixi lockfile | |
| uses: xarray-contrib/pixi-lock/restore@v0.1.1 | |
| with: | |
| cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} | |
| - uses: prefix-dev/setup-pixi@v0.11.3 | |
| with: | |
| pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} | |
| cache: true | |
| environments: ${{ env.PIXI_ENV }} | |
| cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| - name: set environment variables | |
| run: | | |
| echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| echo "PYTHON_VERSION=$(pixi run -e ${{env.PIXI_ENV}} -- python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV | |
| - name: Version info | |
| run: | | |
| pixi run -e ${{env.PIXI_ENV}} -- python xarray/util/print_versions.py | |
| - name: Run mypy | |
| run: | | |
| pixi run -e ${{env.PIXI_ENV}} -- python -m mypy --cobertura-xml-report mypy_report | |
| - name: Upload mypy coverage to Codecov | |
| uses: codecov/codecov-action@v7.1.1 | |
| with: | |
| files: mypy_report/cobertura.xml | |
| flags: mypy-min | |
| env_vars: PYTHON_VERSION | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| stubtest: | |
| name: Stubtest | |
| runs-on: "ubuntu-latest" | |
| needs: [detect-ci-trigger, cache-pixi-lock] | |
| # Phase 1: Non-blocking (informational only) | |
| # Change to 'false' once stubtest is stable to make it required | |
| continue-on-error: true | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| PIXI_ENV: test-py315-with-typing | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Restore cached pixi lockfile | |
| uses: xarray-contrib/pixi-lock/restore@v0.1.1 | |
| with: | |
| cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} | |
| - uses: prefix-dev/setup-pixi@v0.11.3 | |
| with: | |
| pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} | |
| cache: true | |
| environments: ${{ env.PIXI_ENV }} | |
| cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| - name: Version info | |
| run: | | |
| pixi run -e ${{env.PIXI_ENV}} -- python xarray/util/print_versions.py | |
| - name: Run stubtest (core modules) | |
| run: | | |
| pixi run -e ${{env.PIXI_ENV}} -- python -m mypy.stubtest \ | |
| xarray.core.dataarray \ | |
| xarray.core.dataset \ | |
| xarray.core.variable \ | |
| --mypy-config-file pyproject.toml \ | |
| --allowlist _stubtest/allowlist.txt | |
| pyright: | |
| name: Pyright | ${{ matrix.pixi-env }}" | |
| runs-on: "ubuntu-latest" | |
| needs: cache-pixi-lock | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| pixi-env: ["test-py315-with-typing", "test-py312-with-typing"] | |
| if: | | |
| always() | |
| && ( | |
| contains( github.event.pull_request.labels.*.name, 'run-pyright') | |
| ) | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches and tags. | |
| persist-credentials: false | |
| - name: Restore cached pixi lockfile | |
| uses: xarray-contrib/pixi-lock/restore@v0.1.1 | |
| with: | |
| cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} | |
| - uses: prefix-dev/setup-pixi@v0.11.3 | |
| with: | |
| pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} | |
| cache: true | |
| environments: ${{ matrix.pixi-env }} | |
| cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| - name: set environment variables | |
| run: | | |
| echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| echo "PYTHON_VERSION=$(pixi run -e ${{ matrix.pixi-env }} -- python --version | cut -d' ' -f2 | cut -d. -f1,2)" >> $GITHUB_ENV | |
| - name: Version info | |
| run: | | |
| pixi run -e ${{ matrix.pixi-env }} -- python xarray/util/print_versions.py | |
| - name: Run pyright | |
| run: | | |
| pixi run -e ${{ matrix.pixi-env }} -- python -m pyright xarray/ | |
| - name: Upload pyright coverage to Codecov | |
| uses: codecov/codecov-action@v7.1.1 | |
| with: | |
| files: pyright_report/cobertura.xml | |
| flags: pyright | |
| env_vars: PYTHON_VERSION | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| min-version-policy: | |
| name: Minimum Version Policy | |
| runs-on: "ubuntu-latest" | |
| needs: cache-pixi-lock | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| env: | |
| COLUMNS: 120 | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all branches and tags. | |
| persist-credentials: false | |
| - name: Restore cached pixi lockfile | |
| uses: xarray-contrib/pixi-lock/restore@v0.1.1 | |
| with: | |
| cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} | |
| - uses: prefix-dev/setup-pixi@v0.11.3 | |
| with: | |
| pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} | |
| cache: true | |
| environments: "policy" | |
| cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| - name: Bare minimum versions policy | |
| run: | | |
| pixi run policy-bare-minimum | |
| - name: Bare minimum and scipy versions policy | |
| run: | | |
| pixi run policy-bare-min-and-scipy | |
| - name: All-deps minimum versions policy | |
| run: | | |
| pixi run policy-min-versions | |
| check-generate-aggregations: | |
| name: "Check generate-aggregations is up-to-date" | |
| runs-on: ubuntu-latest | |
| needs: cache-pixi-lock | |
| if: | | |
| github.event_name == 'pull_request' | |
| && needs.cache-pixi-lock.result == 'success' | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Check if generate_aggregations.py changed | |
| id: filter | |
| run: | | |
| if git diff --name-only origin/${GITHUB_BASE_REF}...HEAD | grep -q 'xarray/util/generate_aggregations.py'; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Restore cached pixi lockfile | |
| if: steps.filter.outputs.changed == 'true' | |
| uses: xarray-contrib/pixi-lock/restore@v0.1.1 | |
| with: | |
| cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} | |
| - uses: prefix-dev/setup-pixi@v0.11.3 | |
| if: steps.filter.outputs.changed == 'true' | |
| with: | |
| pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} | |
| cache: true | |
| cache-write: false | |
| - name: Run generate-aggregations-ci | |
| if: steps.filter.outputs.changed == 'true' | |
| run: | | |
| pixi run generate-aggregations-ci | |
| check-generate-ops: | |
| name: "Check generate-ops is up-to-date" | |
| runs-on: ubuntu-latest | |
| needs: cache-pixi-lock | |
| if: | | |
| github.event_name == 'pull_request' | |
| && needs.cache-pixi-lock.result == 'success' | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Check if generate_ops.py or _typed_ops.py changed | |
| id: filter | |
| run: | | |
| if git diff --name-only origin/${GITHUB_BASE_REF}...HEAD | grep -qE 'xarray/util/generate_ops.py|xarray/core/_typed_ops.py'; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Restore cached pixi lockfile | |
| if: steps.filter.outputs.changed == 'true' | |
| uses: xarray-contrib/pixi-lock/restore@v0.1.1 | |
| with: | |
| cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} | |
| - uses: prefix-dev/setup-pixi@v0.11.3 | |
| if: steps.filter.outputs.changed == 'true' | |
| with: | |
| pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} | |
| cache: true | |
| cache-write: false | |
| - name: Run generate-ops-ci | |
| if: steps.filter.outputs.changed == 'true' | |
| run: | | |
| pixi run generate-ops-ci | |
| check-doc-redirects: | |
| name: Check redirects of moved doc pages | |
| runs-on: ubuntu-latest | |
| needs: detect-ci-trigger | |
| if: needs.detect-ci-trigger.outputs.triggered == 'false' | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| fetch-depth: 0 # The check looks at every page ever added to doc/. | |
| persist-credentials: false | |
| # Every page ever added to doc/ must still exist or be redirected in | |
| # rediraffe_redirects in doc/conf.py, so that links to old URLs keep working. | |
| - name: Check that moved or removed doc pages are redirected | |
| shell: bash | |
| run: | | |
| # Page names: paths below doc/ without suffix, skipping _build, _static, ... | |
| pages() { | |
| grep -E '\.(rst|md|ipynb)$' | grep -vE '/[_.]' | | |
| sed -E 's#^doc/##; s#\.(rst|md|ipynb)$##' | sort -u | |
| } | |
| # Pages that were removed on purpose and have no successor in the docs. | |
| removed_pages=( | |
| getting-started # xray v0.1 docs | |
| tutorial # xray v0.1 docs | |
| team # moved to https://xarray.dev/team (GH7061) | |
| sphinxext/ipython_sphinxext/README # vendored sphinx extension | |
| ) | |
| ever=$(git log --format= --name-only --no-renames --diff-filter=A -- doc | pages) | |
| known=$({ | |
| git ls-files doc | |
| sed -n '/^rediraffe_redirects = {/,/^}/s#^ *"\([^"]*\)":.*#doc/\1#p' doc/conf.py | |
| printf 'doc/%s.rst\n' "${removed_pages[@]}" | |
| } | pages) | |
| missing=$(comm -23 <(echo "$ever") <(echo "$known")) | |
| if [ -n "$missing" ]; then | |
| echo "These doc pages were removed or moved without a redirect in doc/conf.py:" | |
| echo "$missing" | |
| exit 1 | |
| fi | |
| actions-lockfile: | |
| name: Check actions lockfile | |
| runs-on: ubuntu-slim | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - run: gh extension install github/gh-actions-lock --pin v0.4.1 | |
| - run: gh actions-lock --verify | |
| zizmor: | |
| name: GHA Security Analysis using Zizmor | |
| runs-on: ubuntu-latest | |
| permissions: | |
| security-events: write # Required for upload-sarif (used by zizmor-action) to upload SARIF files. | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Run zizmor | |
| uses: zizmorcore/zizmor-action@v0.8.1 |