Repository navigation
121 lines (105 loc) · 3.6 KB
/
Copy pathcodecov.yml
File metadata and controls
121 lines (105 loc) · 3.6 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: codecov.yml
permissions:
contents: read
actions: read # Required for setup-python and other actions to read action metadata
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
UV_VERSION: "0.13.0"
UV_PROJECT_ENVIRONMENT: venv
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
paths:
- 'openseries/**'
- 'tests/**'
- 'pyproject.toml'
- 'uv.lock'
- '.python-version'
- '.github/workflows/codecov.yml'
- 'Makefile'
- 'make.ps1'
- '.pre-commit-config.yaml'
- 'scripts/ci-pr-paths.sh'
workflow_dispatch: {}
jobs:
upload_coverage:
name: Upload coverage
runs-on: ubuntu-latest
environment: codecov
defaults:
run:
shell: bash
permissions:
contents: read
actions: read # Required for setup-python and other actions to read action metadata
issues: write # Required for actions/github-script to create issues on test failure
steps:
- name: Require master branch
env:
REF: ${{ github.ref }}
run: |
if [ "$REF" != "refs/heads/master" ]; then
echo "::error::Codecov reporting is limited to the master branch."
exit 1
fi
- name: Check out GitHub repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
ref: ${{ github.event_name == 'workflow_dispatch' && github.ref || github.sha }}
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: '.python-version'
- name: Set up uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
with:
version: ${{ env.UV_VERSION }}
- name: Sync dependencies (locked)
run: uv sync --locked --extra dev
- name: Tests with Pytest
id: pytest
continue-on-error: true
run: uv run pytest
env:
PYTHONPATH: ${{ github.workspace }}
- name: Create GitHub issue on failure
if: ${{ steps.pytest.outcome == 'failure' }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
GH_OWNER: ${{ github.repository_owner }}
GH_REPO: ${{ github.event.repository.name }}
GH_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
script: |
const owner = process.env.GH_OWNER;
const repo = process.env.GH_REPO;
const runUrl = process.env.GH_RUN_URL;
await github.rest.issues.create({
owner,
repo,
title: `Tests failed on ${new Date().toDateString()}`,
body: `See the full logs here: ${runUrl}`,
});
- name: Fail job if tests failed
if: ${{ steps.pytest.outcome == 'failure' }}
run: exit 1
- name: Upload test results to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: junit.xml
report_type: test_results
verbose: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: CaptorAB/openseries
files: coverage.xml
verbose: true