Skip to content

Commit 7542fb6

Browse files
committed
xtask command to use a local registry
1 parent 0bbe2b0 commit 7542fb6

File tree

10 files changed

+736
-0
lines changed

10 files changed

+736
-0
lines changed

.cargo/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ xfmt = "xtask fmt-packages"
66
qa = "xtask run example qa-test"
77
xcheck = "run --quiet --package xtask --features=semver-checks --"
88
xrelease = "run --package xtask --features=release -- release"
9+
xrel-check = "run --package xtask --features=rel-check -- rel-check"

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ exclude = [
2929
"xtensa-lx",
3030
"xtensa-lx-rt",
3131
"xtensa-lx-rt-proc-macros",
32+
33+
"compile-tests",
3234
]

compile-tests/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Tests to check if "released" crates work
2+
3+
This folder in special in a couple of ways.
4+
5+
It's meant to check that released crates work well together. Especially it's meant to "simulate" a release
6+
by using a private registry (i.e. a local registry).
7+
8+
For that reason the projects under this folder don't use path-dependencies.
9+
10+
This folder (and it's sub-folders) are also not known to the general `xtask` commands. (except the `rel-check` command)
11+
12+
The projects don't contain real code but just define dependencies to make sure they compile.
13+
14+
## Walkthrough how to use it with the `rel-check` command
15+
16+
`cargo xrel-check init`
17+
18+
This will initialize the local registry with the dependencies used by the projects found in the `compile-tests` folder.
19+
20+
`cargo xrel-check check`
21+
22+
This just tries to build every project in the `compile-tests` folder.
23+
Please note that we remove `Cargo.lock` files before the build if they are present.
24+
If the local registry is initialized this will use it.
25+
26+
To test how a version bump affects the test projects let's bump `esp-backtrace` to e.g. `0.999.0`. (manually)
27+
28+
`cargo xrel-check update esp-backtrace`
29+
30+
This will package and add the esp-backtrace crate.
31+
32+
Let's see if it still compiles. (the test projects still use the current version - so this is expected to work)
33+
34+
`cargo xrel-check check`
35+
36+
Now get the test projects updated to use the bumped version of `esp-backtrace`:
37+
38+
`cargo xrel-check yolo-bump`
39+
40+
Notice the change in the `Cargo.toml`s - executing `cargo xrel-check check` should still work using the freshly "released" version of `esp-backtrace`.
41+
42+
Now lets see how a bad release looks like!
43+
44+
Bump the patch version of `esp-rom-sys` and change the name of the `init_syscall_table` function.
45+
46+
`cargo xrel-check update esp-rom-sys` will "release" this breaking update.
47+
48+
`cargo xrel-check check` should fail now because the test project will pickup the problematic patch release of `esp-rom-sys`.
49+
Even without changing anything anything in the test project.
50+
51+
When done: `cargo xtask rel-check deinit` and revert local changes
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[target.riscv32imac-unknown-none-elf]
2+
runner = "espflash flash --monitor --chip esp32c6"
3+
4+
[env]
5+
ESP_LOG="info"
6+
7+
[build]
8+
rustflags = [
9+
"-C", "link-arg=-Tlinkall.x",
10+
"-C", "force-frame-pointers",
11+
]
12+
13+
target = "riscv32imac-unknown-none-elf"
14+
15+
[unstable]
16+
build-std = ["alloc", "core"]

compile-tests/basic-c6/Cargo.toml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[package]
2+
edition = "2024"
3+
name = "basic-c6"
4+
rust-version = "1.88"
5+
version = "0.1.0"
6+
7+
[dependencies]
8+
esp-hal = { version = "1.0.0", features = ["esp32c6", "log-04", "unstable"] }
9+
10+
esp-rtos = { version = "0.2.0", features = [
11+
"embassy",
12+
"esp-alloc",
13+
"esp-radio",
14+
"esp32c6",
15+
"log-04",
16+
] }
17+
18+
esp-bootloader-esp-idf = { version = "0.4.0", features = ["esp32c6", "log-04"] }
19+
log = "0.4.27"
20+
21+
embassy-net = { version = "0.7.1", features = [
22+
"dhcpv4",
23+
"log",
24+
"medium-ethernet",
25+
"tcp",
26+
"udp",
27+
] }
28+
embedded-io = "0.7.1"
29+
embedded-io-async = "0.7.0"
30+
esp-alloc = "0.9.0"
31+
esp-backtrace = { version = "0.18.1", features = [
32+
"esp32c6",
33+
"panic-handler",
34+
"println",
35+
] }
36+
esp-println = { version = "0.16.1", features = ["esp32c6", "log-04"] }
37+
38+
embassy-executor = { version = "0.9.1", features = ["log"] }
39+
embassy-time = { version = "0.5.0", features = ["log"] }
40+
esp-radio = { version = "0.17.0", features = [
41+
"esp-alloc",
42+
"esp32c6",
43+
"log-04",
44+
"smoltcp",
45+
"unstable",
46+
"wifi",
47+
] }
48+
smoltcp = { version = "0.12.0", default-features = false, features = [
49+
"log",
50+
"medium-ethernet",
51+
"multicast",
52+
"proto-dhcpv4",
53+
"proto-dns",
54+
"proto-ipv4",
55+
"socket-dns",
56+
"socket-icmp",
57+
"socket-raw",
58+
"socket-tcp",
59+
"socket-udp",
60+
] }
61+
62+
critical-section = "1.2.0"
63+
static_cell = "2.1.1"
64+
65+
66+
[profile.dev]
67+
# Rust debug is too slow.
68+
# For debug builds always builds with some optimization
69+
opt-level = "s"
70+
71+
[profile.release]
72+
codegen-units = 1 # LLVM can perform better optimizations using a single thread
73+
debug = 2
74+
debug-assertions = false
75+
incremental = false
76+
lto = 'fat'
77+
opt-level = 's'
78+
overflow-checks = false

compile-tests/basic-c6/src/main.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![no_std]
2+
#![no_main]
3+
4+
use esp_backtrace as _;
5+
6+
extern crate alloc;
7+
8+
esp_bootloader_esp_idf::esp_app_desc!();
9+
10+
#[esp_rtos::main]
11+
async fn main(_spawner: embassy_executor::Spawner) -> ! {
12+
// nothing really here
13+
14+
loop {}
15+
}

xtask/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ preview-docs = ["dep:opener", "dep:rocket"]
5555
semver-checks = [ "dep:cargo-semver-checks", "dep:flate2", "dep:temp-file" ]
5656
release = ["semver-checks", "dep:opener", "dep:urlencoding", "dep:regex"]
5757
report = ["dep:regex"]
58+
rel-check = ["dep:regex"]

xtask/src/commands/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ mod check_changelog;
1717
pub mod generate_report;
1818
mod release;
1919
mod run;
20+
#[cfg(feature = "rel-check")]
21+
pub mod relcheck;
2022

2123
// ----------------------------------------------------------------------------
2224
// Subcommand Arguments

0 commit comments

Comments
 (0)