Skip to content

Commit 53fbb3f

Browse files
authored
chore: format Cargo.toml, minor just cleanup (#27)
1 parent 2f68b74 commit 53fbb3f

5 files changed

Lines changed: 48 additions & 34 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,25 @@ updates:
33

44
# Maintain dependencies for GitHub Actions
55
- package-ecosystem: github-actions
6-
directory: "/"
7-
schedule:
8-
interval: weekly
6+
directory: '/'
7+
schedule: { interval: weekly }
98
groups:
109
all-actions-version-updates:
1110
applies-to: version-updates
12-
patterns:
13-
- "*"
11+
patterns: [ '*' ]
1412
all-actions-security-updates:
1513
applies-to: security-updates
16-
patterns:
17-
- "*"
14+
patterns: [ '*' ]
1815

1916
# Update Rust dependencies
2017
- package-ecosystem: cargo
21-
directory: "/"
22-
schedule:
23-
interval: daily
24-
time: "02:00"
18+
directory: '/'
19+
schedule: { interval: daily, time: '02:00' }
2520
open-pull-requests-limit: 10
2621
groups:
2722
all-cargo-version-updates:
2823
applies-to: version-updates
29-
patterns:
30-
- "*"
24+
patterns: [ '*' ]
3125
all-cargo-security-updates:
3226
applies-to: security-updates
33-
patterns:
34-
- "*"
27+
patterns: [ '*' ]

.github/workflows/ci.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8-
release:
9-
types: [ published ]
108
workflow_dispatch:
119

1210
defaults:
@@ -18,22 +16,22 @@ jobs:
1816
name: Test
1917
runs-on: ubuntu-latest
2018
steps:
21-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v5
2220
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
2321
uses: Swatinem/rust-cache@v2
2422
- uses: taiki-e/install-action@v2
25-
with: { tool: just }
23+
with: { tool: 'just,cargo-binstall' }
2624
- run: just ci-test
2725

2826
test-msrv:
2927
name: Test MSRV
3028
runs-on: ubuntu-latest
3129
steps:
32-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v5
3331
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
3432
uses: Swatinem/rust-cache@v2
3533
- uses: taiki-e/install-action@v2
36-
with: { tool: just }
34+
with: { tool: 'just' }
3735
- name: Read MSRV
3836
id: msrv
3937
run: echo "value=$(just get-msrv)" >> $GITHUB_OUTPUT
@@ -48,7 +46,7 @@ jobs:
4846
if: github.event_name != 'release'
4947
runs-on: ubuntu-latest
5048
steps:
51-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v5
5250
- uses: Swatinem/rust-cache@v2
5351
- uses: taiki-e/install-action@v2
5452
with: { tool: 'just,cargo-llvm-cov' }
@@ -59,7 +57,6 @@ jobs:
5957
with:
6058
token: ${{ secrets.CODECOV_TOKEN }}
6159
files: target/llvm-cov/codecov.info
62-
fail_ci_if_error: true
6360

6461
# This job checks if any of the previous jobs failed or were canceled.
6562
# This approach also allows some jobs to be skipped if they are not needed.
@@ -68,6 +65,8 @@ jobs:
6865
if: always()
6966
runs-on: ubuntu-latest
7067
steps:
68+
- name: Result of the needed steps
69+
run: echo "${{ toJSON(needs) }}"
7170
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
7271
run: exit 1
7372

@@ -88,7 +87,7 @@ jobs:
8887
group: release-plz-${{ github.ref }}
8988
cancel-in-progress: false
9089
steps:
91-
- uses: actions/checkout@v4
90+
- uses: actions/checkout@v5
9291
with: { fetch-depth: 0 }
9392
- uses: dtolnay/rust-toolchain@stable
9493
- name: Publish to crates.io if crate's version is newer
@@ -98,9 +97,9 @@ jobs:
9897
env:
9998
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
10099
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
101-
- name: If version is the same, create a PR proposing new version and changelog for the next release
100+
- if: ${{ steps.release.outputs.releases_created == 'false' }}
101+
name: If version is the same, create a PR proposing new version and changelog for the next release
102102
uses: release-plz/action@v0.5
103-
if: ${{ steps.release.outputs.releases_created == 'false' }}
104103
with: { command: release-pr }
105104
env:
106105
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}

bench/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ version = "0.0.0"
55
edition = "2021"
66
publish = false
77

8+
[[bench]]
9+
name = "bench"
10+
harness = false
11+
812
[dependencies]
913
delta-encoding = { path = ".." }
1014

1115
[dev-dependencies]
1216
criterion = { version = "0.6", features = ["html_reports"] }
13-
14-
[[bench]]
15-
name = "bench"
16-
harness = false

justfile

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ features_flag := '--all-features'
77
# Use `CI=true just ci-test` to run the same tests as in GitHub CI.
88
# Use `just env-info` to see the current values of RUSTFLAGS and RUSTDOCFLAGS
99
ci_mode := if env('CI', '') != '' {'1'} else {''}
10+
# cargo-binstall needs a workaround due to caching
11+
# ci_mode might be manually set by user, so re-check the env var
12+
binstall_args := if env('CI', '') != '' {'--no-track'} else {''}
1013
export RUSTFLAGS := env('RUSTFLAGS', if ci_mode == '1' {'-D warnings'} else {''})
1114
export RUSTDOCFLAGS := env('RUSTDOCFLAGS', if ci_mode == '1' {'-D warnings'} else {''})
1215
export RUST_BACKTRACE := env('RUST_BACKTRACE', if ci_mode == '1' {'1'} else {''})
@@ -63,6 +66,7 @@ docs *args='--open':
6366
# Print environment info
6467
env-info:
6568
@echo "Running {{if ci_mode == '1' {'in CI mode'} else {'in dev mode'} }} on {{os()}} / {{arch()}}"
69+
@echo "PWD $(pwd)"
6670
{{just_executable()}} --version
6771
rustc --version
6872
cargo --version
@@ -75,14 +79,18 @@ env-info:
7579
fmt:
7680
#!/usr/bin/env bash
7781
set -euo pipefail
78-
if rustup component list --toolchain nightly | grep rustfmt &> /dev/null; then
82+
if (rustup toolchain list | grep nightly && rustup component list --toolchain nightly | grep rustfmt) &> /dev/null; then
7983
echo 'Reformatting Rust code using nightly Rust fmt to sort imports'
8084
cargo +nightly fmt --all -- --config imports_granularity=Module,group_imports=StdExternalCrate
8185
else
8286
echo 'Reformatting Rust with the stable cargo fmt. Install nightly with `rustup install nightly` for better results'
8387
cargo fmt --all
8488
fi
8589

90+
# Reformat all Cargo.toml files using cargo-sort
91+
fmt-toml *args: (cargo-install 'cargo-sort')
92+
cargo sort --workspace --grouped {{args}}
93+
8694
# Get any package's field from the metadata
8795
get-crate-field field package=main_crate: (assert-cmd 'jq')
8896
cargo metadata --format-version 1 | jq -e -r '.packages | map(select(.name == "{{package}}")) | first | .{{field}} | select(. != null)'
@@ -94,6 +102,7 @@ get-msrv package=main_crate: (get-crate-field 'rust_version' package)
94102
msrv: (cargo-install 'cargo-msrv')
95103
cargo msrv find --write-msrv --ignore-lockfile -- just ci-test-msrv
96104

105+
# Run cargo-release
97106
release *args='': (cargo-install 'release-plz')
98107
release-plz {{args}}
99108

@@ -110,7 +119,7 @@ test:
110119
test-doc: (docs '')
111120

112121
# Test code formatting
113-
test-fmt:
122+
test-fmt: && (fmt-toml '--check' '--check-format')
114123
cargo fmt --all -- --check
115124

116125
# Run all tests for MSRV
@@ -155,7 +164,7 @@ cargo-install $COMMAND $INSTALL_CMD='' *args='':
155164
echo "$COMMAND could not be found. Installing it with cargo install ${INSTALL_CMD:-$COMMAND} --locked {{args}}"
156165
cargo install ${INSTALL_CMD:-$COMMAND} --locked {{args}}
157166
else
158-
echo "$COMMAND could not be found. Installing it with cargo binstall ${INSTALL_CMD:-$COMMAND} --locked {{args}}"
159-
cargo binstall ${INSTALL_CMD:-$COMMAND} --locked {{args}}
167+
echo "$COMMAND could not be found. Installing it with cargo binstall ${INSTALL_CMD:-$COMMAND} {{binstall_args}} --locked {{args}}"
168+
cargo binstall ${INSTALL_CMD:-$COMMAND} {{binstall_args}} --locked {{args}}
160169
fi
161170
fi

tomlfmt.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
table_order = [
2+
'package',
3+
'lib',
4+
'bin',
5+
'example',
6+
'bench',
7+
'features',
8+
'dependencies',
9+
'build-dependencies',
10+
'dev-dependencies',
11+
'profile',
12+
'lints',
13+
]

0 commit comments

Comments
 (0)