Repository navigation
99 lines (94 loc) · 3 KB
/
Copy pathtests-reusable.yml
File metadata and controls
99 lines (94 loc) · 3 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
# SPDX-FileCopyrightText: © 2025 open-nudge <https://github.com/open-nudge>
# SPDX-FileContributor: szymonmaszke <github@maszke.co>
#
# SPDX-License-Identifier: Apache-2.0
---
name: "Tests Reusable"
permissions: {} # yamllint disable-line rule:braces
on:
workflow_call:
inputs:
additional-allowed-endpoints:
description: "Additional endpoints to allow"
type: "string"
default: ""
timeout-minutes:
description: "Timeout in minutes"
type: "number"
default: 30
jobs:
tests-reusable:
strategy:
matrix:
python:
#
# DO NOT EDIT UNTIL end marker
#
# [[[cog
# import cog
# import cogeol
#
# for version in reversed(cogeol.scientific()):
# cycle = version['cycle']
# cog.outl(f' - "{cycle}"')
# ]]]
- "3.12"
- "3.13"
- "3.14"
# [[[end]]] (sum: wgdYaRbI0v)
os:
- "ubuntu-latest"
- "macos-latest"
- "windows-latest"
name: >
Tests | ${{ matrix.os }} | python-${{ matrix.python }}
permissions:
contents: "read"
# yamllint disable rule:line-length
uses: "open-nudge/opentemplate/.github/workflows/run-reusable.yml@main" # zizmor: ignore[unpinned-uses]
# yamllint enable rule:line-length
with:
# yamllint disable rule:line-length
command: |
pdm run tests
mv .coverage coverage-${{ matrix.os }}-${{ matrix.python }}-${{ github.sha }}.sqlite
# yamllint enable rule:line-length
sparse-checkout: |
**.py
tests/**
group: "tests"
core: true
# yamllint disable rule:line-length
upload-name: >
coverage-${{ matrix.os }}-${{ matrix.python }}-${{ github.sha }}
# yamllint enable rule:line-length
upload-path: >
coverage-${{ matrix.os }}-${{ matrix.python }}-${{ github.sha }}.sqlite
python-version: "${{ matrix.python }}"
os: "${{ matrix.os }}"
additional-allowed-endpoints: >
${{ inputs.additional-allowed-endpoints }}
timeout-minutes: "${{ inputs.timeout-minutes }}"
coverage:
name: "Coverage"
needs: "tests-reusable"
permissions:
contents: "read"
# yamllint disable rule:line-length
uses: "open-nudge/opentemplate/.github/workflows/run-reusable.yml@main" # zizmor: ignore[unpinned-uses]
# yamllint enable rule:line-length
with:
# yamllint disable rule:line-length
command: |
pdm run coverage combine --debug=pathmap --keep $(find coverage-*-${{ github.sha }}/ -name "coverage-*-${{ github.sha }}.sqlite")
pdm run coverage html --skip-empty
pdm run coverage report
# yamllint enable rule:line-length
# Needed for source code
sparse-checkout: |
**.py
group: "tests"
download-pattern: "coverage-*-${{ github.sha }}"
upload-name: "coverage-combined-${{ github.sha }}"
upload-path: "htmlcov"
...