-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (81 loc) · 2.18 KB
/
ci.yml
File metadata and controls
81 lines (81 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: CI
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-test-images:
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: write
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build service TEST image
env:
DOCKER_BUILDKIT: 1
run: |
docker build \
-f service/Dockerfile.test \
-t local/service-test:ci \
service
- name: Save images for downstream jobs
run: |
docker save local/service-test:ci | gzip > service-test.tar.gz
- uses: actions/upload-artifact@v4
with:
name: test-images
path: service-test.tar.gz
service-tests:
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: write
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
needs: build-test-images
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: test-images
- name: Load images
run: |
gunzip -c service-test.tar.gz | docker load
- name: Prepare report dir on host (mounted into /reports)
run: mkdir -p service/reports/ci
- name: Run service tests
run: |
docker compose -f docker-compose.test.yml run --rm --entrypoint /bin/sh service_test -lc '
python -m coverage run -m pytest
'
- name: Upload coverage xml
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: service/reports/ci/coverage.xml
if-no-files-found: error
- name: Cleanup
env:
DOCKER_BUILDKIT: 1
HOST_UID: "1000"
HOST_GID: "1000"
DISPLAY: ":1"
HOST_USERNAME: user
HOST_GROUPNAME: group
if: always()
run: |
docker compose down -v --remove-orphans