-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (49 loc) · 1.44 KB
/
run-pytest.yml
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
name: Python application test with pytest
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
AIRFLOW_HOME: /home/runner/work/bi-dags/bi-dags
REGISTRY: registry.cern.ch
IMAGE: cern-sis/bi-dags
jobs:
build_test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python 3
uses: actions/setup-python@v4
with:
python-version: 3.10.11
- name: Build Image
id: build
uses: cern-sis/gh-workflows/.github/actions/docker-build@v6
with:
registry: ${{ env.REGISTRY }}
image: ${{ env.IMAGE }}
tags: type=ref,event=pr
cache: false
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
- name: Run tests with pytest and generate report
run: >
docker run
--name biproject
--network=host
-v "$(pwd)"/tests:/opt/airflow/tests
-v "$(pwd)"/data:/opt/airflow/data
--entrypoint pytest
$REGISTRY/$IMAGE@${{ steps.build.outputs.image-digest }}
tests
--cov=./
--cov-report=xml
- name: Copy test coverage file to host machine
run: docker cp biproject:/opt/airflow/coverage.xml .
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v3
with:
verbose: true