Skip to content

Commit a8b469a

Browse files
committed
Use tools from nix devShell in CI
1 parent 1a63738 commit a8b469a

File tree

1 file changed

+43
-25
lines changed

1 file changed

+43
-25
lines changed

.github/workflows/ci.yaml

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15-
- name: Use Node.js 20
16-
uses: actions/setup-node@v4
17-
with:
18-
node-version: 20
15+
16+
- uses: DeterminateSystems/determinate-nix-action@v3
1917

2018
# Re-use node_modules between runs until package-lock.json changes.
2119
- name: Cache node_modules
@@ -26,43 +24,48 @@ jobs:
2624
key: node_modules-${{ hashFiles('package-lock.json') }}
2725

2826
# Re-use ~/.elm between runs until elm.json or review/elm.json changes.
29-
# The Elm compiler saves downloaded Elm packages to ~/.elm saves
30-
# downloaded tool executables there.
27+
# The Elm compiler saves downloaded Elm packages to ~/.elm
3128
- name: Cache ~/.elm
3229
uses: actions/cache@v4
3330
with:
3431
path: ~/.elm
35-
key: elm-${{ hashFiles('elm.json', 'review/elm.json') }}
32+
key: |
33+
elm-${{ hashFiles(
34+
'elm.json',
35+
'review/elm.json',
36+
'elm-open-api-codegen/elm.json',
37+
'elm-open-api-codegen/review/elm.json'
38+
)}}
39+
3640
3741
# Install npm packages, unless we restored them from cache.
3842
# Since `npm ci` removes the node_modules folder before running it’s
3943
# important to skip this step if cache was restored.
4044
- name: npm ci
4145
if: steps.cache-node_modules.outputs.cache-hit != 'true'
42-
run: npm ci
46+
run: nix develop --command npm ci
4347

4448
# TEMPORARY UNTIL elm-open-api-codegen IS PUBLISHED
4549
- name: TEMP HACK
46-
run: npm run link-local-package
50+
run: nix develop --command npm run link-local-package
4751

4852
- name: Format
49-
run: npm run format
53+
run: nix develop --command npm run format
5054
- name: Review
51-
run: npm run review
55+
run: nix develop --command npm run review
5256
- name: Test
53-
run: npm run test
57+
run: nix develop --command npm run test
58+
59+
# TEMPORARY UNTIL elm-open-api-codegen IS PUBLISHED
60+
- name: TEMP HACK
61+
run: nix develop --command npm run unlink-local-package
5462

5563
diff-generation:
5664
permissions:
5765
checks: write
5866
pull-requests: write
5967
runs-on: ubuntu-latest
6068
steps:
61-
- name: Use Node.js 20
62-
uses: actions/setup-node@v4
63-
with:
64-
node-version: 20
65-
6669
- name: Checkout branch
6770
uses: actions/checkout@v4
6871
with:
@@ -74,6 +77,8 @@ jobs:
7477
ref: main
7578
path: main
7679

80+
- uses: DeterminateSystems/determinate-nix-action@v3
81+
7782
# Re-use node_modules between runs until package-lock.json changes.
7883
- name: Cache node_modules (branch)
7984
id: cache-node_modules-branch
@@ -91,41 +96,54 @@ jobs:
9196
key: node_modules-${{ hashFiles('main/package-lock.json') }}
9297

9398
# Re-use ~/.elm between runs until elm.json or review/elm.json changes.
94-
# The Elm compiler saves downloaded Elm packages to ~/.elm saves
95-
# downloaded tool executables there.
99+
# The Elm compiler saves downloaded Elm packages to ~/.elm.
96100
- name: Cache ~/.elm (both)
97101
uses: actions/cache@v4
98102
with:
99103
path: ~/.elm
100-
key: elm-${{ hashFiles('main/elm.json', 'main/review/elm.json', 'branch/elm.json', 'branch/review/elm.json') }}
104+
key: |
105+
elm-${{ hashFiles(
106+
'main/elm.json',
107+
'main/review/elm.json',
108+
'main/elm-open-api-codegen/elm.json',
109+
'main/elm-open-api-codegen/review/elm.json',
110+
'branch/elm.json',
111+
'branch/review/elm.json',
112+
'branch/elm-open-api-codegen/elm.json',
113+
'branch/elm-open-api-codegen/review/elm.json'
114+
)}}
101115
102116
# Install npm packages, unless we restored them from cache.
103117
# Since `npm ci` removes the node_modules folder before running it’s
104118
# important to skip this step if cache was restored.
105119
- name: npm ci (branch)
106120
if: steps.cache-node_modules-branch.outputs.cache-hit != 'true'
107121
working-directory: branch
108-
run: npm ci
122+
run: nix develop --command npm ci
109123

110124
# Install npm packages, unless we restored them from cache.
111125
# Since `npm ci` removes the node_modules folder before running it’s
112126
# important to skip this step if cache was restored.
113127
- name: npm ci (main)
114128
if: steps.cache-node_modules-main.outputs.cache-hit != 'true'
115129
working-directory: main
116-
run: npm ci
130+
run: nix develop --command npm ci
117131

118132
# TEMPORARY UNTIL elm-open-api-codegen IS PUBLISHED
119133
- name: TEMP HACK
120-
run: npm run link-local-package
134+
run: nix develop --command npm run link-local-package
121135

122136
- name: Generate (branch)
123137
working-directory: branch
124-
run: npm run test:gen
138+
run: nix develop --command npm run test:gen
125139

126140
- name: Generate (main)
127141
working-directory: main
128-
run: npm run test:gen || true # We don't want to block on main failing to generate
142+
run: nix develop --command npm run test:gen || true # We don't want to block on main failing to generate
143+
144+
# TEMPORARY UNTIL elm-open-api-codegen IS PUBLISHED
145+
- name: TEMP HACK
146+
run: nix develop --command npm run unlink-local-package
129147

130148
- name: Diff the outputs
131149
run: |

0 commit comments

Comments
 (0)