11name : Code Quality
22
3- # spell-checker:ignore (people) dtolnay juliangruber pell reactivecircus Swatinem taiki-e taplo
3+ # spell-checker:ignore (people) juliangruber pell reactivecircus taiki-e taplo
44# spell-checker:ignore (misc) TERMUX noaudio pkill swiftshader esac sccache pcoreutils shopt subshell dequote libsystemd
55
66on :
1010 - ' *'
1111
1212env :
13+ CARGO_INCREMENTAL : " 0"
1314 # * style job configuration
1415 STYLE_FAIL_ON_FAULT : true # # (bool) fail the build if a style job contains a fault (error or warning); may be overridden on a per-job basis
1516
@@ -66,15 +67,14 @@ jobs:
6667 style_lint :
6768 name : Style/lint
6869 runs-on : ${{ matrix.job.os }}
69- env :
70- CARGO_INCREMENTAL : 0
7170 strategy :
7271 fail-fast : false
7372 matrix :
7473 job :
7574 - { os: ubuntu-latest , features: all , workspace: true }
76- - { os: macos-latest , features: feat_os_macos }
75+ - { os: macos-latest , features: feat_os_unix }
7776 - { os: windows-latest , features: feat_os_windows }
77+ - { os: ubuntu-latest , features: feat_wasm , target: wasm32-wasip1 }
7878 steps :
7979 - uses : actions/checkout@v6
8080 with :
8383 with :
8484 toolchain : stable
8585 components : clippy
86+ targets : ${{ matrix.job.target || '' }}
8687 - uses : Swatinem/rust-cache@v2
8788 - name : Run sccache-cache
8889 id : sccache-setup
@@ -106,6 +107,7 @@ jobs:
106107 esac;
107108 outputs FAIL_ON_FAULT FAULT_TYPE
108109 - name : Install/setup prerequisites
110+ if : ${{ ! matrix.job.target }}
109111 shell : bash
110112 run : |
111113 ## Install/setup prerequisites
@@ -117,39 +119,28 @@ jobs:
117119 ;;
118120 esac
119121 - name : " `cargo clippy` lint testing"
120- uses : nick-fields/retry@v3
122+ uses : nick-fields/retry@v4
121123 with :
122124 max_attempts : 3
123125 retry_on : error
124126 timeout_minutes : 90
125127 shell : bash
126128 command : |
127129 ## `cargo clippy` lint testing
128- unset fault
129- fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
130- fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
131- # * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
132- if [[ "${{ matrix.job.features }}" == "all" ]]; then
133- extra="--all-features"
134- else
135- extra="--features ${{ matrix.job.features }}"
130+ ARGS="--features ${{ matrix.job.features }}"
131+ ARGS="${ARGS} --fault-type ${{ steps.vars.outputs.FAULT_TYPE }}"
132+ if [[ "${{ matrix.job.workspace }}" =~ ^(1|t|true|y|yes)$ ]]; then
133+ ARGS="${ARGS} --workspace"
136134 fi
137- case '${{ matrix.job.workspace }}' in
138- 1|t|true|y|yes)
139- extra="${extra} --workspace"
140- ;;
141- esac
142- # * determine sub-crate utility list (similar to FreeBSD workflow)
143- if [[ "${{ matrix.job.features }}" == "all" ]]; then
144- UTILITY_LIST="$(./util/show-utils.sh --all-features)"
145- else
146- UTILITY_LIST="$(./util/show-utils.sh --features ${{ matrix.job.features }})"
135+ if [[ -n "${{ matrix.job.target }}" ]]; then
136+ ARGS="${ARGS} --target ${{ matrix.job.target }}"
147137 fi
148- CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo -n "-puu_${u} "; done;)"
149- S=$(cargo clippy --all-targets $extra --tests --benches -pcoreutils ${CARGO_UTILITY_LIST_OPTIONS} -- -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
150- if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
138+ if [[ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ]]; then
139+ ARGS="${ARGS} --fail-on-fault"
140+ fi
141+ python3 util/run-clippy.py ${ARGS}
151142 - name : " cargo clippy on fuzz dir"
152- if : runner.os != 'Windows'
143+ if : runner.os != 'Windows' && !matrix.job.target
153144 shell : bash
154145 run : |
155146 cd fuzz
0 commit comments