Skip to content

Commit d1243f8

Browse files
committed
ci: Add TOML format checks
This checks in a .taplo.yml file that was used to format the Cargo.toml files with the recent changes and adds a check in CI to ensure that all files are formatted the same way. In addition, it changes all remaining uses of installing rust using rustup directly to instead use the dtolnay/rust-toolchain action. Signed-off-by: Dave Tucker <[email protected]>
1 parent ac19c1f commit d1243f8

File tree

4 files changed

+33
-19
lines changed

4 files changed

+33
-19
lines changed

.github/workflows/tests.yml

+23-18
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ jobs:
6969
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7070
with:
7171
persist-credentials: false
72-
- name: Rustup
73-
run: |
74-
rustup install --profile minimal stable
75-
rustup override set stable
72+
- uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # stable
7673
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
7774
- run: |
7875
cargo test --workspace --no-default-features --features full,rustls-tls,test-registry
@@ -84,26 +81,36 @@ jobs:
8481
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8582
with:
8683
persist-credentials: false
87-
- name: Rustup (nightly)
88-
run: |
89-
rustup install --profile minimal nightly
90-
rustup override set nightly
84+
- uses: dtolnay/rust-toolchain@4f94fbe7e03939b0e674bcc9ca609a16088f63ff # nightly
9185
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
9286
- run: |
9387
make doc
9488
89+
toml:
90+
name: Toml format
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
94+
with:
95+
persist-credentials: false
96+
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
97+
- uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # stable
98+
- uses: taiki-e/install-action@7ea888af71a31437ad4e71c62d021b3bb2728ea9 # v2.49.3
99+
with:
100+
tool: taplo-cli
101+
- run: |
102+
taplo fmt --check
103+
95104
fmt:
96105
name: Rustfmt
97106
runs-on: ubuntu-latest
98107
steps:
99108
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
100109
with:
101110
persist-credentials: false
102-
- name: Rustup
103-
run: |
104-
rustup install --profile minimal stable
105-
rustup override set stable
106-
rustup component add rustfmt
111+
- uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # stable
112+
with:
113+
components: rustfmt
107114
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
108115
- run: |
109116
cargo fmt --all -- --check
@@ -115,11 +122,9 @@ jobs:
115122
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
116123
with:
117124
persist-credentials: false
118-
- name: Rustup
119-
run: |
120-
rustup install --profile minimal stable
121-
rustup override set stable
122-
rustup component add clippy
125+
- uses: dtolnay/rust-toolchain@38b70195107dddab2c7bbd522bcf763bac00963b # stable
126+
with:
127+
components: clippy
123128
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
124129
- run: |
125130
cargo clippy --workspace -- -D warnings

.taplo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
exclude = [".cargo/audit.toml"]
2+
3+
[[rule]]
4+
5+
[rule.formatting]
6+
indent_string = " "
7+
reorder_arrays = true
8+
reorder_keys = true

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ build:
55
.PHONY: fmt
66
fmt:
77
cargo fmt --all -- --check
8+
taplo fmt --check
89

910
.PHONY: lint
1011
lint:

clippy.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
allow-unwrap-in-tests = true
21
allow-panic-in-tests = true
2+
allow-unwrap-in-tests = true

0 commit comments

Comments
 (0)