forked from OpenAssetIO/OpenAssetIO
-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (157 loc) · 5.43 KB
/
code-quality.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Code quality
on: pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Buy some more time to use the deprecated Node 16 (needed for GLIBC
# version - also see comment re. pinning to actions/checkout@v3).
# Upgrading to the CY23 Docker images will solve this longer term. See
# https://github.com/OpenAssetIO/OpenAssetIO/issues/984#issuecomment-2210792734
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
pylint:
runs-on: ${{ matrix.config.os }}
name: Pylint
strategy:
matrix:
config:
- os: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Bootstrap
uses: ./.github/bootstrap_platform
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r resources/build/linter-requirements.txt
python -m pip install -r src/openassetio-python/tests/requirements.txt
- name: Build
run: |
python -m pip install src/openassetio-python
env:
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/.conan/conan_paths.cmake
- name: Lint
uses: TheFoundryVisionmongers/fn-pylint-action@v2
with:
pylint-args: >
--recursive=y --disable=fixme
--rcfile=src/openassetio-python/pyproject.toml
src/openassetio-python/package/openassetio
src/openassetio-python/tests
black:
runs-on: ubuntu-latest
name: Python formatting
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r resources/build/linter-requirements.txt
- name: Check Python formatting
run: black --config src/openassetio-python/pyproject.toml --check --diff .
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/github-action-markdown-link-check@v1
# Note: in order to keep an `actions/cache` cache up to date, we must
# use the approach detailed in
# https://github.com/actions/cache/blob/main/workarounds.md#update-a-cache
# i.e. load the most recently created cache that matches a prefix,
# then create an entirely new cache with every run.
cpp-linters:
name: C++ linters
runs-on: ubuntu-20.04
strategy:
matrix:
config:
- os: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Bootstrap
uses: ./.github/bootstrap_platform
- name: Cache ccache cache
uses: actions/cache@v4
with:
path: /tmp/ccache
key: ubuntu-20.04-ccache-lint-${{ github.run_id }}
restore-keys: ubuntu-20.04-ccache-lint-
- name: Install dependencies
# Configure the system and install library dependencies via
# conan packages.
run: |
python -m pip install -r resources/build/linter-requirements.txt
clang-tidy --version
clang-format --version
cpplint --version
- name: Configure CMake build
run: >
cmake -S . -B build -G Ninja
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache
--install-prefix ${{ github.workspace }}/dist
--toolchain ${{ github.workspace }}/.conan/conan_paths.cmake
--preset lint
- name: Build and lint
run: |
/usr/bin/ccache -s
cmake --build build
/usr/bin/ccache -s
env:
CCACHE_DIR: /tmp/ccache
sanitizers:
name: Sanitizers
runs-on: ubuntu-20.04
strategy:
matrix:
config:
- os: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Bootstrap
uses: ./.github/bootstrap_platform
- name: Cache ccache cache
uses: actions/cache@v4
with:
path: /tmp/ccache
key: ubuntu-20.04-ccache-sanitize-${{ github.run_id }}
restore-keys: ubuntu-20.04-ccache-sanitize-
- name: Configure CMake build
run: >
cmake -S . -B build -G Ninja
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache
-DCMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache
--install-prefix ${{ github.workspace }}/dist
--toolchain ${{ github.workspace }}/.conan/conan_paths.cmake
--preset sanitize
- name: Build and test
run: |
/usr/bin/ccache -s
ctest -VV --test-dir build --parallel 4
/usr/bin/ccache -s
env:
CCACHE_DIR: /tmp/ccache
abi-check:
name: ABI diff check
runs-on: ubuntu-latest
# We must test ABI on a consistent platform. So choose our VFX
# reference platform compatible Docker image, which we have
# pre-installed libabigail into for performing the ABI diff checks.
container:
image: ghcr.io/openassetio/openassetio-build
steps:
- uses: actions/checkout@v3 # Needs to be V3 because of GLIBC ver.
with:
path: src
- name: Build and check ABI
shell: bash
run: >
cd src
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
-DOPENASSETIO_ENABLE_TESTS=ON -DOPENASSETIO_ENABLE_TEST_ABI=ON
ctest --test-dir build --output-on-failure -R openassetio.test.abi --parallel 4