Skip to content

Commit 54929a2

Browse files
committed
Speed up API build time
1 parent 0973868 commit 54929a2

File tree

1 file changed

+48
-31
lines changed

1 file changed

+48
-31
lines changed

.github/workflows/ci-build.yml

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,21 @@ env:
2626

2727
jobs:
2828

29-
build:
29+
tests:
30+
name: Tests (${{ matrix.name }})
3031
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- name: common-unit
37+
dockerfile: docker/Base.Dockerfile
38+
image: test-common
39+
target: test-common
40+
- name: api-integration
41+
dockerfile: docker/API.Dockerfile
42+
image: api-integration-tests
43+
target: integration-test-api
3144

3245
steps:
3346
- name: Checkout
@@ -43,44 +56,48 @@ jobs:
4356
username: ${{ github.actor }}
4457
password: ${{ secrets.GITHUB_TOKEN }}
4558

46-
- name: Run Common Unit Tests
59+
- name: Run ${{ matrix.name }} tests
4760
uses: ./.github/actions/test-app
4861
with:
49-
dockerfile: docker/Base.Dockerfile
50-
image: test-common
51-
target: test-common
62+
dockerfile: ${{ matrix.dockerfile }}
63+
image: ${{ matrix.image }}
64+
target: ${{ matrix.target }}
5265

53-
- name: Run API Integration Tests
54-
uses: ./.github/actions/test-app
55-
with:
56-
dockerfile: docker/API.Dockerfile
57-
image: api-integration-tests
58-
target: integration-test-api
66+
build:
67+
name: Build (${{ matrix.image }})
68+
needs: tests
69+
runs-on: ubuntu-latest
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
include:
74+
- dockerfile: docker/API.Dockerfile
75+
image: api
76+
- dockerfile: docker/LiveControlGateway.Dockerfile
77+
image: live-control-gateway
78+
- dockerfile: docker/Cron.Dockerfile
79+
image: cron
5980

60-
- name: Build API
61-
uses: ./.github/actions/build-app
62-
with:
63-
dockerfile: docker/API.Dockerfile
64-
push: ${{ github.ref_protected && github.event_name != 'pull_request' }}
65-
image: api
66-
platforms: ${{ inputs.platforms || 'linux/amd64' }}
67-
latest: ${{ inputs.latest || false }}
68-
69-
- name: Build LiveControlGateway
70-
uses: ./.github/actions/build-app
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v5
84+
85+
- name: Set up Docker Buildx
86+
uses: docker/setup-buildx-action@v3
87+
88+
- name: Log in to Container Registry
89+
uses: docker/login-action@v3
7190
with:
72-
dockerfile: docker/LiveControlGateway.Dockerfile
73-
push: ${{ github.ref_protected && github.event_name != 'pull_request' }}
74-
image: live-control-gateway
75-
platforms: ${{ inputs.platforms || 'linux/amd64' }}
76-
latest: ${{ inputs.latest || false }}
77-
78-
- name: Build Cron
91+
registry: ${{ env.REGISTRY }}
92+
username: ${{ github.actor }}
93+
password: ${{ secrets.GITHUB_TOKEN }}
94+
95+
- name: Build ${{ matrix.image }}
7996
uses: ./.github/actions/build-app
8097
with:
81-
dockerfile: docker/Cron.Dockerfile
98+
dockerfile: ${{ matrix.dockerfile }}
8299
push: ${{ github.ref_protected && github.event_name != 'pull_request' }}
83-
image: cron
100+
image: ${{ matrix.image }}
84101
platforms: ${{ inputs.platforms || 'linux/amd64' }}
85102
latest: ${{ inputs.latest || false }}
86103

0 commit comments

Comments
 (0)