Skip to content

Commit cd294cc

Browse files
committed
ci: use only one of the fmt jobs & remove other
1 parent b74e85a commit cd294cc

File tree

2 files changed

+6
-43
lines changed

2 files changed

+6
-43
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ jobs:
3636
sudo apt-get -yq --no-install-suggests --no-install-recommends install libsystemd-dev
3737
- run: cargo test --all
3838

39-
fmt:
40-
name: cargo fmt --all -- --check
41-
runs-on: ubuntu-latest
42-
steps:
43-
- uses: actions/checkout@v4
44-
- uses: dtolnay/rust-toolchain@stable
45-
- run: rustup component add rustfmt
46-
- run: cargo fmt --all -- --check
47-
4839
coverage:
4940
name: Code Coverage
5041
runs-on: ${{ matrix.job.os }}

.github/workflows/code-quality.yml

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,15 @@ concurrency:
2121
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2222

2323
jobs:
24-
style_format:
25-
name: Style/format
26-
runs-on: ${{ matrix.job.os }}
27-
strategy:
28-
fail-fast: false
29-
matrix:
30-
job:
31-
- { os: ubuntu-latest, features: feat_os_unix }
24+
fmt:
25+
name: cargo fmt --all -- --check
26+
runs-on: ubuntu-latest
3227
steps:
3328
- uses: actions/checkout@v4
34-
- uses: dtolnay/rust-toolchain@master
35-
with:
36-
toolchain: stable
37-
components: rustfmt
29+
- uses: dtolnay/rust-toolchain@stable
3830
- uses: Swatinem/rust-cache@v2
39-
- name: Initialize workflow variables
40-
id: vars
41-
shell: bash
42-
run: |
43-
## VARs setup
44-
outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; }
45-
# failure mode
46-
unset FAIL_ON_FAULT ; case '${{ env.STYLE_FAIL_ON_FAULT }}' in
47-
''|0|f|false|n|no|off) FAULT_TYPE=warning ;;
48-
*) FAIL_ON_FAULT=true ; FAULT_TYPE=error ;;
49-
esac;
50-
outputs FAIL_ON_FAULT FAULT_TYPE
51-
- name: "`cargo fmt` testing"
52-
shell: bash
53-
run: |
54-
## `cargo fmt` testing
55-
unset fault
56-
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
57-
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
58-
# * convert any errors/warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
59-
S=$(cargo fmt -- --check) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s\n" "$S" | sed -E -n -e "s/^Diff[[:space:]]+in[[:space:]]+${PWD//\//\\/}\/(.*)[[:space:]]+at[[:space:]]+[^0-9]+([0-9]+).*$/::${fault_type} file=\1,line=\2::${fault_prefix}: \`cargo fmt\`: style violation (file:'\1', line:\2; use \`cargo fmt -- \"\1\"\`)/p" ; fault=true ; }
60-
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi
31+
- run: rustup component add rustfmt
32+
- run: cargo fmt --all -- --check
6133

6234
style_lint:
6335
name: Style/lint

0 commit comments

Comments
 (0)