17
17
TEST_TAG : user/app:test
18
18
19
19
jobs :
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
+
20
50
build :
21
51
runs-on : ubuntu-latest
52
+ needs : test
22
53
permissions :
23
54
contents : read
24
55
packages : write
@@ -33,15 +64,15 @@ jobs:
33
64
- name : Set up QEMU
34
65
uses : docker/setup-qemu-action@v3
35
66
36
- # Install the cosign tool except on PR
67
+ # Install the cosign tool
37
68
# https://github.com/sigstore/cosign-installer
38
69
- name : Install cosign
39
70
40
71
41
72
- name : Setup Docker buildx
42
73
43
74
44
- # Login against a Docker registry except on PR
75
+ # Login against a Docker registry
45
76
# https://github.com/docker/login-action
46
77
- name : Log into registry ${{ env.REGISTRY }}
47
78
50
81
username : ${{ github.actor }}
51
82
password : ${{ secrets.GITHUB_TOKEN }}
52
83
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
-
70
84
# Extract metadata (tags, labels) for Docker
71
85
# https://github.com/docker/metadata-action
72
86
- name : Extract Docker metadata
0 commit comments