Skip to content

Commit 3348732

Browse files
committed
Refactor cache-pixi-lock.yml workflow into external action
Followup on pydata#10888 (comment)
1 parent c085199 commit 3348732

5 files changed

Lines changed: 80 additions & 120 deletions

File tree

.github/workflows/cache-pixi-lock.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/ci-additional.yaml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,20 @@ jobs:
3535
with:
3636
keyword: "[skip-ci]"
3737
cache-pixi-lock:
38-
uses: ./.github/workflows/cache-pixi-lock.yml
39-
with:
40-
pixi-version: "v0.63.1" # keep in sync with env var above
38+
runs-on: ubuntu-slim
39+
outputs:
40+
cache-key: ${{ steps.pixi-lock.outputs.cache-key }}
41+
pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }}
42+
steps:
43+
- uses: actions/checkout@v6
44+
- uses: Parcels-code/pixi-lock/create-and-cache@82087290114bffa037dc527b2afc3d1c797eda8f
45+
id: pixi-lock
46+
with:
47+
pixi-version: ${{env.PIXI_VERSION}}
48+
- uses: actions/upload-artifact@v6
49+
with:
50+
name: pixi-lock
51+
path: pixi.lock
4152
doctest:
4253
name: Doctests
4354
runs-on: "ubuntu-latest"
@@ -59,16 +70,12 @@ jobs:
5970
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
6071
6172
- name: Restore cached pixi lockfile
62-
uses: actions/cache/restore@v5
63-
id: restore-pixi-lock
73+
uses: Parcels-code/pixi-lock/restore@82087290114bffa037dc527b2afc3d1c797eda8f
6474
with:
65-
enableCrossOsArchive: true
66-
path: |
67-
pixi.lock
68-
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
75+
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
6976
- uses: prefix-dev/setup-pixi@v0.9.3
7077
with:
71-
pixi-version: ${{ env.PIXI_VERSION }}
78+
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
7279
cache: true
7380
environments: ${{ env.PIXI_ENV }}
7481
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
@@ -101,16 +108,12 @@ jobs:
101108
with:
102109
fetch-depth: 0 # Fetch all history for all branches and tags.
103110
- name: Restore cached pixi lockfile
104-
uses: actions/cache/restore@v5
105-
id: restore-pixi-lock
111+
uses: Parcels-code/pixi-lock/restore@82087290114bffa037dc527b2afc3d1c797eda8f
106112
with:
107-
enableCrossOsArchive: true
108-
path: |
109-
pixi.lock
110-
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
113+
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
111114
- uses: prefix-dev/setup-pixi@v0.9.3
112115
with:
113-
pixi-version: ${{ env.PIXI_VERSION }}
116+
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
114117
cache: true
115118
environments: ${{ env.PIXI_ENV }}
116119
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
@@ -150,16 +153,12 @@ jobs:
150153
with:
151154
fetch-depth: 0 # Fetch all history for all branches and tags.
152155
- name: Restore cached pixi lockfile
153-
uses: actions/cache/restore@v5
154-
id: restore-pixi-lock
156+
uses: Parcels-code/pixi-lock/restore@82087290114bffa037dc527b2afc3d1c797eda8f
155157
with:
156-
enableCrossOsArchive: true
157-
path: |
158-
pixi.lock
159-
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
158+
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
160159
- uses: prefix-dev/setup-pixi@v0.9.3
161160
with:
162-
pixi-version: ${{ env.PIXI_VERSION }}
161+
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
163162
cache: true
164163
environments: ${{ env.PIXI_ENV }}
165164
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
@@ -207,16 +206,12 @@ jobs:
207206
fetch-depth: 0 # Fetch all history for all branches and tags.
208207

209208
- name: Restore cached pixi lockfile
210-
uses: actions/cache/restore@v5
211-
id: restore-pixi-lock
209+
uses: Parcels-code/pixi-lock/restore@82087290114bffa037dc527b2afc3d1c797eda8f
212210
with:
213-
enableCrossOsArchive: true
214-
path: |
215-
pixi.lock
216-
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
211+
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
217212
- uses: prefix-dev/setup-pixi@v0.9.3
218213
with:
219-
pixi-version: ${{ env.PIXI_VERSION }}
214+
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
220215
cache: true
221216
environments: ${{ matrix.pixi-env }}
222217
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}

.github/workflows/ci.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,20 @@ jobs:
3636
keyword: "[skip-ci]"
3737

3838
cache-pixi-lock:
39-
uses: ./.github/workflows/cache-pixi-lock.yml
40-
with:
41-
pixi-version: "v0.63.1" # keep in sync with env var above
39+
runs-on: ubuntu-slim
40+
outputs:
41+
cache-key: ${{ steps.pixi-lock.outputs.cache-key }}
42+
pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }}
43+
steps:
44+
- uses: actions/checkout@v6
45+
- uses: Parcels-code/pixi-lock/create-and-cache@82087290114bffa037dc527b2afc3d1c797eda8f
46+
id: pixi-lock
47+
with:
48+
pixi-version: ${{env.PIXI_VERSION}}
49+
- uses: actions/upload-artifact@v6
50+
with:
51+
name: pixi-lock
52+
path: pixi.lock
4253
test:
4354
name: "${{ matrix.os }} | ${{ matrix.pixi-env }}${{ matrix.pytest-addopts && format(' ({0})', matrix.pytest-addopts) || '' }}"
4455
runs-on: ${{ matrix.os }}
@@ -84,16 +95,12 @@ jobs:
8495
with:
8596
fetch-depth: 0 # Fetch all history for all branches and tags.
8697
- name: Restore cached pixi lockfile
87-
uses: actions/cache/restore@v5
88-
id: restore-pixi-lock
98+
uses: Parcels-code/pixi-lock/restore@82087290114bffa037dc527b2afc3d1c797eda8f
8999
with:
90-
enableCrossOsArchive: true
91-
path: |
92-
pixi.lock
93-
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
100+
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
94101
- uses: prefix-dev/setup-pixi@v0.9.3
95102
with:
96-
pixi-version: ${{ env.PIXI_VERSION }}
103+
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
97104
cache: true
98105
environments: ${{ matrix.pixi-env }}
99106
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}

.github/workflows/hypothesis.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,20 @@ jobs:
3535
keyword: "[skip-ci]"
3636

3737
cache-pixi-lock:
38-
uses: ./.github/workflows/cache-pixi-lock.yml
39-
with:
40-
pixi-version: "v0.63.1" # keep in sync with env var above
38+
runs-on: ubuntu-slim
39+
outputs:
40+
cache-key: ${{ steps.pixi-lock.outputs.cache-key }}
41+
pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }}
42+
steps:
43+
- uses: actions/checkout@v6
44+
- uses: Parcels-code/pixi-lock/create-and-cache@82087290114bffa037dc527b2afc3d1c797eda8f
45+
id: pixi-lock
46+
with:
47+
pixi-version: ${{env.PIXI_VERSION}}
48+
- uses: actions/upload-artifact@v6
49+
with:
50+
name: pixi-lock
51+
path: pixi.lock
4152

4253
hypothesis:
4354
name: Slow Hypothesis Tests
@@ -63,16 +74,12 @@ jobs:
6374
fetch-depth: 0 # Fetch all history for all branches and tags.
6475

6576
- name: Restore cached pixi lockfile
66-
uses: actions/cache/restore@v5
67-
id: restore-pixi-lock
77+
uses: Parcels-code/pixi-lock/restore@82087290114bffa037dc527b2afc3d1c797eda8f
6878
with:
69-
enableCrossOsArchive: true
70-
path: |
71-
pixi.lock
72-
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
79+
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
7380
- uses: prefix-dev/setup-pixi@v0.9.3
7481
with:
75-
pixi-version: ${{ env.PIXI_VERSION }}
82+
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
7683
cache: true
7784
environments: ${{ env.PIXI_ENV }}
7885
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}

.github/workflows/upstream-dev-ci.yaml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,20 @@ jobs:
3838
with:
3939
keyword: "[test-upstream]"
4040
cache-pixi-lock:
41-
uses: ./.github/workflows/cache-pixi-lock.yml
42-
with:
43-
pixi-version: "v0.63.1" # keep in sync with env var above
41+
runs-on: ubuntu-slim
42+
outputs:
43+
cache-key: ${{ steps.pixi-lock.outputs.cache-key }}
44+
pixi-version: ${{ steps.pixi-lock.outputs.pixi-version }}
45+
steps:
46+
- uses: actions/checkout@v6
47+
- uses: Parcels-code/pixi-lock/create-and-cache@82087290114bffa037dc527b2afc3d1c797eda8f
48+
id: pixi-lock
49+
with:
50+
pixi-version: ${{env.PIXI_VERSION}}
51+
- uses: actions/upload-artifact@v6
52+
with:
53+
name: pixi-lock
54+
path: pixi.lock
4455
upstream-dev:
4556
name: upstream-dev
4657
runs-on: ubuntu-latest
@@ -64,16 +75,12 @@ jobs:
6475
with:
6576
fetch-depth: 0 # Fetch all history for all branches and tags.
6677
- name: Restore cached pixi lockfile
67-
uses: actions/cache/restore@v5
68-
id: restore-pixi-lock
78+
uses: Parcels-code/pixi-lock/restore@82087290114bffa037dc527b2afc3d1c797eda8f
6979
with:
70-
enableCrossOsArchive: true
71-
path: |
72-
pixi.lock
73-
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
80+
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
7481
- uses: prefix-dev/setup-pixi@v0.9.3
7582
with:
76-
pixi-version: ${{ env.PIXI_VERSION }}
83+
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
7784
cache: true
7885
environments: ${{ matrix.pixi-env }}
7986
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
@@ -121,16 +128,12 @@ jobs:
121128
fetch-depth: 0 # Fetch all history for all branches and tags.
122129

123130
- name: Restore cached pixi lockfile
124-
uses: actions/cache/restore@v5
125-
id: restore-pixi-lock
131+
uses: Parcels-code/pixi-lock/restore@82087290114bffa037dc527b2afc3d1c797eda8f
126132
with:
127-
enableCrossOsArchive: true
128-
path: |
129-
pixi.lock
130-
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
133+
cache-key: ${{ needs.cache-pixi-lock.outputs.cache-key }}
131134
- uses: prefix-dev/setup-pixi@v0.9.3
132135
with:
133-
pixi-version: ${{ env.PIXI_VERSION }}
136+
pixi-version: ${{ needs.cache-pixi-lock.outputs.pixi-version }}
134137
cache: true
135138
environments: ${{ matrix.pixi-env }}
136139
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}

0 commit comments

Comments
 (0)