-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (46 loc) · 1.46 KB
/
ci.yml
File metadata and controls
49 lines (46 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: CI
on:
push:
pull_request:
branches: [main]
jobs:
setup-and-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-compose-action@v1
- uses: ./
with:
volumes: |
node_modules: ${{ hashFiles('package-lock.json') }}
- run: bin/setup
test:
needs: setup-and-cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-compose-action@v1
- uses: ./
with:
volumes: |
node_modules: ${{ hashFiles('package-lock.json') }}
- name: Verify caches are used
run: |
output=$(bin/setup 2>&1)
# Check that all build steps (except FROM) have a CACHED line
for step in $(echo "$output" | grep -E '^#[0-9]+ \[[0-9]+/[0-9]+\]' | grep -v FROM | grep -oE '^#[0-9]+'); do
if ! echo "$output" | grep -q "^${step} CACHED"; then
echo "::error::Step $step was rebuilt instead of using cache"
echo "$output"
exit 1
fi
done
echo "All build steps used cache."
if echo "$output" | grep -q "added"; then
echo "::error::Packages were downloaded instead of using cached node_modules"
echo "$output"
exit 1
fi
echo "node_modules cache was used."