Skip to content

Commit 2c0083f

Browse files
committed
ci: test
1 parent 2694d11 commit 2c0083f

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed

.github/workflows/tests.yaml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ on:
1111

1212
env:
1313
REGISTRY: ghcr.io
14-
API_IMAGE_PATH: ${{ github.repository }}/api
15-
WEB_IMAGE_PATH: ${{ github.repository }}/web
14+
API_IMAGE_NAME: api
1615

1716
jobs:
1817
api-unit-tests:
@@ -42,6 +41,9 @@ jobs:
4241
- name: "Setup: checkout repository"
4342
uses: actions/checkout@v4
4443

44+
- name: "Setup: Set image name"
45+
run: echo "API_IMAGE=${{ env.REGISTRY }}/${{ github.repository }}/${{ env.API_IMAGE_NAME }}" >> "$GITHUB_ENV"
46+
4547
- name: "Setup: Login to GitHub Container Registry"
4648
uses: docker/login-action@v3
4749
with:
@@ -51,20 +53,16 @@ jobs:
5153

5254
# - name: "Setup: Docker Buildx"
5355
# 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-
# load: true
61-
# tags: ${{ env.REGISTRY }}/${{ env.API_IMAGE_PATH }}:buildcache
62-
# cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.API_IMAGE_PATH }}:buildcache
6356

64-
# - name: Build API image
65-
# run: |
66-
# docker pull $API_IMAGE
67-
# docker build --target development --tag api-development ./api # TODO: --cache-from $API_IMAGE
57+
- name: "Setup: Build API image"
58+
uses: docker/build-push-action@v6
59+
with:
60+
context: ./api
61+
target: development
62+
load: true
63+
tags: ${{ env.API_IMAGE }}:dev
64+
cache-from: type=registry,ref=${{ env.API_IMAGE }}:dev
65+
# cache-to: type=registry,ref=${{ env.API_IMAGE }}:dev,mode=max
6866

6967
- name: Pytest Integration tests
7068
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm api python -m pytest --integration
@@ -75,23 +73,27 @@ jobs:
7573

7674
web-tests:
7775
runs-on: ubuntu-latest
76+
if: ${{ false }} # disable for now as they do not currently work
7877
steps:
79-
- uses: actions/checkout@v4
78+
- name: "Setup: checkout repository"
79+
uses: actions/checkout@v4
8080

81-
- name: "Login to GitHub Container Registry"
82-
uses: docker/login-action@v3
83-
with:
84-
registry: ${{ env.REGISTRY }}
85-
username: ${{ github.actor }}
86-
password: ${{ secrets.GITHUB_TOKEN }}
81+
# - name: "Login to GitHub Container Registry"
82+
# uses: docker/login-action@v3
83+
# with:
84+
# registry: ${{ env.REGISTRY }}
85+
# username: ${{ github.actor }}
86+
# password: ${{ secrets.GITHUB_TOKEN }}
8787

88-
- name: Build Web Image
89-
run: |
90-
docker pull ${REGISTRY}/${WEB_IMAGE_PATH}
91-
docker build --cache-from ${REGISTRY}/${WEB_IMAGE_PATH} --target development --tag web-dev ./web
88+
- name: "Setup: Build web image"
89+
uses: docker/build-push-action@v6
90+
with:
91+
context: ./web
92+
target: development
93+
load: true
94+
tags: web:dev
9295

9396
- name: Run Web tests
94-
if: ${{ false }} # disable for now as they do not currently work
9597
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm web yarn test
9698

9799
docs-tests:

docker-compose.ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
services:
22
api:
3-
image: ghcr.io/equinor/template-fastapi-react/api:latest
4-
# image: api-development
3+
image: ghcr.io/equinor/template-fastapi-react/api:dev
54
build:
65
target: development
76
environment:
@@ -13,11 +12,14 @@ services:
1312
MONGODB_PORT: 27017
1413
SECRET_KEY: sg9aeUM5i1JO4gNN8fQadokJa3_gXQMLBjSGGYcfscs=
1514
AUTH_ENABLED: "False"
16-
depends_on:
17-
- db
1815
links:
1916
- db
2017

18+
nginx:
19+
image: web:dev
20+
build:
21+
target: development
22+
2123
db:
2224
environment:
2325
MONGO_INITDB_ROOT_USERNAME: root

0 commit comments

Comments
 (0)