1010 required : false
1111
1212env :
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
1616
1717jobs :
1818 api-unit-tests :
@@ -39,27 +39,41 @@ jobs:
3939 api-integration-tests :
4040 runs-on : ubuntu-latest
4141 steps :
42- - uses : actions/checkout@v4
42+ - name : " Setup: checkout repository"
43+ uses : actions/checkout@v4
4344
44- - name : " Login to GitHub Container Registry"
45+ - name : " Setup: Login to GitHub Container Registry"
4546 uses : docker/login-action@v3
4647 with :
47- registry : ${{ env.IMAGE_REGISTRY }}
48+ registry : ${{ env.REGISTRY }}
4849 username : ${{ github.actor }}
4950 password : ${{ secrets.GITHUB_TOKEN }}
5051
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
5572
5673 - name : BDD Integration tests
5774 if : ${{ false }} # disable for now
5875 run : docker compose -f docker-compose.yml -f docker-compose.ci.yml run api behave
5976
60- - name : Pytest Integration tests
61- run : docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm api pytest --integration
62-
6377 web-tests :
6478 runs-on : ubuntu-latest
6579 steps :
@@ -68,14 +82,14 @@ jobs:
6882 - name : " Login to GitHub Container Registry"
6983 uses : docker/login-action@v3
7084 with :
71- registry : ${{ env.IMAGE_REGISTRY }}
85+ registry : ${{ env.REGISTRY }}
7286 username : ${{ github.actor }}
7387 password : ${{ secrets.GITHUB_TOKEN }}
7488
7589 - name : Build Web Image
7690 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
7993
8094 - name : Run Web tests
8195 if : ${{ false }} # disable for now as they do not currently work
0 commit comments