1717 with :
1818 node-version : 20
1919
20+ - name : Install Nix
21+ uses : cachix/install-nix-action@v18
22+ - name : Install direnv
23+ run : sudo apt-get update && sudo apt-get install -y direnv
24+ - name : Load environment variables
25+ run : |
26+ direnv allow .
27+ direnv export gha > "$GITHUB_ENV"
28+
2029 # Re-use node_modules between runs until package-lock.json changes.
2130 - name : Cache node_modules
2231 id : cache-node_modules
4251 run : npm ci
4352
4453 - name : Format
45- run : npm run format
54+ uses : workflow/nix-shell-action@v3.4.0
55+ with :
56+ flakes : .#devShells.x86_64-linux.default
57+ script : |
58+ elm-format src tests --validate
59+
4660 - name : Review
4761 run : npm run review
4862 - name : Test
@@ -59,11 +73,16 @@ jobs:
5973 with :
6074 node-version : 20
6175
76+ - name : Install Nix
77+ uses : cachix/install-nix-action@v18
78+ - name : Install direnv
79+ run : sudo apt-get update && sudo apt-get install -y direnv
80+
6281 - name : Checkout branch
6382 uses : actions/checkout@v4
6483 with :
6584 path : branch
66-
85+
6786 - name : Checkout main
6887 uses : actions/checkout@v4
6988 with :
92111 - name : Cache ~/.elm (both)
93112 uses : actions/cache@v4
94113 with :
95- path : ~/.elm
114+ path : ~/.elmg
96115 key : elm-${{ hashFiles('main/elm.json', 'main/review/elm.json', 'branch/elm.json', 'branch/review/elm.json') }}
97116
98117 # Install npm packages, unless we restored them from cache.
@@ -110,14 +129,32 @@ jobs:
110129 if : steps.cache-node_modules-main.outputs.cache-hit != 'true'
111130 working-directory : main
112131 run : npm ci
113-
114- - name : Generate (branch)
132+
133+ - name : Load environment variables (branch)
115134 working-directory : branch
116- run : npm run test:gen
117-
118- - name : Generate (main)
135+ run : |
136+ direnv allow .
137+ direnv export gha > "$GITHUB_ENV"
138+ - name : Generate (branch)
139+ uses : workflow/nix-shell-action@v3.4.0
140+ with :
141+ flakes : ./branch#devShells.x86_64-linux.default
142+ script : |
143+ cd branch
144+ (npm run test:gen | tee output) || (cat output && false)
145+
146+ - name : Load environment variables (main)
119147 working-directory : main
120- run : npm run test:gen || true # We don't want to block on main failing to generate
148+ run : |
149+ direnv allow .
150+ direnv export gha > "$GITHUB_ENV"
151+ - name : Generate (main)
152+ uses : workflow/nix-shell-action@v3.4.0
153+ with :
154+ flakes : ./main#devShells.x86_64-linux.default
155+ script : |
156+ cd main
157+ npm run test:gen || true # We don't want to block on main failing to generate
121158
122159 - name : Diff the outputs
123160 run : |
@@ -131,4 +168,4 @@ jobs:
131168 uses : JoseThen/comment-pr@v1.2.0
132169 with :
133170 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
134- file_path : ' ./diff.md'
171+ file_path : " ./diff.md"
0 commit comments