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,30 @@ 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+ echo "$output"
36+ # Check that all build steps (except FROM) have a CACHED line
37+ for step in $(echo "$output" | grep -oE '^#[0-9]+ \[[0-9]+/[0-9]+\]' | grep -v FROM | grep -oE '^#[0-9]+'); do
38+ if ! echo "$output" | grep -q "^${step} CACHED"; then
39+ echo "::error::Step $step was rebuilt instead of using cache"
40+ exit 1
41+ fi
42+ done
43+ if echo "$output" | grep -q "added"; then
44+ echo "::error::Packages were downloaded instead of using cached node_modules"
2645 exit 1
2746 fi
You can’t perform that action at this time.
0 commit comments