Repository navigation
70 lines (60 loc) · 2.48 KB
/
Copy pathtest.yml
File metadata and controls
70 lines (60 loc) · 2.48 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
name: Test
on:
workflow_call:
inputs:
matrix:
description: |
JSON `strategy.matrix` value, normally produced by scripts/tox_matrix.py
in the `prepare` job of ci.yml. Must be of the form
`{"include": [{"name": ..., "tox_env": ..., "python_version": ...,
"needs_weaver": <optional bool>}, ...]}`.
required: true
type: string
permissions:
contents: read
env:
# Set the SHA to the branch name if the PR has a label 'prepare-release' or 'backport' otherwise, set it to 'main'
# For PRs you can change the inner fallback ('main')
# For pushes you change the outer fallback ('main')
# The logic below is used during releases and depends on having an equivalent branch name in the core repo.
CORE_REPO_SHA: ${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.labels.*.name, 'prepare-release') && github.event.pull_request.head.ref ||
contains(github.event.pull_request.labels.*.name, 'backport') && github.event.pull_request.base.ref ||
'main'
) || 'main' }}
CONTRIB_REPO_SHA: main
PIP_EXISTS_ACTION: w
jobs:
test:
name: ${{ matrix.name }}
runs-on: cncf-ubuntu-2-8-x86
timeout-minutes: 30
strategy:
fail-fast: false
matrix: ${{ fromJson(inputs.matrix) }}
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "${{ matrix.python_version }}"
- name: Set up uv
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
- name: Read pinned weaver version
if: ${{ matrix.needs_weaver }}
id: versions
run: |
# shellcheck disable=SC2002
cat versions.env | grep -E '^WEAVER_VERSION=' >> "$GITHUB_OUTPUT"
- name: Install weaver ${{ steps.versions.outputs.WEAVER_VERSION }}
if: ${{ matrix.needs_weaver }}
uses: open-telemetry/weaver/.github/actions/setup-weaver@0f7c529d27eacc364824ad00a120566316c7247b # v0.27.0
with:
version: ${{ steps.versions.outputs.WEAVER_VERSION }}
- name: Run tests
run: uvx --with tox-uv tox -e "${MATRIX_TOX_ENV}" -- -ra
env:
MATRIX_TOX_ENV: ${{ matrix.tox_env }}