@@ -24,13 +24,31 @@ jobs:
2424 - name : Checkout
2525 uses : actions/checkout@v4
2626
27+ - name : Download problem matchers
28+ shell : bash
29+ working-directory : .github/problem-matchers
30+ run : |
31+ declare -A files=(
32+ [actionlint]="https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json"
33+ [hadolint]="https://raw.githubusercontent.com/actions-marketplace-validations/hadolint_hadolint-action/refs/heads/master/problem-matcher.json"
34+ )
35+
36+ # TODO: add more problem matchers
37+ # clang-format: # https://github.com/jidicula/clang-format-action/issues/137#issuecomment-3043722359
38+
39+ for name in "${!files[@]}"; do
40+ url="${files[$name]}"
41+ curl -sSL "$url" -o "${name}.json"
42+ done
43+
2744 - name : Set up Python
2845 uses : actions/setup-python@v5
2946 with :
3047 python-version : ' 3.12'
3148
32- - name : Install dependencies
49+ - name : Install Python dependencies
3350 run : |
51+ # shellcheck disable=SC2102 # this is triggered by the [toolchain] extra
3452 python -m pip install --upgrade \
3553 pip \
3654 setuptools \
4058 nb-clean \
4159 nbqa[toolchain]
4260
61+ - name : Install actionlint
62+ id : get_actionlint
63+ shell : bash
64+ run : bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
65+
66+ - name : actionlint
67+ shell : bash
68+ run : |
69+ echo "::add-matcher::.github/problem-matchers/actionlint.json"
70+ ${{ steps.get_actionlint.outputs.executable }} -color
71+ echo "::remove-matcher owner=actionlint::"
72+
4373 - name : C++ - find files
4474 id : cpp_files
4575 run : |
@@ -72,9 +102,10 @@ jobs:
72102
73103 echo "found cpp files: ${found_files}"
74104
75- # do not quote to keep this as a single line
76- echo found_files=${found_files} >> $ GITHUB_OUTPUT
105+ # shellcheck disable=SC2086 # do not quote to keep this as a single line
106+ echo found_files=${found_files} >> "${ GITHUB_OUTPUT}"
77107
108+ - run : echo "::add-matcher::.github/problem-matchers/clang-format.json"
78109 - name : C++ - Clang format lint
79110 if : always() && steps.cpp_files.outputs.found_files
80111 uses : DoozyX/clang-format-lint-action@v0.20
84115 extensions : ' c,cpp,h,hpp,m,mm'
85116 style : file
86117 inplace : false
118+ - run : echo "::remove-matcher owner=clang-format::"
87119
88120 - name : CMake - find files
89121 id : cmake_files
@@ -111,13 +143,15 @@ jobs:
111143
112144 echo "found cmake files: ${found_files}"
113145
114- # do not quote to keep this as a single line
115- echo found_files=${found_files} >> $ GITHUB_OUTPUT
146+ # shellcheck disable=SC2086 # do not quote to keep this as a single line
147+ echo found_files=${found_files} >> "${ GITHUB_OUTPUT}"
116148
117149 - name : CMake - cmake-lint
118150 if : always() && steps.cmake_files.outputs.found_files
119151 run : |
152+ echo "::add-matcher::.github/problem-matchers/cmake-lint.json"
120153 cmake-lint --line-width 120 --tab-size 4 ${{ steps.cmake_files.outputs.found_files }}
154+ echo "::remove-matcher owner=cmake-lint::"
121155
122156 - name : Docker - find files
123157 id : docker_files
@@ -127,8 +161,8 @@ jobs:
127161
128162 echo "found_files: ${found_files}"
129163
130- # do not quote to keep this as a single line
131- echo found_files=${found_files} >> $ GITHUB_OUTPUT
164+ # shellcheck disable=SC2086 # do not quote to keep this as a single line
165+ echo found_files=${found_files} >> "${ GITHUB_OUTPUT}"
132166
133167 - name : Docker - hadolint
134168 if : always() && steps.docker_files.outputs.found_files
@@ -150,18 +184,20 @@ jobs:
150184 failed=0
151185 failed_files=""
152186
187+ echo "::add-matcher::.github/problem-matchers/hadolint.json"
153188 for file in ${{ steps.docker_files.outputs.found_files }}; do
154189 echo "::group::${file}"
155190 docker run --rm -i \
156191 -e "NO_COLOR=0" \
157192 -e "HADOLINT_VERBOSE=1" \
158- -v $(pwd)/.hadolint.yaml:/.config/hadolint.yaml \
193+ -v " $(pwd)" /.hadolint.yaml:/.config/hadolint.yaml \
159194 hadolint/hadolint < $file || {
160195 failed=1
161196 failed_files="$failed_files $file"
162197 }
163198 echo "::endgroup::"
164199 done
200+ echo "::remove-matcher owner=brpaz/hadolint-action::"
165201
166202 if [ $failed -ne 0 ]; then
167203 echo "::error:: hadolint failed for the following files: $failed_files"
@@ -210,17 +246,21 @@ jobs:
210246 - name : Python - flake8
211247 if : always()
212248 run : |
249+ echo "::add-matcher::.github/problem-matchers/flake8.json"
213250 python -m flake8 \
214251 --color=always \
215252 --verbose
253+ echo "::remove-matcher owner=flake8::"
216254
217255 - name : Python - nbqa flake8
218256 if : always()
219257 run : |
258+ echo "::add-matcher::.github/problem-matchers/flake8.json"
220259 python -m nbqa flake8 \
221260 --color=always \
222261 --verbose \
223262 .
263+ echo "::remove-matcher owner=flake8::"
224264
225265 - name : Python - nb-clean
226266 if : always()
@@ -239,21 +279,23 @@ jobs:
239279 run : |
240280 # check if Cargo.toml exists
241281 if [ -f "Cargo.toml" ]; then
242- echo "found_cargo=true" >> $ GITHUB_OUTPUT
282+ echo "found_cargo=true" >> "${ GITHUB_OUTPUT}"
243283 else
244- echo "found_cargo=false" >> $ GITHUB_OUTPUT
284+ echo "found_cargo=false" >> "${ GITHUB_OUTPUT}"
245285 fi
246286
247287 - name : Setup Rust
248288 uses : actions-rust-lang/setup-rust-toolchain@v1.13.0
249289 with :
250- target : ${{ matrix.target }}
251290 components : ' rustfmt'
252291 cache : false
253292
254293 - name : Rust - cargo fmt
255294 if : always() && steps.run_cargo.outputs.found_cargo == 'true'
256- run : cargo fmt -- --check
295+ run : |
296+ echo "::add-matcher::.github/problem-matchers/cargo-fmt.json"
297+ cargo fmt -- --check
298+ echo "::remove-matcher owner=cargo-fmt::"
257299
258300 - name : YAML - find files
259301 id : yaml_files
@@ -272,7 +314,7 @@ jobs:
272314 fi
273315 done
274316
275- echo "found_files=${found_files}" >> $ GITHUB_OUTPUT
317+ echo "found_files=${found_files}" >> "${ GITHUB_OUTPUT}"
276318
277319 - name : YAML - yamllint
278320 id : yamllint
@@ -303,4 +345,8 @@ jobs:
303345
304346 - name : YAML - log
305347 if : always() && steps.yamllint.outcome == 'failure'
306- run : cat "${{ steps.yamllint.outputs.logfile }}" >> $GITHUB_STEP_SUMMARY
348+ run : |
349+ echo "::add-matcher::.github/problem-matchers/yamllint.json"
350+ cat "${{ steps.yamllint.outputs.logfile }}" >> "${GITHUB_STEP_SUMMARY}"
351+
352+ echo "::remove-matcher owner=yamllint::"
0 commit comments