Skip to content

Commit d1e4afd

Browse files
committed
Use elm-format from nix, not from npm
1 parent 7d4724f commit d1e4afd

3 files changed

Lines changed: 47 additions & 40 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ jobs:
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
@@ -42,7 +51,12 @@ jobs:
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:
@@ -92,7 +111,7 @@ jobs:
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"

‎package-lock.json‎

Lines changed: 0 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"@redocly/cli": "1.11.0",
2525
"elm": "0.19.1-6",
2626
"elm-codegen": "^0.6.3",
27-
"elm-format": "0.8.7",
2827
"elm-optimize-level-2": "0.3.5",
2928
"elm-pages": "^3.1.1",
3029
"elm-review": "^2.13.5",

0 commit comments

Comments
 (0)