1717 TEST_TAG : user/app:test
1818
1919jobs :
20+ test :
21+ runs-on : ubuntu-latest
22+ steps :
23+ - name : Checkout repository
24+ uses : actions/checkout@v4
25+
26+ # This might be unnecessary as tests are not
27+ # multiplatform
28+ - name : Setup Docker buildx
29+ 30+
31+ # Build but not push Docker image with Buildx
32+ # https://github.com/docker/build-push-action
33+ - name : Build test image
34+ id : build-test
35+ 36+ with :
37+ context : .
38+ load : true
39+ target : dev
40+ tags : ${{ env.TEST_TAG }}
41+ cache-from : type=gha
42+ cache-to : type=gha,mode=max
43+
44+ # This is a barrier check to make sure we push a functional
45+ # docker image, we can avoid linting
46+ - name : Run tests in the test image
47+ run : |
48+ docker run --rm ${{ env.TEST_TAG }} make ci-test
49+
2050 build :
2151 runs-on : ubuntu-latest
52+ needs : test
2253 permissions :
2354 contents : read
2455 packages : write
@@ -33,15 +64,15 @@ jobs:
3364 - name : Set up QEMU
3465 uses : docker/setup-qemu-action@v3
3566
36- # Install the cosign tool except on PR
67+ # Install the cosign tool
3768 # https://github.com/sigstore/cosign-installer
3869 - name : Install cosign
39704071
4172 - name : Setup Docker buildx
42734374
44- # Login against a Docker registry except on PR
75+ # Login against a Docker registry
4576 # https://github.com/docker/login-action
4677 - name : Log into registry ${{ env.REGISTRY }}
47785081 username : ${{ github.actor }}
5182 password : ${{ secrets.GITHUB_TOKEN }}
5283
53- # Build and push Docker image with Buildx
54- # https://github.com/docker/build-push-action
55- - name : Build test image
56- id : build-test
57- 58- with :
59- context : .
60- load : true
61- target : dev
62- tags : ${{ env.TEST_TAG }}
63- cache-from : type=gha
64- cache-to : type=gha,mode=max
65-
66- - name : Test
67- run : |
68- docker run --rm ${{ env.TEST_TAG }} make ci-test
69-
7084 # Extract metadata (tags, labels) for Docker
7185 # https://github.com/docker/metadata-action
7286 - name : Extract Docker metadata
0 commit comments