Skip to content

Commit ad33b1d

Browse files
CI: use cache
1 parent e370ced commit ad33b1d

34 files changed

Lines changed: 1714 additions & 1072 deletions

.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
# This is disabled for existing workspaces to maintain compatibility
33
# For more info, see: https://nx.dev/concepts/inferred-tasks
44
NX_ADD_PLUGINS=false
5-
NX_SKIP_NX_CACHE=true

.github/actions/run-qunit-tests/action.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,61 @@ runs:
6969
- uses: actions/cache@v5
7070
name: Setup pnpm cache
7171
with:
72-
path: |
73-
${{ env.STORE_PATH }}
74-
.nx/cache
72+
path: ${{ env.STORE_PATH }}
7573
key: ${{ runner.os }}-pnpm-cache-${{ hashFiles('**/pnpm-lock.yaml') }}
7674
restore-keys: |
7775
${{ runner.os }}-pnpm-cache
7876
77+
- name: Lookup nx cache
78+
id: lookup-nx-cache
79+
uses: actions/cache/restore@v5
80+
with:
81+
path: |
82+
.nx/cache
83+
.nx/workspace-data/*.db
84+
.nx/workspace-data/*.db-wal
85+
.nx/workspace-data/*.db-shm
86+
key: ${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-${{ github.run_attempt }}
87+
restore-keys: |
88+
${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-
89+
${{ runner.os }}-nx-v2-${{ github.sha }}-
90+
${{ runner.os }}-nx-v2-
91+
92+
lookup-only: true
93+
94+
- name: Show nx cache status
95+
shell: bash
96+
run: |
97+
echo "Nx cache lookup exact hit: ${{ steps.lookup-nx-cache.outputs.cache-hit }}"
98+
echo "Nx cache primary key: ${{ steps.lookup-nx-cache.outputs.cache-primary-key }}"
99+
echo "Nx cache matched key: ${{ steps.lookup-nx-cache.outputs.cache-matched-key }}"
100+
if [ -z "${{ steps.lookup-nx-cache.outputs.cache-matched-key }}" ]; then
101+
echo "Nx cache lookup: miss"
102+
elif [ "${{ steps.lookup-nx-cache.outputs.cache-hit }}" = "true" ]; then
103+
echo "Nx cache lookup: exact hit"
104+
else
105+
echo "Nx cache lookup: partial hit via restore-keys"
106+
fi
107+
79108
- name: Install dependencies
80109
shell: bash
81110
run: pnpm install --frozen-lockfile
82111

112+
- name: Setup nx cache
113+
id: setup-nx-cache
114+
uses: actions/cache@v5
115+
with:
116+
path: |
117+
.nx/cache
118+
.nx/workspace-data/*.db
119+
.nx/workspace-data/*.db-wal
120+
.nx/workspace-data/*.db-shm
121+
key: ${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-${{ github.run_attempt }}
122+
restore-keys: |
123+
${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-
124+
${{ runner.os }}-nx-v2-${{ github.sha }}-
125+
${{ runner.os }}-nx-v2-
126+
83127
- name: Run QUnit tests
84128
working-directory: ./packages/devextreme
85129
shell: bash

.github/workflows/build_all.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
default: false
1414
type: boolean
1515

16+
concurrency:
17+
group: wf-${{github.event.pull_request.number || github.ref || github.sha}}-${{github.workflow}}
18+
cancel-in-progress: true
19+
1620
env:
1721
NX_SKIP_NX_CACHE: ${{ contains(github.event.pull_request.labels.*.name, 'skip-cache') && 'true' || 'false' }}
1822

@@ -24,6 +28,9 @@ jobs:
2428
- name: Get sources
2529
uses: actions/checkout@v6
2630

31+
- name: Pin Nx machine id
32+
uses: ./.github/actions/pin-nx-machine-id
33+
2734
- name: Use Node.js
2835
uses: actions/setup-node@v6
2936
with:
@@ -46,9 +53,55 @@ jobs:
4653
restore-keys: |
4754
${{ runner.os }}-pnpm-cache
4855
56+
- name: Lookup nx cache
57+
id: lookup-nx-cache
58+
uses: actions/cache/restore@v5
59+
with:
60+
path: |
61+
.nx/cache
62+
.nx/workspace-data/*.db
63+
.nx/workspace-data/*.db-wal
64+
.nx/workspace-data/*.db-shm
65+
key: ${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-${{ github.run_attempt }}
66+
restore-keys: |
67+
${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-
68+
${{ runner.os }}-nx-v2-${{ github.sha }}-
69+
${{ runner.os }}-nx-v2-
70+
71+
lookup-only: true
72+
73+
- name: Show nx cache status
74+
shell: bash
75+
run: |
76+
echo "Nx cache lookup exact hit: ${{ steps.lookup-nx-cache.outputs.cache-hit }}"
77+
echo "Nx cache primary key: ${{ steps.lookup-nx-cache.outputs.cache-primary-key }}"
78+
echo "Nx cache matched key: ${{ steps.lookup-nx-cache.outputs.cache-matched-key }}"
79+
if [ -z "${{ steps.lookup-nx-cache.outputs.cache-matched-key }}" ]; then
80+
echo "Nx cache lookup: miss"
81+
elif [ "${{ steps.lookup-nx-cache.outputs.cache-hit }}" = "true" ]; then
82+
echo "Nx cache lookup: exact hit"
83+
else
84+
echo "Nx cache lookup: partial hit via restore-keys"
85+
fi
86+
4987
- name: Install dependencies
5088
run: pnpm install --frozen-lockfile
5189

90+
- name: Setup nx cache
91+
id: setup-nx-cache
92+
uses: actions/cache@v5
93+
with:
94+
path: |
95+
.nx/cache
96+
.nx/workspace-data/*.db
97+
.nx/workspace-data/*.db-wal
98+
.nx/workspace-data/*.db-shm
99+
key: ${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-${{ github.run_attempt }}
100+
restore-keys: |
101+
${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-
102+
${{ runner.os }}-nx-v2-${{ github.sha }}-
103+
${{ runner.os }}-nx-v2-
104+
52105
- name: Build npm packages
53106
run: pnpm run all:build
54107

.github/workflows/default_workflow.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,55 @@ jobs:
4545
restore-keys: |
4646
${{ runner.os }}-pnpm-cache
4747
48+
- name: Lookup nx cache
49+
id: lookup-nx-cache
50+
uses: actions/cache/restore@v5
51+
with:
52+
path: |
53+
.nx/cache
54+
.nx/workspace-data/*.db
55+
.nx/workspace-data/*.db-wal
56+
.nx/workspace-data/*.db-shm
57+
key: ${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-${{ github.run_attempt }}
58+
restore-keys: |
59+
${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-
60+
${{ runner.os }}-nx-v2-${{ github.sha }}-
61+
${{ runner.os }}-nx-v2-
62+
63+
lookup-only: true
64+
65+
- name: Show nx cache status
66+
shell: bash
67+
run: |
68+
echo "Nx cache lookup exact hit: ${{ steps.lookup-nx-cache.outputs.cache-hit }}"
69+
echo "Nx cache primary key: ${{ steps.lookup-nx-cache.outputs.cache-primary-key }}"
70+
echo "Nx cache matched key: ${{ steps.lookup-nx-cache.outputs.cache-matched-key }}"
71+
if [ -z "${{ steps.lookup-nx-cache.outputs.cache-matched-key }}" ]; then
72+
echo "Nx cache lookup: miss"
73+
elif [ "${{ steps.lookup-nx-cache.outputs.cache-hit }}" = "true" ]; then
74+
echo "Nx cache lookup: exact hit"
75+
else
76+
echo "Nx cache lookup: partial hit via restore-keys"
77+
fi
78+
4879
- name: Install dependencies
4980
run: pnpm install --frozen-lockfile
5081

82+
- name: Setup nx cache
83+
id: setup-nx-cache
84+
uses: actions/cache@v5
85+
with:
86+
path: |
87+
.nx/cache
88+
.nx/workspace-data/*.db
89+
.nx/workspace-data/*.db-wal
90+
.nx/workspace-data/*.db-shm
91+
key: ${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-${{ github.run_attempt }}
92+
restore-keys: |
93+
${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-
94+
${{ runner.os }}-nx-v2-${{ github.sha }}-
95+
${{ runner.os }}-nx-v2-
96+
5197
- name: Run targets
5298
run: >
5399
pnpm exec nx run-many

.github/workflows/demos_unit_tests.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,55 @@ jobs:
5959
restore-keys: |
6060
${{ runner.os }}-pnpm-cache
6161
62+
- name: Lookup nx cache
63+
id: lookup-nx-cache
64+
uses: actions/cache/restore@v5
65+
with:
66+
path: |
67+
.nx/cache
68+
.nx/workspace-data/*.db
69+
.nx/workspace-data/*.db-wal
70+
.nx/workspace-data/*.db-shm
71+
key: ${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-${{ github.run_attempt }}
72+
restore-keys: |
73+
${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-
74+
${{ runner.os }}-nx-v2-${{ github.sha }}-
75+
${{ runner.os }}-nx-v2-
76+
77+
lookup-only: true
78+
79+
- name: Show nx cache status
80+
shell: bash
81+
run: |
82+
echo "Nx cache lookup exact hit: ${{ steps.lookup-nx-cache.outputs.cache-hit }}"
83+
echo "Nx cache primary key: ${{ steps.lookup-nx-cache.outputs.cache-primary-key }}"
84+
echo "Nx cache matched key: ${{ steps.lookup-nx-cache.outputs.cache-matched-key }}"
85+
if [ -z "${{ steps.lookup-nx-cache.outputs.cache-matched-key }}" ]; then
86+
echo "Nx cache lookup: miss"
87+
elif [ "${{ steps.lookup-nx-cache.outputs.cache-hit }}" = "true" ]; then
88+
echo "Nx cache lookup: exact hit"
89+
else
90+
echo "Nx cache lookup: partial hit via restore-keys"
91+
fi
92+
6293
- name: Install dependencies
6394
run: pnpm install --frozen-lockfile
6495

96+
- name: Setup nx cache
97+
id: setup-nx-cache
98+
uses: actions/cache@v5
99+
with:
100+
path: |
101+
.nx/cache
102+
.nx/workspace-data/*.db
103+
.nx/workspace-data/*.db-wal
104+
.nx/workspace-data/*.db-shm
105+
key: ${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-${{ github.run_attempt }}
106+
restore-keys: |
107+
${{ runner.os }}-nx-v2-${{ github.sha }}-${{ github.workflow }}-${{ github.job }}-
108+
${{ runner.os }}-nx-v2-${{ github.sha }}-
109+
${{ runner.os }}-nx-v2-
110+
65111
- name: Run unit tests
66112
working-directory: apps/demos
67113
run: pnpm exec nx test

0 commit comments

Comments
 (0)