8
8
branches : [next]
9
9
10
10
jobs :
11
- install :
12
- timeout-minutes : 60
13
- name : Install (${{ matrix.os }} / node ${{ matrix.node }})
14
- runs-on : ${{ matrix.os }}
15
- env :
16
- TURBO_TOKEN : ${{ secrets.TURBO_TOKEN }}
17
- TURBO_TEAM : ${{ vars.TURBO_TEAM }}
18
- continue-on-error : ${{ matrix.experimental }}
19
-
20
- strategy :
21
- fail-fast : false
22
- matrix :
23
- os : [ubuntu-latest]
24
- node : [18, 20]
25
- experimental : [false]
26
- # include:
27
- # - os: windows-latest
28
- # node: 16
29
- # experimental: true
30
-
31
- steps :
32
- - name : Checkout
33
- uses : actions/checkout@v4
34
-
35
- - name : Setup node
36
- uses : actions/setup-node@v4
37
- with :
38
- node-version : ${{ matrix.node }}
39
-
40
- - name : Install pnpm
41
- run : corepack enable && pnpm --version
42
-
43
- - name : Cache node modules
44
- id : cache-node-modules
45
- uses : actions/cache@v4
46
- env :
47
- cache-name : cache-node-modules
48
- with :
49
- path : ' **/node_modules'
50
- key : ${{ runner.os }}-modules-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
51
- restore-keys : |
52
- ${{ runner.os }}-modules-${{ env.cache-name }}-
53
- ${{ runner.os }}-modules-
54
- ${{ runner.os }}-
55
-
56
- - name : Cache build
57
- id : cache-build
58
- uses : actions/cache@v4
59
- env :
60
- cache-name : cache-build
61
- with :
62
- path : ' ./*'
63
- # Unique key for a workflow run. Should be invalidated in the next run
64
- key : ${{ runner.os }}-build-${{ matrix.node }}-${{ env.cache-name }}-${{ github.run_id }}
65
-
66
- - name : Install project dependencies
67
- if : steps.cache-node-modules.outputs.cache-hit != 'true'
68
- run : pnpm install
69
-
70
- - name : Build CLI
71
- run : pnpm build # Needed for CLI tests
72
-
73
11
test :
74
12
timeout-minutes : 60
75
13
name : Test (${{ matrix.os }} / node ${{ matrix.node }})
78
16
TURBO_TOKEN : ${{ secrets.TURBO_TOKEN }}
79
17
TURBO_TEAM : ${{ vars.TURBO_TEAM }}
80
18
continue-on-error : ${{ matrix.experimental }}
81
- needs : [install]
82
19
83
20
strategy :
84
21
# we want to know if a test fails on a specific node version
@@ -103,35 +40,33 @@ jobs:
103
40
with :
104
41
node-version : ${{ matrix.node }}
105
42
106
- - name : Install pnpm
107
- run : corepack enable && pnpm --version
43
+ - uses : pnpm/action-setup@v2
44
+ name : Install pnpm
45
+ id : pnpm-install
46
+ with :
47
+ version : 8
48
+ run_install : false
108
49
109
- - name : Restore node_modules cache
110
- uses : actions/cache/restore@v4
111
- id : restore-node-modules
50
+ - name : Get pnpm store directory
51
+ id : pnpm-cache
52
+ shell : bash
53
+ run : |
54
+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
55
+
56
+ - name : Cache node modules
57
+ id : cache-node-modules
58
+ uses : actions/cache@v4
112
59
env :
113
60
cache-name : cache-node-modules
114
61
with :
115
- path : ' **/node_modules '
116
- key : ${{ runner.os }}-modules -${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
62
+ path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
63
+ key : ${{ runner.os }}-pnpm-store -${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
117
64
restore-keys : |
118
- ${{ runner.os }}-modules-${{ env.cache-name }}-
119
- ${{ runner.os }}-modules-
120
- ${{ runner.os }}-
121
-
122
- - name : Restore build cache
123
- uses : actions/cache/restore@v4
124
- id : restore-build
125
- env :
126
- cache-name : cache-build
127
- with :
128
- path : ./*
129
- key : ${{ runner.os }}-build-${{ matrix.node }}-${{ env.cache-name }}-${{ github.run_id }}
130
- # If the cached build from the pervious step is not available. Fail the build
131
- fail-on-cache-miss : true
65
+ v1-${{ runner.os }}-pnpm-store-${{ env.cache-name }}-
66
+ v1-${{ runner.os }}-pnpm-store-
67
+ v1-${{ runner.os }}-
132
68
133
69
- name : Install project dependencies
134
- if : steps.restore-node-modules.outputs.cache-hit != 'true'
135
70
run : pnpm install
136
71
137
72
- name : Test
@@ -142,34 +77,3 @@ jobs:
142
77
pnpm test -- --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }} --ignoreProjects=@sanity/cli
143
78
env :
144
79
GITHUB_SHARD_IDENTIFIER : ${{ matrix.shardIndex }}-${{ matrix.shardTotal }}
145
-
146
- cleanup :
147
- timeout-minutes : 60
148
- name : Cleanup (${{ matrix.os }} / node ${{ matrix.node }})
149
- runs-on : ${{ matrix.os }}
150
- continue-on-error : ${{ matrix.experimental }}
151
- needs : [test]
152
-
153
- strategy :
154
- # we want to know if a test fails on a specific node version
155
- fail-fast : false
156
- matrix :
157
- os : [ubuntu-latest]
158
- node : [18, 20]
159
- experimental : [false]
160
-
161
- steps :
162
- - name : Checkout
163
- uses : actions/checkout@v4
164
-
165
- - name : Setup node
166
- uses : actions/setup-node@v4
167
- with :
168
- node-version : ${{ matrix.node }}
169
-
170
- # Delete the cache so it is only used once
171
- - name : Delete Cache
172
- run : gh cache delete ${{ runner.os }}-build-${{ matrix.node }}-${{ env.cache-name }}-${{ github.run_id }}
173
- env :
174
- cache-name : cache-build
175
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments