Skip to content

Test that image layers and compose volumes are getting cached #7

Test that image layers and compose volumes are getting cached

Test that image layers and compose volumes are getting cached #7

Workflow file for this run

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)
echo "$output"
if echo "$output" | grep -q "exporting to docker image format"; then
echo "::error::Image was rebuilt instead of using cache"
exit 1
fi
if echo "$output" | grep -q "added"; then
echo "::error::Packages were downloaded instead of using cached node_modules"
exit 1
fi