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 :
7474 - { os: ubuntu-latest , features: all , workspace: true }
7575 - { os: macos-latest , features: feat_os_unix }
7676 - { os: windows-latest , features: feat_os_windows }
77+ - { os: ubuntu-latest , features: feat_wasm , target: wasm32-wasip1 }
7778 steps :
7879 - uses : actions/checkout@v6
7980 with :
8283 with :
8384 toolchain : stable
8485 components : clippy
86+ targets : ${{ matrix.job.target || '' }}
8587 - uses : Swatinem/rust-cache@v2
8688 - name : Run sccache-cache
8789 id : sccache-setup
@@ -105,6 +107,7 @@ jobs:
105107 esac;
106108 outputs FAIL_ON_FAULT FAULT_TYPE
107109 - name : Install/setup prerequisites
110+ if : ${{ ! matrix.job.target }}
108111 shell : bash
109112 run : |
110113 ## Install/setup prerequisites
@@ -124,31 +127,20 @@ jobs:
124127 shell : bash
125128 command : |
126129 ## `cargo clippy` lint testing
127- unset fault
128- fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
129- fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
130- # * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
131- if [[ "${{ matrix.job.features }}" == "all" ]]; then
132- extra="--all-features"
133- else
134- 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"
135134 fi
136- case '${{ matrix.job.workspace }}' in
137- 1|t|true|y|yes)
138- extra="${extra} --workspace"
139- ;;
140- esac
141- # * determine sub-crate utility list (similar to FreeBSD workflow)
142- if [[ "${{ matrix.job.features }}" == "all" ]]; then
143- UTILITY_LIST="$(./util/show-utils.sh --all-features)"
144- else
145- UTILITY_LIST="$(./util/show-utils.sh --features ${{ matrix.job.features }})"
135+ if [[ -n "${{ matrix.job.target }}" ]]; then
136+ ARGS="${ARGS} --target ${{ matrix.job.target }}"
146137 fi
147- CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo -n "-puu_${u} "; done;)"
148- 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 ; }
149- 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}
150142 - name : " cargo clippy on fuzz dir"
151- if : runner.os != 'Windows'
143+ if : runner.os != 'Windows' && !matrix.job.target
152144 shell : bash
153145 run : |
154146 cd fuzz
0 commit comments