Skip to content

Commit b1ea371

Browse files
committed
build: use nx for cache hits
1 parent 58cc3cc commit b1ea371

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

.github/workflows/build.yml

+31
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,27 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 100
17+
18+
- uses: nrwl/nx-set-shas@v3
1519

1620
- uses: actions/setup-node@v4
1721
with:
1822
node-version: "20.x"
1923
cache: "npm"
2024
cache-dependency-path: "**/package-lock.json"
2125

26+
- name: Cache NX
27+
uses: actions/cache@v4
28+
with:
29+
path: .nx/cache
30+
key: nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
31+
restore-keys: |
32+
nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
33+
nx-${{ env.NX_BRANCH }}-
34+
nx-
35+
2236
- name: Install Dependencies
2337
run: npm ci --prefer-offline --no-audit
2438

@@ -51,12 +65,29 @@ jobs:
5165
browser: [chromium, firefox, webkit]
5266
steps:
5367
- uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 100
70+
71+
- uses: nrwl/nx-set-shas@v3
72+
5473
- uses: actions/setup-node@v4
5574
with:
5675
node-version: "20.x"
5776
cache: "npm"
5877
cache-dependency-path: "**/package-lock.json"
78+
79+
- name: Cache NX
80+
uses: actions/cache@v4
81+
with:
82+
path: .nx/cache
83+
key: nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
84+
restore-keys: |
85+
nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
86+
nx-${{ env.NX_BRANCH }}-
87+
nx-
88+
5989
- run: apt-get update && apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
90+
6091
- name: Install dependencies
6192
run: npm ci --prefer-offline --no-audit
6293

lerna.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
33
"useWorkspaces": true,
4-
"version": "0.24.2"
4+
"version": "0.24.2",
5+
"useNx": true
56
}

nx.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"tasksRunnerOptions": {
3+
"default": {
4+
"runner": "nx/tasks-runners/default",
5+
"options": {
6+
"cacheableOperations": ["build", "test"]
7+
}
8+
}
9+
},
10+
"targetDefaults": {
11+
"build": {
12+
"dependsOn": ["^build"],
13+
"outputs": ["{projectRoot}/dist"]
14+
},
15+
"test": {
16+
"dependsOn": ["^test"]
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)