Skip to content

Commit 6e7b548

Browse files
authored
Update main.yml
1 parent 82ea790 commit 6e7b548

File tree

1 file changed

+41
-16
lines changed

1 file changed

+41
-16
lines changed

.github/workflows/main.yml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,67 @@ name: ci
22

33
on:
44
push:
5+
branches: [ main, develop ]
56
pull_request:
67

78
jobs:
89
test:
910
runs-on: ubuntu-24.04
11+
1012
strategy:
11-
fail-fast: false
1213
matrix:
1314
base_image: ["ubuntu:noble", "debian:bookworm"]
1415

1516
steps:
16-
- uses: actions/checkout@v4
17+
- name: Checkout code
18+
uses: actions/checkout@v4
1719

1820
- name: Cache Docker layers
1921
uses: actions/cache@v4
2022
with:
21-
path: /tmp/.buildx-cache
22-
key: ${{ runner.os }}-docker-${{ matrix.base_image }}-${{ github.sha }}
23+
path: /tmp/.docker-cache
24+
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }}
2325
restore-keys: |
24-
${{ runner.os }}-docker-${{ matrix.base_image }}-
26+
${{ runner.os }}-docker-
2527
26-
- name: Build docker image
27-
run: |
28-
docker buildx build \
29-
--cache-from type=local,src=/tmp/.buildx-cache \
30-
--cache-to type=local,dest=/tmp/.buildx-cache,mode=max \
31-
--build-arg BASE_IMAGE=${{ matrix.base_image }} \
32-
-t testcms .
28+
- name: Set up Docker buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Build and push Docker image
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
file: ./docker/Dockerfile.test
36+
push: false
37+
tags: testcms
38+
cache-from: type=local,src=/tmp/.docker-cache
39+
cache-to: type=local,dest=/tmp/.docker-cache
40+
build-args: BASE_IMAGE=${{ matrix.base_image }}
3341

3442
- name: Run tests
35-
run: docker compose -p cms -f docker/docker-compose.test.yml run --rm --attach-dependencies testcms
43+
run: |
44+
docker compose -p cms -f docker/docker-compose.test.yml run --rm testcms
45+
46+
- name: Upload test results to Codecov
47+
if: ${{ !cancelled() }}
48+
uses: codecov/test-results-action@v1
49+
with:
50+
files: ./codecov/junit.xml
51+
flags: unittests
52+
token: ${{ secrets.CODECOV_TOKEN }}
3653

37-
- name: Upload all coverage to Codecov
54+
- name: Upload unit test coverage results to Codecov
55+
uses: codecov/codecov-action@v4
3856
if: ${{ !cancelled() }}
57+
with:
58+
files: ./codecov/unittests.xml
59+
flags: unittests
60+
token: ${{ secrets.CODECOV_TOKEN }}
61+
62+
- name: Upload functional test coverage results to Codecov
3963
uses: codecov/codecov-action@v4
64+
if: ${{ !cancelled() }}
4065
with:
41-
files: ./codecov/unittests.xml,./codecov/functionaltests.xml
42-
flags: unittests,functionaltests
66+
files: ./codecov/functionaltests.xml
67+
flags: functionaltests
4368
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)