forked from solvcon/solvcon
-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (145 loc) · 5.64 KB
/
Copy pathlint.yml
File metadata and controls
174 lines (145 loc) · 5.64 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
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
name: lint
on:
push:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
schedule:
- cron: '34 17 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check_skip:
uses: ./.github/workflows/check_skip_ci.yml
permissions:
contents: read
pull-requests: read
issues: read
lint:
name: Run make lint and pilot on ${{ matrix.os }}
needs: [check_skip]
if: |
needs.check_skip.outputs.skip != 'true' && (
github.event_name == 'pull_request' ||
(github.event_name == 'push' &&
(vars.MMGH_PUSH_RUN_BRANCH == '*' ||
contains(vars.MMGH_PUSH_RUN_BRANCH, github.ref_name))) ||
(github.event_name == 'schedule' && vars.MMGH_NIGHTLY == 'enable'))
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ fromJSON(vars.MMGH_TIMEOUT_LINT || '45') }}
env:
JOB_MAKE_ARGS: VERBOSE=1 BUILD_QT=ON USE_CLANG_TIDY=ON LINT_AS_ERRORS=ON
# Cap build parallelism. The github-hosted runners have only 3 (macOS)
# / 4 (ubuntu) virtual cores shared with co-tenant VMs, so the default
# unbounded `make -j` oversubscribes memory and CPU; on the 7 GB arm64
# macOS runner clang-tidy then OOMs. -j2 is the safe bet on both.
MAKE_PARALLEL: -j2
QT_DEBUG_PLUGINS: 1
QT_QPA_PLATFORM: offscreen # for Ubuntu runner
PIP_BREAK_SYSTEM_PACKAGES: 1 # disabling PEP668 (for MacOS runner)
# Fix issue: https://github.com/solvcon/modmesh/issues/366
# Use custom config for jurplel/install-qt-action@v4
AQT_CONFIG: "thirdparty/aqt_settings.ini"
strategy:
matrix:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-26-Readme.md
# macos-26 is arm64 with 7 GB RAM; build parallelism is capped via
# MAKE_PARALLEL in the env block above so clang-tidy does not OOM.
os: [ubuntu-24.04, macos-26]
cmake_build_type: [Debug]
fail-fast: false
steps:
- uses: actions/checkout@v6
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 100 || 1 }}
- name: event name
run: |
echo "github.event_name: ${{ github.event_name }}"
- name: setup dependencies for Linux
if: runner.os == 'Linux'
uses: ./.github/actions/setup_linux
with:
workflow: 'lint'
- name: setup dependencies for macOS
if: runner.os == 'macOS'
uses: ./.github/actions/setup_macos
with:
workflow: 'lint'
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.23
with:
key: ${{ runner.os }}-tidy-${{ matrix.cmake_build_type }}
restore-keys: ${{ runner.os }}-tidy-${{ matrix.cmake_build_type }}
create-symlink: true
- name: make cformat (clang-format check)
run: |
echo "::group::make cformat"
make cformat
echo "::endgroup::"
- name: make cinclude (check_include)
run: |
echo "::group::make cinclude"
make cinclude
echo "::endgroup::"
- name: make checkascii (check ASCII-only characters)
run: |
echo "::group::make checkascii"
make checkascii
echo "::endgroup::"
- name: make checktws (check trailing whitespace)
run: |
echo "::group::make checktws"
make checktws
echo "::endgroup::"
- name: make flake8
run: |
echo "::group::make flake8"
make flake8
echo "::endgroup::"
- name: make pilot
if: github.event_name != 'pull_request'
run: |
echo "::group::make pilot"
make pilot \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3)"
echo "::endgroup::"
- name: make run_pilot_pytest
if: github.event_name != 'pull_request'
run: |
echo "::group::make run_pilot_pytest"
export LD_LIBRARY_PATH=$(python3 -c "import sys, os, shiboken6; sys.stdout.write(os.path.dirname(shiboken6.__file__))")
make run_pilot_pytest \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3)"
echo "::endgroup::"
- name: make pilot_clang_tidy_diff
if: github.event_name == 'pull_request'
run: |
make pilot_clang_tidy_diff \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" \
MODMESH_DIFF_BASE=${{ github.event.pull_request.base.sha }}
- name: make pilot_clang_tidy_diff with Python library path
if: github.event_name == 'pull_request'
run: |
export LD_LIBRARY_PATH=$(python3 -c "import sys, os, shiboken6; sys.stdout.write(os.path.dirname(shiboken6.__file__))")
make pilot_clang_tidy_diff \
${JOB_MAKE_ARGS} \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" \
MODMESH_DIFF_BASE=${{ github.event.pull_request.base.sha }}
send_email_on_failure:
needs: [lint]
# Run if any of the dependencies failed in master branch
if: ${{ always() && contains(needs.*.result, 'failure') && github.ref_name == 'master' && github.event.repository.fork == false }}
uses: ./.github/workflows/send_email_on_fail.yml
with:
job_results: |
- lint: ${{ needs.lint.result }}
secrets:
EMAIL_USERNAME: ${{ secrets.EMAIL_USERNAME }}
EMAIL_PASSWORD: ${{ secrets.EMAIL_PASSWORD }}