-
Notifications
You must be signed in to change notification settings - Fork 1
158 lines (137 loc) · 4.85 KB
/
python-test.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths:
- "**.py"
- "**requirements*.txt"
- pyproject.toml
- .pre-commit-config.yaml
- ".github/workflows/python-test.yml"
- "!docs/**"
workflow_dispatch:
jobs:
test:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install . -r requirements-dev.txt
- name: Collect Coverage
run: coverage run -m pytest -vv
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ runner.os }}
path: .coverage*
include-hidden-files: true
coverage-report:
needs: [test]
uses: cpp-linter/.github/.github/workflows/py-coverage.yml@main
secrets: inherit
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build wheel
run: python -m pip wheel -w dist .
- name: Upload wheel as artifact
uses: actions/upload-artifact@v4
with:
name: clang-tools-pip_wheel
path: dist/*.whl
install:
needs: [build]
strategy:
matrix:
version: [ 7, 8, 9, 10, 11, 12, 12.0.1, 13, 14, 15, 16, 17, 18, 19 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
exclude:
- version: 19
os: macos-latest # FIXME: https://github.com/cpp-linter/clang-tools-static-binaries/issues/40
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Download wheel artifact
uses: actions/download-artifact@v4
with:
name: clang-tools-pip_wheel
path: dist/
- name: Install pkg from wheel
# using a wildcard as filename on Windows requires a bash shell
shell: bash
run: pip install dist/*.whl
- name: Install clang-tools binaries
run: clang-tools --install ${{ matrix.version }} --tool clang-format clang-tidy clang-query clang-apply-replacements
- name: Show path of binaries
shell: bash
run: |
if [ "${{ matrix.version }}" = "15" -o "${{ matrix.version }}" = "16" ] && [ "${{ matrix.os }}" = "windows-latest" ]; then
which clang-format
which clang-tidy
which clang-query
which clang-apply-replacements
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
which "clang-format-${{ matrix.version }}"
which "clang-tidy-${{ matrix.version }}"
which "clang-query-${{ matrix.version }}"
which "clang-apply-replacements-${{ matrix.version }}"
fi
- name: Check clang-tools on Windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
case "${{ matrix.version }}" in
15|16|18)
clang-format.exe --version
clang-tidy.exe --version
clang-query.exe --version
clang-apply-replacements.exe --version
;;
*)
clang-format-${{ matrix.version }}.exe --version
clang-tidy-${{ matrix.version }}.exe --version
clang-query-${{ matrix.version }}.exe --version
clang-apply-replacements-${{ matrix.version }}.exe --version
;;
esac
- name: Check clang-tools on Unix
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
if [ "${{ matrix.version }}" = "12.0.1" -a "${{ matrix.os }}" = "ubuntu-latest" ]; then
clang-format-12.0.1 --version
clang-tidy-12.0.1 --version
clang-query-12.0.1 --version
clang-apply-replacements-12.0.1 --version
else
clang-format-${{ matrix.version }} --version
clang-tidy-${{ matrix.version }} --version
clang-query-${{ matrix.version }} --version
clang-apply-replacements-${{ matrix.version }} --version
fi
docs:
uses: cpp-linter/.github/.github/workflows/sphinx.yml@main
with:
path-to-doc: docs/_build/html