-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (116 loc) · 3.29 KB
/
testing.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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Unit tests
on:
schedule:
- cron: "0 5 * * 0"
## This is a bit overkill... ideally we only merge into master after a PR is approved
# push:
# branches:
# - master
# paths:
# - "src/**"
# - "tests/**"
# - ".github/workflows/testing.yml"
pull_request:
types:
- review_requested
workflow_dispatch:
jobs:
unittest:
name: Unit tests
runs-on:
- self-hosted
- gpu
defaults:
run:
shell: bash -l {0}
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: false
- name: Install uv
id: setup-python
uses: astral-sh/setup-uv@v4
# with:
# enable-cache: true
- uses: actions/cache@v4
id: cache-env
with:
path: .venv
key: ${{ runner.os }}-uv-${{ steps.setup-python.outputs.uv-version }}-env-${{ hashFiles('uv.lock') }}
- name: Setup venv for testing & Install dependencies
if: steps.cache-env.outputs.cache-hit != 'true'
run: |
uv venv
uv sync --extra test
- name: Running pytest
run: uv run pytest -v --cov=yasfpy --cov-report=xml --cov-report=html --junitxml=junit.xml -o junit_family=legacy
- name: Coverage in XML
run: uv run coverage xml -i
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
coverage.xml
junit.xml
htmlcov/
retention-days: 7
codacy-coverage-reporter:
runs-on: ubuntu-latest
name: Codacy coverage reporter
needs: unittest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: false
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: coverage-report
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./coverage.xml
deepsource-coverage-reporter:
runs-on: ubuntu-latest
name: DeepSource coverage reporter
needs: unittest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: false
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: coverage-report
- name: Report test coverage to DeepSource
uses: deepsourcelabs/test-coverage-action@master
with:
key: python
coverage-file: coverage.xml
dsn: ${{ secrets.DEEPSOURCE_DSN }}
codecov-coverage-reporter:
runs-on: ubuntu-latest
name: CodeCov coverage reporter
needs: unittest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: coverage-report
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}