Test that image layers and compose volumes are getting cached #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |