Repository navigation
144 lines (142 loc) · 4.75 KB
/
Copy pathcode-testing.yml
File metadata and controls
144 lines (142 loc) · 4.75 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
135
136
137
138
139
140
141
142
143
144
---
name: Testing ANTA
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
file-changes:
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
benchmarks: ${{ steps.filter.outputs.benchmarks }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
code:
- 'anta/**'
- 'tests/**'
# detect dependency changes
- 'pyproject.toml'
- 'uv.lock'
benchmarks:
- 'tests/benchmark/**'
- '.github/workflows/codspeed.yml'
- '.github/workflows/code-testing.yml'
test-locked-dependencies:
name: Pytest with locked dependencies
runs-on: ubuntu-latest
env:
COLUMNS: "165"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up uv and Python
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
version: "0.13.6"
python-version: "3.11"
- name: Check lock freshness
run: uv lock --check
- name: Install locked dependencies
run: uv sync --locked --no-default-groups --group test --extra cli
- name: Run unit tests with locked dependencies
run: uv run --no-sync python -m pytest tests/units --no-cov
test-python:
name: Pytest across all supported python versions (${{ matrix.python }})
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python: "3.11"
tox-env: clean,py311,report
- python: "3.12"
tox-env: py312
- python: "3.13"
tox-env: py313
- python: "3.14"
tox-env: py314
- python: "3.15"
tox-env: py315
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: ${{ matrix.python }}
allow-prereleases: ${{ matrix.python == '3.15' }}
- name: Install tox
run: python -m pip install --group tox
- name: "Run pytest via tox for ${{ matrix.python }}"
run: tox run -e "${{ matrix.tox-env }}"
- name: Upload coverage from pytest
# Coverage only runs as part of 3.11.
if: |
matrix.python == '3.11'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: pytest-coverage
path: coverage.xml
test-python-windows:
name: Pytest on 3.12 for windows
runs-on: windows-2022
needs: [file-changes]
if: needs.file-changes.outputs.code == 'true'
env:
# Required to prevent asyncssh to fail.
USERNAME: WindowsUser
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: 3.12
- name: Install tox
run: python -m pip install --group tox
- name: Run pytest via tox for 3.12 on Windows
run: tox run -e py312 -- --ignore=tests/docs
test-documentation:
name: Build offline documentation for testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -e ".[cli]" --group doc -e tools/zensical_extensions
- name: "Build Zensical documentation offline"
run: zensical build --strict
benchmarks:
name: Benchmark ANTA
needs: [file-changes, test-python]
if: (needs.file-changes.outputs.code == 'true' || needs.file-changes.outputs.benchmarks == 'true') && github.repository == 'aristanetworks/anta'
permissions:
contents: read
id-token: write
uses: $/.github/workflows/codspeed.yml
codecov:
name: Upload coverage to codecov
needs: [test-python]
if: github.repository == 'aristanetworks/anta'
permissions:
contents: read
id-token: write
uses: $/.github/workflows/codecov.yml