Skip to content

Commit

Permalink
build API only once
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddewie committed Nov 2, 2024
1 parent 5bd4640 commit 24a65ac
Showing 1 changed file with 44 additions and 5 deletions.
49 changes: 44 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
docker commit "$DB_CONTAINER_ID" ghcr.io/hiddewie/openrailwaymap-import-db:${{ github.sha }}
docker push ghcr.io/hiddewie/openrailwaymap-import-db:${{ github.sha }}
test-api:
name: Test API
build-api:
name: Build API
runs-on: ubuntu-latest

needs:
Expand Down Expand Up @@ -103,9 +103,43 @@ jobs:
run: |
docker compose up --no-build --wait db
- name: Prepare and start API
- name: Prepare API
run: |
api/prepare-api.sh
- name: Push API image
run: |
docker tag ghcr.io/hiddewie/openrailwaymap-api:latest ghcr.io/hiddewie/openrailwaymap-api:${{ github.sha }}
docker push ghcr.io/hiddewie/openrailwaymap-api:${{ github.sha }}
test-api:
name: Test API
runs-on: ubuntu-latest

needs:
- build-api

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Install Hurl
env:
VERSION: '5.0.1'
run: |
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/$VERSION/hurl_${VERSION}_amd64.deb
sudo apt update && sudo apt install ./hurl_${VERSION}_amd64.deb
- name: Pull API
run: |
docker pull ghcr.io/hiddewie/openrailwaymap-api:${{ github.sha }}
docker tag ghcr.io/hiddewie/openrailwaymap-api:${{ github.sha }} ghcr.io/hiddewie/openrailwaymap-api:latest
- name: Start API
run: |
docker compose up --wait --no-build api
- name: Run API tests
Expand Down Expand Up @@ -217,6 +251,7 @@ jobs:
needs:
- test-proxy
- test-api
- build-api
- test-tiles

steps:
Expand All @@ -231,6 +266,11 @@ jobs:
docker pull ghcr.io/hiddewie/openrailwaymap-import-db:${{ github.sha }}
docker tag ghcr.io/hiddewie/openrailwaymap-import-db:${{ github.sha }} ghcr.io/hiddewie/openrailwaymap-import-db:latest
- name: Pull API
run: |
docker pull ghcr.io/hiddewie/openrailwaymap-api:${{ github.sha }}
docker tag ghcr.io/hiddewie/openrailwaymap-api:${{ github.sha }} ghcr.io/hiddewie/openrailwaymap-api:latest
- name: Start database
run: |
docker compose up --no-build --wait db
Expand All @@ -245,9 +285,8 @@ jobs:
docker compose build martin-proxy
docker compose up --no-build --wait martin-proxy
- name: Prepare and start API
- name: Start API
run: |
api/prepare-api.sh
docker compose up --wait --no-build api
- name: Run UI tests
Expand Down

0 comments on commit 24a65ac

Please sign in to comment.