-
Notifications
You must be signed in to change notification settings - Fork 37
98 lines (85 loc) · 3.12 KB
/
pull_request.yml
File metadata and controls
98 lines (85 loc) · 3.12 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Continuous Integration
on: [pull_request, workflow_dispatch]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: ubuntu-latest
env:
COVERAGE_FILE: coverage.xml
COVERAGE_DIR: .coverage-reports
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pytest pytest-cov coverage
- name: Prepare coverage directory
run: |
mkdir -p ${{ env.COVERAGE_DIR }}
- name: Run unit tests
id: unit_tests
continue-on-error: true
env:
CONDUCTOR_AUTH_KEY: ${{ secrets.CONDUCTOR_AUTH_KEY }}
CONDUCTOR_AUTH_SECRET: ${{ secrets.CONDUCTOR_AUTH_SECRET }}
CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }}
COVERAGE_FILE: ${{ env.COVERAGE_DIR }}/.coverage.unit
run: |
coverage run -m pytest tests/unit -v
- name: Run backward compatibility tests
id: bc_tests
continue-on-error: true
env:
CONDUCTOR_AUTH_KEY: ${{ secrets.CONDUCTOR_AUTH_KEY }}
CONDUCTOR_AUTH_SECRET: ${{ secrets.CONDUCTOR_AUTH_SECRET }}
CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }}
COVERAGE_FILE: ${{ env.COVERAGE_DIR }}/.coverage.bc
run: |
coverage run -m pytest tests/backwardcompatibility -v
- name: Run serdeser tests
id: serdeser_tests
continue-on-error: true
env:
CONDUCTOR_AUTH_KEY: ${{ secrets.CONDUCTOR_AUTH_KEY }}
CONDUCTOR_AUTH_SECRET: ${{ secrets.CONDUCTOR_AUTH_SECRET }}
CONDUCTOR_SERVER_URL: ${{ secrets.CONDUCTOR_SERVER_URL }}
COVERAGE_FILE: ${{ env.COVERAGE_DIR }}/.coverage.serdeser
run: |
coverage run -m pytest tests/serdesertest -v
- name: Generate coverage report
id: coverage_report
continue-on-error: true
run: |
coverage combine ${{ env.COVERAGE_DIR }}/.coverage.*
coverage report
coverage xml
- name: Verify coverage file
id: verify_coverage
if: always()
continue-on-error: true
run: |
if [ ! -s "${{ env.COVERAGE_FILE }}" ]; then
echo "Coverage file is empty or does not exist"
ls -la ${{ env.COVERAGE_FILE }} ${{ env.COVERAGE_DIR }}
exit 1
fi
echo "Coverage file exists and is not empty"
- name: Upload coverage to Codecov
if: always() && steps.verify_coverage.outcome == 'success'
continue-on-error: true
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ env.COVERAGE_FILE }}
- name: Check test results
if: steps.unit_tests.outcome == 'failure' || steps.bc_tests.outcome == 'failure' || steps.serdeser_tests.outcome == 'failure'
run: exit 1