Skip to content

Commit 2d8d205

Browse files
authored
chore: gnu tar for unzipping cache files on windows (#5414)
1 parent f2a26c2 commit 2d8d205

File tree

1 file changed

+51
-40
lines changed

1 file changed

+51
-40
lines changed

.github/workflows/pull-request.yml

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ jobs:
1515
with:
1616
fetch-depth: 2
1717

18+
- name: Restore Cache
19+
uses: actions/cache/restore@v3
20+
with:
21+
path: |
22+
~/.npm
23+
.next/cache
24+
node_modules/.cache
25+
key: cache-${{ hashFiles('package-lock.json') }}-
26+
restore-keys: cache-
27+
1828
- name: Set up Node.js
1929
uses: actions/setup-node@v3
2030
with:
2131
node-version-file: '.nvmrc'
22-
cache: npm
32+
cache: 'npm'
2333

2434
- name: Install NPM packages
2535
run: npm ci
2636

27-
- name: Restore Cache
28-
uses: actions/cache/restore@v3
29-
with:
30-
path: |
31-
node_modules/.cache
32-
key: tests-${{ hashFiles('**/package-lock.json') }}-
33-
restore-keys: |
34-
tests-${{ hashFiles('**/package-lock.json') }}-
35-
enableCrossOsArchive: true
36-
3737
- name: Run Linting
3838
run: npx turbo lint
3939
env:
@@ -45,9 +45,10 @@ jobs:
4545
uses: actions/cache/save@v3
4646
with:
4747
path: |
48+
~/.npm
49+
.next/cache
4850
node_modules/.cache
49-
key: tests-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
50-
enableCrossOsArchive: true
51+
key: cache-${{ hashFiles('package-lock.json') }}
5152

5253
unit-tests:
5354
name: Tests on ${{ matrix.os }}
@@ -59,30 +60,35 @@ jobs:
5960
os: [ubuntu-latest, windows-latest]
6061

6162
steps:
63+
- name: "Use GNU tar instead BSD tar"
64+
if: matrix.os == 'windows-latest'
65+
shell: cmd
66+
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
67+
6268
- name: Git Checkout
6369
uses: actions/checkout@v3
6470
with:
6571
fetch-depth: 2
6672

73+
- name: Restore Cache
74+
uses: actions/cache/restore@v3
75+
with:
76+
path: |
77+
~/.npm
78+
.next/cache
79+
node_modules/.cache
80+
key: cache-${{ hashFiles('package-lock.json') }}-
81+
restore-keys: cache-
82+
6783
- name: Set up Node.js
6884
uses: actions/setup-node@v3
6985
with:
7086
node-version-file: '.nvmrc'
71-
cache: npm
87+
cache: 'npm'
7288

7389
- name: Install NPM packages
7490
run: npm ci
7591

76-
- name: Restore Cache
77-
uses: actions/cache/restore@v3
78-
with:
79-
path: |
80-
node_modules/.cache
81-
key: tests-${{ hashFiles('**/package-lock.json') }}-
82-
restore-keys: |
83-
tests-${{ hashFiles('**/package-lock.json') }}-
84-
enableCrossOsArchive: true
85-
8692
- name: Run Unit Tests
8793
run: npx turbo test:unit -- --coverage
8894
env:
@@ -101,9 +107,10 @@ jobs:
101107
uses: actions/cache/save@v3
102108
with:
103109
path: |
110+
~/.npm
111+
.next/cache
104112
node_modules/.cache
105-
key: tests-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
106-
enableCrossOsArchive: true
113+
key: cache-${{ hashFiles('package-lock.json') }}
107114

108115
build:
109116
name: Build on ${{ matrix.os }}
@@ -115,31 +122,35 @@ jobs:
115122
os: [ubuntu-latest, windows-latest]
116123

117124
steps:
125+
- name: "Use GNU tar instead BSD tar"
126+
if: matrix.os == 'windows-latest'
127+
shell: cmd
128+
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
129+
118130
- name: Git Checkout
119131
uses: actions/checkout@v3
120132
with:
121133
fetch-depth: 2
122134

135+
- name: Restore Cache
136+
uses: actions/cache/restore@v3
137+
with:
138+
path: |
139+
~/.npm
140+
.next/cache
141+
node_modules/.cache
142+
key: cache-${{ hashFiles('package-lock.json') }}-
143+
restore-keys: cache-
144+
123145
- name: Set up Node.js
124146
uses: actions/setup-node@v3
125147
with:
126148
node-version-file: '.nvmrc'
127-
cache: npm
149+
cache: 'npm'
128150

129151
- name: Install NPM packages
130152
run: npm ci
131153

132-
- name: Restore Cache
133-
uses: actions/cache/restore@v3
134-
with:
135-
path: |
136-
.next/cache
137-
node_modules/.cache
138-
key: build-${{ hashFiles('**/package-lock.json') }}-
139-
restore-keys: |
140-
build-${{ hashFiles('**/package-lock.json') }}-
141-
enableCrossOsArchive: true
142-
143154
- name: Build Next.js
144155
run: npx turbo build
145156
env:
@@ -152,7 +163,7 @@ jobs:
152163
uses: actions/cache/save@v3
153164
with:
154165
path: |
166+
~/.npm
155167
.next/cache
156168
node_modules/.cache
157-
key: build-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('node_modules/.cache') }}
158-
enableCrossOsArchive: true
169+
key: cache-${{ hashFiles('package-lock.json') }}

0 commit comments

Comments
 (0)