-
Notifications
You must be signed in to change notification settings - Fork 1
158 lines (135 loc) · 4.65 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:
pull_request:
branches: [ "main" ]
paths:
- "**.py"
- "**requirements*.txt"
- pyproject.toml
- setup.py
- .pre-commit-config.yaml
- ".github/workflows/python-test.yml"
- "!docs/**"
workflow_dispatch:
jobs:
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: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install . -r requirements-dev.txt
- name: Run pre-commit
run: pre-commit run --all-files
- name: Collect coverage
run: |
coverage run -m pytest -vv
coverage report -m
coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
verbose: true # optional (default = false)
- name: build wheel
run: python -m pip wheel -w dist .
- name: upload wheel as artifact
uses: actions/upload-artifact@v3
with:
name: "clang-tools-pip_wheel"
path: ${{ github.workspace }}/dist/*.whl
install:
needs: [build]
strategy:
matrix:
version: [ 3.9, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12.0.1, 13, 14, 15, 16, 17 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: download wheel artifact
uses: actions/download-artifact@v3
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
run: clang-tools --install ${{ matrix.version }}
- 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
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
which "clang-format-${{ matrix.version }}"
which "clang-tidy-${{ matrix.version }}"
fi
- name: Check clang-tools on Windows
if: matrix.os == 'windows-latest'
shell: bash
run: |
case "${{ matrix.version }}" in
15|16)
clang-format.exe --version
clang-tidy.exe --version
;;
*)
clang-format-${{ matrix.version }}.exe --version
clang-tidy-${{ 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
else
clang-format-${{ matrix.version }} --version
case "${{ matrix.version }}" in
14|15|16)
echo "Skipping version ${{ matrix.version }} due to Segmentation fault on Ubuntu."
;;
*)
clang-tidy-${{ matrix.version }} --version
;;
esac
fi
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- run: python -m pip install . -r docs/requirements.txt
- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
- name: Save built docs as artifact
uses: actions/upload-artifact@v3
with:
name: "clang-tools-pip_docs"
path: ${{ github.workspace }}/docs/_build/html
- name: upload to github pages
# only publish doc changes from main branch
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html