Skip to content

Commit a419e00

Browse files
authored
bcs: clean deps, reduce CI clean build time (#14)
* deps: use serde_core directly `bcs` only uses proc-macro serde derives in tests. We can reduce compile times by using `serde_core` directly, which only exports the core serde traits. * deps: remove thiserror, impl Error manually Before: ``` $ cargo tree --edges build,normal bcs v0.1.6 (/home/phlip9/dev/bcs) ├── serde v1.0.228 │ ├── serde_core v1.0.228 │ └── serde_derive v1.0.228 (proc-macro) │ ├── proc-macro2 v1.0.106 │ │ └── unicode-ident v1.0.24 │ ├── quote v1.0.45 │ │ └── proc-macro2 v1.0.106 (*) │ └── syn v2.0.117 │ ├── proc-macro2 v1.0.106 (*) │ ├── quote v1.0.45 (*) │ └── unicode-ident v1.0.24 └── thiserror v1.0.69 └── thiserror-impl v1.0.69 (proc-macro) ├── proc-macro2 v1.0.106 (*) ├── quote v1.0.45 (*) └── syn v2.0.117 (*) $ rm -rf /tmp/cargo-target && taskset -c 3 cargo build --target-dir /tmp/cargo-target --lib Finished dev [unoptimized + debuginfo] target(s) in 7.89s ``` After: ``` $ cargo tree --edges build,normal Updating crates.io index bcs v0.1.6 (/home/phlip9/dev/bcs) └── serde_core v1.0.228 $ rm -rf /tmp/cargo-target && taskset -c 3 cargo build --target-dir /tmp/cargo-target --lib Compiling serde_core v1.0.228 Compiling bcs v0.1.6 (/home/phlip9/dev/bcs) Finished dev [unoptimized + debuginfo] target(s) in 1.38s ``` * msrv: 1.56 -> 1.61, fix CI In theory we should be able to support an MSRV of `1.56`. Unfortunately this entry in `serde_core`'s Cargo.toml seems to confuse Cargo into adding `serde_derive` into the lock file, which only has a compatible MSRV of `1.61`. ```toml [target.'cfg(any())'.dependencies] serde_derive = { version = "=1.0.220", path = "../serde_derive" } ```
1 parent 1d03bda commit a419e00

8 files changed

Lines changed: 1077 additions & 39 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- name: Checkout repository
17-
uses: actions/checkout@v2
18-
19-
- name: Install Rust toolchain
20-
uses: actions-rs/toolchain@v1
21-
with:
22-
components: rustfmt, clippy
16+
- uses: actions/checkout@v6
17+
- run: rustup component add rustfmt clippy
2318

2419
- name: Lint
2520
run: |
@@ -35,10 +30,5 @@ jobs:
3530
minimum-supported-rust-version:
3631
runs-on: ubuntu-latest
3732
steps:
38-
- uses: actions/checkout@v2
39-
- uses: actions-rs/toolchain@v1
40-
with:
41-
# Dependencies may require Rust 2021.
42-
toolchain: 1.56.0
43-
override: true
44-
- run: cargo check
33+
- uses: actions/checkout@v6
34+
- run: cargo +1.61.0 check --locked --lib

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
/target
2-
Cargo.lock

0 commit comments

Comments
 (0)