Repository navigation
57 lines (54 loc) · 1.75 KB
/
Copy pathtest_python_scripts.yml
File metadata and controls
57 lines (54 loc) · 1.75 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
name: Test Python scripts
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
# A new commit on the same branch cancels the run still in progress. The event
# name keeps manually dispatched runs out of that group.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
jobs:
test_python_scripts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install dependencies
run: pip install pytest pytest-cov
- name: Run tests
id: test
run: python -m pytest scripts/*.py --cov=scripts --cov-report=xml --junitxml=junit.xml
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v7
with:
fail_ci_if_error: true
files: junit.xml
report_type: test_results
flags: python_scripts
name: python-scripts
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload junit.xml
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: python_scripts_junit
path: junit.xml
if-no-files-found: warn
retention-days: 10
- name: Upload coverage reports to Codecov
if: ${{ !cancelled() && steps.test.outcome == 'success' }}
uses: codecov/codecov-action@v7
with:
fail_ci_if_error: true
files: coverage.xml
flags: python_scripts
name: python-scripts
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}