@@ -24,21 +24,48 @@ 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+ )
34+
35+ for name in "${!files[@]}"; do
36+ url="${files[$name]}"
37+ curl -sSL "$url" -o "${name}.json"
38+ done
39+
2740 - name : Set up Python
2841 uses : actions/setup-python@v5
2942 with :
3043 python-version : ' 3.12'
3144
32- - name : Install dependencies
45+ - name : Install Python dependencies
3346 run : |
47+ # shellcheck disable=SC2102 # this is triggered by the [toolchain] extra
3448 python -m pip install --upgrade \
3549 pip \
3650 setuptools \
3751 wheel \
3852 cmakelang \
3953 flake8 \
4054 nb-clean \
41- nbqa[toolchain]
55+ nbqa[toolchain] \
56+ yamllint
57+
58+ - name : Install actionlint
59+ id : get_actionlint
60+ shell : bash
61+ run : bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
62+
63+ - name : actionlint
64+ shell : bash
65+ run : |
66+ echo "::add-matcher::.github/problem-matchers/actionlint.json"
67+ ${{ steps.get_actionlint.outputs.executable }} -color
68+ echo "::remove-matcher owner=actionlint::"
4269
4370 - name : C++ - find files
4471 id : cpp_files
7299
73100 echo "found cpp files: ${found_files}"
74101
75- # do not quote to keep this as a single line
76- echo found_files=${found_files} >> $ GITHUB_OUTPUT
102+ # shellcheck disable=SC2086 # do not quote to keep this as a single line
103+ echo found_files=${found_files} >> "${ GITHUB_OUTPUT}"
77104
105+ - run : echo "::add-matcher::.github/problem-matchers/clang-format.json"
78106 - name : C++ - Clang format lint
79107 if : always() && steps.cpp_files.outputs.found_files
80108 uses : DoozyX/clang-format-lint-action@v0.20
84112 extensions : ' c,cpp,h,hpp,m,mm'
85113 style : file
86114 inplace : false
115+ - run : echo "::remove-matcher owner=clang-format::"
87116
88117 - name : CMake - find files
89118 id : cmake_files
@@ -111,13 +140,15 @@ jobs:
111140
112141 echo "found cmake files: ${found_files}"
113142
114- # do not quote to keep this as a single line
115- echo found_files=${found_files} >> $ GITHUB_OUTPUT
143+ # shellcheck disable=SC2086 # do not quote to keep this as a single line
144+ echo found_files=${found_files} >> "${ GITHUB_OUTPUT}"
116145
117146 - name : CMake - cmake-lint
118147 if : always() && steps.cmake_files.outputs.found_files
119148 run : |
149+ echo "::add-matcher::.github/problem-matchers/cmake-lint.json"
120150 cmake-lint --line-width 120 --tab-size 4 ${{ steps.cmake_files.outputs.found_files }}
151+ echo "::remove-matcher owner=cmake-lint::"
121152
122153 - name : Docker - find files
123154 id : docker_files
@@ -127,8 +158,8 @@ jobs:
127158
128159 echo "found_files: ${found_files}"
129160
130- # do not quote to keep this as a single line
131- echo found_files=${found_files} >> $ GITHUB_OUTPUT
161+ # shellcheck disable=SC2086 # do not quote to keep this as a single line
162+ echo found_files=${found_files} >> "${ GITHUB_OUTPUT}"
132163
133164 - name : Docker - hadolint
134165 if : always() && steps.docker_files.outputs.found_files
@@ -150,18 +181,20 @@ jobs:
150181 failed=0
151182 failed_files=""
152183
184+ echo "::add-matcher::.github/problem-matchers/hadolint.json"
153185 for file in ${{ steps.docker_files.outputs.found_files }}; do
154186 echo "::group::${file}"
155187 docker run --rm -i \
156188 -e "NO_COLOR=0" \
157189 -e "HADOLINT_VERBOSE=1" \
158- -v $(pwd)/.hadolint.yaml:/.config/hadolint.yaml \
190+ -v " $(pwd)" /.hadolint.yaml:/.config/hadolint.yaml \
159191 hadolint/hadolint < $file || {
160192 failed=1
161193 failed_files="$failed_files $file"
162194 }
163195 echo "::endgroup::"
164196 done
197+ echo "::remove-matcher owner=hadolint::"
165198
166199 if [ $failed -ne 0 ]; then
167200 echo "::error:: hadolint failed for the following files: $failed_files"
@@ -210,17 +243,23 @@ jobs:
210243 - name : Python - flake8
211244 if : always()
212245 run : |
246+ echo "::add-matcher::.github/problem-matchers/flake8.json"
213247 python -m flake8 \
214248 --color=always \
215249 --verbose
250+ echo "::remove-matcher owner=flake8-error::"
251+ echo "::remove-matcher owner=flake8-warning::"
216252
217253 - name : Python - nbqa flake8
218254 if : always()
219255 run : |
256+ echo "::add-matcher::.github/problem-matchers/flake8.json"
220257 python -m nbqa flake8 \
221258 --color=always \
222259 --verbose \
223260 .
261+ echo "::remove-matcher owner=flake8-error::"
262+ echo "::remove-matcher owner=flake8-warning::"
224263
225264 - name : Python - nb-clean
226265 if : always()
@@ -239,21 +278,23 @@ jobs:
239278 run : |
240279 # check if Cargo.toml exists
241280 if [ -f "Cargo.toml" ]; then
242- echo "found_cargo=true" >> $ GITHUB_OUTPUT
281+ echo "found_cargo=true" >> "${ GITHUB_OUTPUT}"
243282 else
244- echo "found_cargo=false" >> $ GITHUB_OUTPUT
283+ echo "found_cargo=false" >> "${ GITHUB_OUTPUT}"
245284 fi
246285
247286 - name : Setup Rust
248287 uses : actions-rust-lang/setup-rust-toolchain@v1.13.0
249288 with :
250- target : ${{ matrix.target }}
251289 components : ' rustfmt'
252290 cache : false
253291
254292 - name : Rust - cargo fmt
255293 if : always() && steps.run_cargo.outputs.found_cargo == 'true'
256- run : cargo fmt -- --check
294+ run : |
295+ echo "::add-matcher::.github/problem-matchers/cargo-fmt.json"
296+ cargo fmt -- --check
297+ echo "::remove-matcher owner=cargo-fmt::"
257298
258299 - name : YAML - find files
259300 id : yaml_files
@@ -272,35 +313,30 @@ jobs:
272313 fi
273314 done
274315
275- echo "found_files=${found_files}" >> $ GITHUB_OUTPUT
316+ echo "found_files=${found_files}" >> "${ GITHUB_OUTPUT}"
276317
277318 - name : YAML - yamllint
278319 id : yamllint
279320 if : always()
280- uses : ibiqlik/action-yamllint@v3
281- with :
282- # https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
283- config_data : |
284- extends: default
285- rules:
286- comments:
287- level: error
288- document-start:
289- level: error
290- line-length:
291- max: 120
292- new-line-at-end-of-file:
293- level: error
294- new-lines:
295- type: unix
296- truthy:
297- # GitHub uses "on" for workflow event triggers
298- # .clang-format file has options of "Yes" "No" that will be caught by this, so changed to "warning"
299- allowed-values: ['true', 'false', 'on']
300- check-keys: true
301- level: warning
302- file_or_dir : . ${{ steps.yaml_files.outputs.found_files }}
303-
304- - name : YAML - log
305- if : always() && steps.yamllint.outcome == 'failure'
306- run : cat "${{ steps.yamllint.outputs.logfile }}" >> $GITHUB_STEP_SUMMARY
321+ run : |
322+ if [ ! -f .yamllint.yml ]; then
323+ curl -sSL https://raw.githubusercontent.com/LizardByte/.github/master/.yamllint.yml -o .yamllint.yml
324+ fi
325+
326+ echo "::add-matcher::.github/problem-matchers/yamllint.json"
327+ # set +e # disable exit on error to allow parsing of output
328+ # log_file=yamllint_output.txt
329+ # error=0
330+ yamllint \
331+ --config-file .yamllint.yml \
332+ --format=standard \
333+ --strict \
334+ . ${{ steps.yaml_files.outputs.found_files }} # > "${log_file}" 2>&1
335+ # error=$?
336+ # set -e # re-enable exit on error
337+
338+ # print the output
339+ # cat "${log_file}"
340+
341+ echo "::remove-matcher owner=yamllint::"
342+ # exit ${error}
0 commit comments