diff --git a/.github/workflows/cache-pixi-lock.yml b/.github/workflows/cache-pixi-lock.yml deleted file mode 100644 index a328420398d..00000000000 --- a/.github/workflows/cache-pixi-lock.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Generate and cache Pixi lockfile - -on: - workflow_call: - inputs: - pixi-version: - type: string - outputs: - cache-id: - description: "The lock file contents" - value: ${{ jobs.cache-pixi-lock.outputs.cache-id }} - -jobs: - cache-pixi-lock: - name: Pixi lock - runs-on: ubuntu-latest - outputs: - cache-id: ${{ steps.restore.outputs.cache-primary-key }} - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - submodules: recursive - - name: Get current date - id: date - run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" - - uses: actions/cache/restore@v5 - id: restore - with: - path: | - pixi.lock - key: ${{ steps.date.outputs.date }}_${{ inputs.pixi-version }}_${{hashFiles('pixi.toml')}} - - uses: prefix-dev/setup-pixi@v0.9.4 - if: ${{ !steps.restore.outputs.cache-hit }} - with: - pixi-version: ${{ inputs.pixi-version }} - run-install: false - - name: Run pixi lock - if: ${{ !steps.restore.outputs.cache-hit }} - run: pixi lock - - uses: actions/cache/save@v5 - if: ${{ !steps.restore.outputs.cache-hit }} - id: cache - with: - path: | - pixi.lock - key: ${{ steps.restore.outputs.cache-primary-key }} - - name: Upload pixi.lock - uses: actions/upload-artifact@v6 - with: - name: pixi-lock - path: pixi.lock diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index e09250b9974..df150bcd1be 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -19,7 +19,7 @@ env: jobs: detect-ci-trigger: name: detect ci trigger - runs-on: ubuntu-latest + runs-on: ubuntu-slim if: | github.repository == 'pydata/xarray' && (github.event_name == 'push' || github.event_name == 'pull_request') @@ -34,15 +34,31 @@ jobs: id: detect-trigger with: keyword: "[skip-ci]" + cache-pixi-lock: - uses: ./.github/workflows/cache-pixi-lock.yml - with: - pixi-version: "v0.63.2" # keep in sync with env var above + needs: detect-ci-trigger + if: needs.detect-ci-trigger.outputs.triggered == 'false' + runs-on: ubuntu-slim + + outputs: + cache-key: ${{ steps.pixi-lock.outputs.cache-key }} + pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }} + + steps: + - uses: actions/checkout@v6 + - uses: Parcels-code/pixi-lock/create-and-cache@9a2866f8258b87a3c616d5ad7d51c6cd853df78b + id: pixi-lock + with: + pixi-version: ${{env.PIXI_VERSION}} + - uses: actions/upload-artifact@v6 + with: + name: pixi-lock + path: pixi.lock + doctest: name: Doctests runs-on: "ubuntu-latest" - needs: [detect-ci-trigger, cache-pixi-lock] - if: needs.detect-ci-trigger.outputs.triggered == 'false' + needs: cache-pixi-lock defaults: run: @@ -59,16 +75,12 @@ jobs: echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - uses: prefix-dev/setup-pixi@v0.9.4 with: - pixi-version: ${{ env.PIXI_VERSION }} + 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' }} @@ -89,7 +101,7 @@ jobs: mypy: name: Mypy runs-on: "ubuntu-latest" - needs: [detect-ci-trigger, cache-pixi-lock] + needs: cache-pixi-lock defaults: run: shell: bash -l {0} @@ -101,16 +113,12 @@ jobs: with: fetch-depth: 0 # Fetch all history for all branches and tags. - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - uses: prefix-dev/setup-pixi@v0.9.4 with: - pixi-version: ${{ env.PIXI_VERSION }} + 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' }} @@ -138,7 +146,7 @@ jobs: mypy-min: name: Mypy 3.11 runs-on: "ubuntu-latest" - needs: [detect-ci-trigger, cache-pixi-lock] + needs: cache-pixi-lock defaults: run: shell: bash -l {0} @@ -150,16 +158,12 @@ jobs: with: fetch-depth: 0 # Fetch all history for all branches and tags. - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - uses: prefix-dev/setup-pixi@v0.9.4 with: - pixi-version: ${{ env.PIXI_VERSION }} + 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' }} @@ -187,7 +191,7 @@ jobs: pyright: name: Pyright | ${{ matrix.pixi-env }}" runs-on: "ubuntu-latest" - needs: [detect-ci-trigger, cache-pixi-lock] + needs: cache-pixi-lock strategy: fail-fast: false matrix: @@ -207,16 +211,12 @@ jobs: fetch-depth: 0 # Fetch all history for all branches and tags. - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} - - uses: prefix-dev/setup-pixi@v0.9.4 + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} + - uses: prefix-dev/setup-pixi@v0.9.3 with: - pixi-version: ${{ env.PIXI_VERSION }} + 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' }} @@ -244,8 +244,8 @@ jobs: min-version-policy: name: Minimum Version Policy runs-on: "ubuntu-latest" - needs: [detect-ci-trigger, cache-pixi-lock] - if: needs.detect-ci-trigger.outputs.triggered == 'false' + needs: cache-pixi-lock + defaults: run: shell: bash -l {0} @@ -259,17 +259,13 @@ jobs: fetch-depth: 0 # Fetch all history for all branches and tags. - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - uses: prefix-dev/setup-pixi@v0.9.4 with: - pixi-version: ${{ env.PIXI_VERSION }} + pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }} cache: true environments: "policy" cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7a1bd9229fc..a621b4e7954 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ env: jobs: detect-ci-trigger: name: detect ci trigger - runs-on: ubuntu-latest + runs-on: ubuntu-slim if: | github.repository == 'pydata/xarray' && (github.event_name == 'push' || github.event_name == 'pull_request') @@ -36,14 +36,30 @@ jobs: keyword: "[skip-ci]" cache-pixi-lock: - uses: ./.github/workflows/cache-pixi-lock.yml - with: - pixi-version: "v0.63.2" # keep in sync with env var above + needs: detect-ci-trigger + if: needs.detect-ci-trigger.outputs.triggered == 'false' + + runs-on: ubuntu-slim + + outputs: + cache-key: ${{ steps.pixi-lock.outputs.cache-key }} + pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }} + + steps: + - uses: actions/checkout@v6 + - uses: Parcels-code/pixi-lock/create-and-cache@9a2866f8258b87a3c616d5ad7d51c6cd853df78b + id: pixi-lock + with: + pixi-version: ${{env.PIXI_VERSION}} + - uses: actions/upload-artifact@v6 + with: + name: pixi-lock + path: pixi.lock + test: name: "${{ matrix.os }} | ${{ matrix.pixi-env }}${{ matrix.pytest-addopts && format(' ({0})', matrix.pytest-addopts) || '' }}" runs-on: ${{ matrix.os }} - needs: [detect-ci-trigger, cache-pixi-lock] - if: needs.detect-ci-trigger.outputs.triggered == 'false' + needs: cache-pixi-lock defaults: run: shell: bash -l {0} @@ -84,16 +100,12 @@ jobs: with: fetch-depth: 0 # Fetch all history for all branches and tags. - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} - - uses: prefix-dev/setup-pixi@v0.9.4 + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} + - uses: prefix-dev/setup-pixi@v0.9.3 with: - pixi-version: ${{ env.PIXI_VERSION }} + 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' }} @@ -170,7 +182,7 @@ jobs: event_file: name: "Event File" - runs-on: ubuntu-latest + runs-on: ubuntu-slim if: github.repository == 'pydata/xarray' steps: - name: Upload diff --git a/.github/workflows/hypothesis.yaml b/.github/workflows/hypothesis.yaml index d7475f5136d..f0e00cb885d 100644 --- a/.github/workflows/hypothesis.yaml +++ b/.github/workflows/hypothesis.yaml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest if: | github.repository == 'pydata/xarray' - && (github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'schedule') + && github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'skip-ci') outputs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} @@ -35,21 +35,39 @@ jobs: keyword: "[skip-ci]" cache-pixi-lock: - uses: ./.github/workflows/cache-pixi-lock.yml - with: - pixi-version: "v0.63.2" # keep in sync with env var above - - hypothesis: - name: Slow Hypothesis Tests - runs-on: "ubuntu-latest" - needs: [detect-ci-trigger, cache-pixi-lock] + needs: detect-ci-trigger if: | always() && ( - needs.detect-ci-trigger.outputs.triggered == 'false' - && ( (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') - || contains( github.event.pull_request.labels.*.name, 'run-slow-hypothesis')) + (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') + || ( + github.event_name == 'pull_request' + && needs.detect-ci-trigger.outputs.triggered == 'false' + && contains(github.event.pull_request.labels.*.name, 'run-slow-hypothesis') + ) ) + + runs-on: ubuntu-slim + outputs: + cache-key: ${{ steps.pixi-lock.outputs.cache-key }} + pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }} + steps: + - uses: actions/checkout@v6 + - uses: Parcels-code/pixi-lock/create-and-cache@9a2866f8258b87a3c616d5ad7d51c6cd853df78b + id: pixi-lock + with: + pixi-version: ${{env.PIXI_VERSION}} + - uses: actions/upload-artifact@v6 + with: + name: pixi-lock + path: pixi.lock + + hypothesis: + name: Slow Hypothesis Tests + runs-on: "ubuntu-latest" + + needs: cache-pixi-lock + defaults: run: shell: bash -l {0} @@ -63,16 +81,12 @@ jobs: fetch-depth: 0 # Fetch all history for all branches and tags. - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} - - uses: prefix-dev/setup-pixi@v0.9.4 + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} + - uses: prefix-dev/setup-pixi@v0.9.3 with: - pixi-version: ${{ env.PIXI_VERSION }} + 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' }} diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index bf8f700030b..4a95a2d3c19 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -22,7 +22,7 @@ env: jobs: detect-ci-trigger: name: detect upstream-dev ci trigger - runs-on: ubuntu-latest + runs-on: ubuntu-slim if: | github.repository == 'pydata/xarray' && (github.event_name == 'push' || github.event_name == 'pull_request') @@ -37,21 +37,42 @@ jobs: id: detect-trigger with: keyword: "[test-upstream]" + cache-pixi-lock: - uses: ./.github/workflows/cache-pixi-lock.yml - with: - pixi-version: "v0.63.2" # keep in sync with env var above - upstream-dev: - name: upstream-dev - runs-on: ubuntu-latest - needs: [detect-ci-trigger, cache-pixi-lock] + runs-on: ubuntu-slim + needs: detect-ci-trigger if: | always() + && github.repository == 'pydata/xarray' && ( - (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') - || needs.detect-ci-trigger.outputs.triggered == 'true' - || contains( github.event.pull_request.labels.*.name, 'run-upstream') + (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') + || ( + github.event_name == 'pull_request' + && ( + needs.detect-ci-trigger.outputs.triggered == 'true' + || contains( github.event.pull_request.labels.*.name, 'run-upstream') + ) + ) ) + + outputs: + cache-key: ${{ steps.pixi-lock.outputs.cache-key }} + pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }} + steps: + - uses: actions/checkout@v6 + - uses: Parcels-code/pixi-lock/create-and-cache@9a2866f8258b87a3c616d5ad7d51c6cd853df78b + id: pixi-lock + with: + pixi-version: ${{env.PIXI_VERSION}} + - uses: actions/upload-artifact@v6 + with: + name: pixi-lock + path: pixi.lock + + upstream-dev: + name: upstream-dev + runs-on: ubuntu-latest + needs: cache-pixi-lock defaults: run: shell: bash -l {0} @@ -64,16 +85,12 @@ jobs: with: fetch-depth: 0 # Fetch all history for all branches and tags. - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} - uses: prefix-dev/setup-pixi@v0.9.4 with: - pixi-version: ${{ env.PIXI_VERSION }} + 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' }} @@ -121,16 +138,12 @@ jobs: fetch-depth: 0 # Fetch all history for all branches and tags. - name: Restore cached pixi lockfile - uses: actions/cache/restore@v5 - id: restore-pixi-lock + uses: Parcels-code/pixi-lock/restore@9a2866f8258b87a3c616d5ad7d51c6cd853df78b with: - enableCrossOsArchive: true - path: | - pixi.lock - key: ${{ needs.cache-pixi-lock.outputs.cache-id }} - - uses: prefix-dev/setup-pixi@v0.9.4 + cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }} + - uses: prefix-dev/setup-pixi@v0.9.3 with: - pixi-version: ${{ env.PIXI_VERSION }} + 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' }}