forked from cda-tum/mqt-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (70 loc) · 2.71 KB
/
reusable-python-tests-individual.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
name: 🐍 • Tests
on:
workflow_call:
inputs:
runs-on:
description: "The platform to run the tests on"
required: true
type: string
python-version:
description: "The Python version to use"
required: true
type: string
session:
description: "The nox session to run (typically 'tests' or 'minimums')"
required: true
type: string
setup-z3:
description: "Whether to set up Z3"
default: false
type: boolean
z3-version:
description: "The version of Z3 to set up"
default: "4.13.0"
type: string
jobs:
python-tests:
name: 🐍 ${{ inputs.session }} ${{ inputs.python-version }} ${{ inputs.runs-on }}
runs-on: ${{ inputs.runs-on }}
env:
FORCE_COLOR: 3
GITHUB_TOKEN: ${{ github.token }}
steps:
# check out the repository (including submodules and all history)
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
# set up MSVC development environment (Windows only)
- uses: ilammy/msvc-dev-cmd@v1
# optionally set up Z3
- if: ${{ inputs.setup-z3 }}
name: Setup Z3
uses: cda-tum/setup-z3@v1
with:
version: ${{ inputs.z3-version }}
# set up ccache for faster C++ builds
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
prepend_symlinks_to_path: false
windows_compile_environment: msvc
override_cache_key: python-tests-${{ inputs.runs-on }}-${{ inputs.python-version }}-${{ inputs.session }}
# set up mold as linker for faster C++ builds (Linux only)
- name: Set up mold as linker (Linux only)
uses: rui314/setup-mold@v1
# set up uv for faster Python package management
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
# run the nox session (assumes a corresponding nox session exists) with coverage
- name: Test on 🐍 ${{ inputs.python-version }}
run: uvx nox -s ${{ inputs.session }}-${{ inputs.python-version }} --verbose -- --cov --cov-report=xml:coverage-${{ inputs.session }}-${{ inputs.python-version }}-${{ inputs.runs-on }}.xml
# upload the report as an artifact to GitHub so that it can later be uploaded to Codecov
- name: Upload 🐍 coverage report for the ${{ inputs.session }} session on 🐍 ${{ inputs.python-version }} running ${{ inputs.runs-on }}
uses: actions/upload-artifact@v4
with:
name: coverage-${{ inputs.session }}-${{ inputs.python-version }}-${{ inputs.runs-on }}
path: coverage-*