10
10
required : false
11
11
12
12
env :
13
- IMAGE_REGISTRY : ghcr.io
14
- API_IMAGE : ghcr.io/equinor/template-fastapi-react /api
15
- WEB_IMAGE : ghcr.io/equinor/template-fastapi-react /web
13
+ REGISTRY : ghcr.io
14
+ API_IMAGE_PATH : ${{ github.repository }} /api
15
+ WEB_IMAGE_PATH : ${{ github.repository }} /web
16
16
17
17
jobs :
18
18
api-unit-tests :
@@ -39,27 +39,41 @@ jobs:
39
39
api-integration-tests :
40
40
runs-on : ubuntu-latest
41
41
steps :
42
- - uses : actions/checkout@v4
42
+ - name : " Setup: checkout repository"
43
+ uses : actions/checkout@v4
43
44
44
- - name : " Login to GitHub Container Registry"
45
+ - name : " Setup: Login to GitHub Container Registry"
45
46
uses : docker/login-action@v3
46
47
with :
47
- registry : ${{ env.IMAGE_REGISTRY }}
48
+ registry : ${{ env.REGISTRY }}
48
49
username : ${{ github.actor }}
49
50
password : ${{ secrets.GITHUB_TOKEN }}
50
51
51
- - name : Build API image
52
- run : |
53
- docker pull $API_IMAGE
54
- docker build --target development --tag api-development ./api # TODO: --cache-from $API_IMAGE
52
+ - name : " Setup: Docker Buildx"
53
+ uses : docker/setup-buildx-action@v3
54
+
55
+ - name : " Setup: Build API image"
56
+ uses : docker/build-push-action@v6
57
+ with :
58
+ context : ./api
59
+ target : development
60
+ tags : |
61
+ ${{ env.REGISTRY }}/${{ env.API_IMAGE_PATH }}:latest
62
+ api-development
63
+ cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.API_IMAGE_PATH }}:latest
64
+
65
+ # - name: Build API image
66
+ # run: |
67
+ # docker pull $API_IMAGE
68
+ # docker build --target development --tag api-development ./api # TODO: --cache-from $API_IMAGE
69
+
70
+ - name : Pytest Integration tests
71
+ run : docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm api python -m pytest --integration
55
72
56
73
- name : BDD Integration tests
57
74
if : ${{ false }} # disable for now
58
75
run : docker compose -f docker-compose.yml -f docker-compose.ci.yml run api behave
59
76
60
- - name : Pytest Integration tests
61
- run : docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm api pytest --integration
62
-
63
77
web-tests :
64
78
runs-on : ubuntu-latest
65
79
steps :
@@ -68,14 +82,14 @@ jobs:
68
82
- name : " Login to GitHub Container Registry"
69
83
uses : docker/login-action@v3
70
84
with :
71
- registry : ${{ env.IMAGE_REGISTRY }}
85
+ registry : ${{ env.REGISTRY }}
72
86
username : ${{ github.actor }}
73
87
password : ${{ secrets.GITHUB_TOKEN }}
74
88
75
89
- name : Build Web Image
76
90
run : |
77
- docker pull $WEB_IMAGE
78
- docker build --cache-from $WEB_IMAGE --target development --tag web-dev ./web
91
+ docker pull ${REGISTRY}/${WEB_IMAGE_PATH}
92
+ docker build --cache-from ${REGISTRY}/${WEB_IMAGE_PATH} --target development --tag web-dev ./web
79
93
80
94
- name : Run Web tests
81
95
if : ${{ false }} # disable for now as they do not currently work
0 commit comments