File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 branches : [main]
77
88jobs :
9- verify-dist :
9+ setup-and-cache :
1010 runs-on : ubuntu-latest
1111 steps :
1212 - uses : actions/checkout@v4
@@ -17,11 +17,33 @@ jobs:
1717 volumes : |
1818 node_modules: ${{ hashFiles('package-lock.json') }}
1919 - run : bin/setup
20- - run : bin/npm run build
21- - name : Check for uncommitted changes
20+
21+ test :
22+ needs : setup-and-cache
23+ runs-on : ubuntu-latest
24+ steps :
25+ - uses : actions/checkout@v4
26+ - uses : docker/setup-buildx-action@v3
27+ - uses : docker/setup-compose-action@v1
28+ - uses : ./
29+ with :
30+ volumes : |
31+ node_modules: ${{ hashFiles('package-lock.json') }}
32+ - name : Verify caches are used
2233 run : |
23- if [ -n "$(git status --porcelain dist/)" ]; then
24- echo "::error::dist/ is out of date. Run 'npm run build' and commit the changes."
25- git diff dist/
34+ output=$(bin/setup 2>&1)
35+ # Check that all build steps (except FROM) have a CACHED line
36+ for step in $(echo "$output" | grep -E '^#[0-9]+ \[[0-9]+/[0-9]+\]' | grep -v FROM | grep -oE '^#[0-9]+'); do
37+ if ! echo "$output" | grep -q "^${step} CACHED"; then
38+ echo "::error::Step $step was rebuilt instead of using cache"
39+ echo "$output"
40+ exit 1
41+ fi
42+ done
43+ echo "All build steps used cache."
44+ if echo "$output" | grep -q "added"; then
45+ echo "::error::Packages were downloaded instead of using cached node_modules"
46+ echo "$output"
2647 exit 1
2748 fi
49+ echo "node_modules cache was used."
You can’t perform that action at this time.
0 commit comments