-
Notifications
You must be signed in to change notification settings - Fork 157
134 lines (115 loc) · 4.74 KB
/
Copy pathtest.yml
File metadata and controls
134 lines (115 loc) · 4.74 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
122
123
124
125
126
127
128
129
130
131
132
133
134
---
# yamllint disable rule:truthy
name: Python Test
on: [push, pull_request]
permissions:
contents: read
# Cancel ongoing builds on new changes
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Run poe tasks
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
task: [gh-test]
# The include map here is actually used to extend the matrix.
# By passing all keys used in the matrix we append new unique combinations
# that do not run across the whole matrix but only once. These poe tasks
# are defined in pyproject.toml.
# For more information see:
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-adding-configurations
include:
# Run linter/type checks only on 1 combination
- os: ubuntu-latest
python-version: '3.13'
task: test
- os: ubuntu-latest
python-version: '3.13'
task: gh-lint
- os: ubuntu-latest
python-version: '3.13'
task: gh-format
- os: ubuntu-latest
python-version: '3.13'
task: types
# Running tests in parallel can produce confusing logs and only saves a
# few minutes, so don't do it across the whole matrix. This section is
# not to save time in Github; it is here to make sure pytest-xdist keeps
# working so developers can keep saving time on their workstations.
- os: ubuntu-latest
python-version: '3.13'
task: test-xdist
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# This is enough to find many quoting issues
with:
path: "./check out"
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
with:
python-version: ${{ matrix.python-version }}
working-directory: './check out/'
enable-cache: true
- name: Setup project
run: uv sync --frozen --directory "./check out/"
- name: Display Python version
run: echo "import sys; print(sys.version); print(sys.platform)" | uv run -
- name: Run ${{ matrix.task }} on ${{ matrix.os }} - ${{ matrix.python-version }}
run: uv run --frozen --directory "./check out/" --env-file=.github/http_env_block.conf poe ${{ matrix.task }}
- name: Upload coverage reports
if: ${{ matrix.task == 'gh-test' }}
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: "./check out/.coverage"
include-hidden-files: true
- name: Upload test reports
if: ${{ matrix.task == 'gh-test' }}
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: tests-${{ matrix.os }}-${{ matrix.python-version }}
path: "./check out/junit.xml"
test-report:
name: Report test results
runs-on: ubuntu-latest
needs: ["build"]
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.13'
- name: Download all artifacts
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
- name: Install coverage
run: pip3 install coverage
- name: Create coverage report
run: |
coverage combine coverage-*/.coverage
coverage xml
- name: Upload combined coverage report
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: coverage-combined
path: coverage.xml
- name: Upload coverage to Codecov
if: github.repository_owner == 'zephyrproject-rtos'
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: github.repository_owner == 'zephyrproject-rtos' && ${{ !cancelled() }}
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1.2.1
with:
token: ${{ secrets.CODECOV_TOKEN }}