From 504b4430f35c69a6dfc5c062544866d78056ce3c Mon Sep 17 00:00:00 2001 From: 0xaatif Date: Tue, 29 Oct 2024 15:46:09 +0000 Subject: [PATCH 1/6] mark: 0xaatif/outdated From 46af7c567753c9194dfb1368c09b40aa0d312638 Mon Sep 17 00:00:00 2001 From: 0xaatif Date: Tue, 29 Oct 2024 15:46:55 +0000 Subject: [PATCH 2/6] run: cargo init scripts --- Cargo.toml | 2 +- scripts/Cargo.toml | 14 ++++++++++++++ scripts/src/main.rs | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 scripts/Cargo.toml create mode 100644 scripts/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 3b038ff26..ecf996088 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = [ "compat", "evm_arithmetization", "mpt_trie", - "proc_macro", + "proc_macro", "scripts", "smt_trie", "trace_decoder", "zero", diff --git a/scripts/Cargo.toml b/scripts/Cargo.toml new file mode 100644 index 000000000..8a18fd587 --- /dev/null +++ b/scripts/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "scripts" +version = "0.1.0" +edition.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true +keywords.workspace = true +categories.workspace = true + +[dependencies] + +[lints] +workspace = true diff --git a/scripts/src/main.rs b/scripts/src/main.rs new file mode 100644 index 000000000..e7a11a969 --- /dev/null +++ b/scripts/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} From d8bd536ea597bdd6050feb11f7ef7b21c5d87b99 Mon Sep 17 00:00:00 2001 From: 0xaatif Date: Tue, 29 Oct 2024 16:08:09 +0000 Subject: [PATCH 3/6] feat: cargo xtask outdated --- .cargo/config.toml | 3 +++ Cargo.lock | 10 +++++++ Cargo.toml | 3 ++- scripts/Cargo.toml | 13 +++++++-- scripts/src/main.rs | 3 --- scripts/xtask.rs | 65 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 6 deletions(-) delete mode 100644 scripts/src/main.rs create mode 100644 scripts/xtask.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index 6340ce34a..ace541bb4 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -2,3 +2,6 @@ # https://github.com/rust-lang/rust/pull/124129 # https://github.com/dtolnay/linkme/pull/88 rustflags = ["-Z", "linker-features=-lld"] + +[alias] +xtask = ["run", "--package=xtask", "--"] diff --git a/Cargo.lock b/Cargo.lock index 0dc5ace4d..bc83b02b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5856,6 +5856,16 @@ dependencies = [ "time", ] +[[package]] +name = "xtask" +version = "0.0.0" +dependencies = [ + "anyhow", + "clap", + "serde", + "serde_json", +] + [[package]] name = "yansi" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index ecf996088..117f124b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,8 @@ members = [ "compat", "evm_arithmetization", "mpt_trie", - "proc_macro", "scripts", + "proc_macro", + "scripts", "smt_trie", "trace_decoder", "zero", diff --git a/scripts/Cargo.toml b/scripts/Cargo.toml index 8a18fd587..d4328f96c 100644 --- a/scripts/Cargo.toml +++ b/scripts/Cargo.toml @@ -1,14 +1,23 @@ [package] -name = "scripts" -version = "0.1.0" +name = "xtask" +version = "0.0.0" edition.workspace = true license.workspace = true repository.workspace = true homepage.workspace = true keywords.workspace = true categories.workspace = true +publish = false [dependencies] +anyhow.workspace = true +clap = { workspace = true, features = ["derive"] } +serde = { workspace = true, features = ["derive"] } +serde_json.workspace = true [lints] workspace = true + +[[bin]] +name = "xtask" +path = "xtask.rs" diff --git a/scripts/src/main.rs b/scripts/src/main.rs deleted file mode 100644 index e7a11a969..000000000 --- a/scripts/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/scripts/xtask.rs b/scripts/xtask.rs new file mode 100644 index 000000000..be99f20a0 --- /dev/null +++ b/scripts/xtask.rs @@ -0,0 +1,65 @@ +//! General purpose scripts for development + +use std::process::{Command, Stdio}; + +use anyhow::{ensure, Context as _}; +use clap::Parser; +use serde::Deserialize; + +#[derive(Parser)] +enum Args { + /// Run `cargo-outdated`, printing warnings compatible with GitHub's CI. + /// + /// Note that we only warn on our _direct_ dependencies. + Outdated, +} + +#[derive(Deserialize)] +struct Outdated<'a> { + crate_name: &'a str, + dependencies: Vec>, +} + +#[derive(Deserialize)] +struct Dependency<'a> { + name: &'a str, + project: &'a str, + latest: &'a str, +} + +fn main() -> anyhow::Result<()> { + match Args::parse() { + Args::Outdated => { + let output = Command::new("cargo") + .args(["outdated", "--root-deps-only", "--format=json"]) + .stderr(Stdio::inherit()) + .stdout(Stdio::piped()) + .output() + .context("couldn't exec `cargo`")?; + ensure!( + output.status.success(), + "command failed with {}", + output.status + ); + for Outdated { + crate_name, + dependencies, + } in serde_json::Deserializer::from_slice(&output.stdout) + .into_iter::>() + .collect::, _>>() + .context("failed to parse output from `cargo outdated`")? + { + for Dependency { + name, + project, + latest, + } in dependencies + { + // https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-a-warning-message + println!("::warning title=outdated-dependency::dependency {name} of crate {crate_name} is at version {project}, but the latest is {latest}") + } + } + } + } + Ok(()) +} From 9177acfe589384cf98e4b258923c205593a7fd8f Mon Sep 17 00:00:00 2001 From: 0xaatif Date: Tue, 29 Oct 2024 16:10:30 +0000 Subject: [PATCH 4/6] ci: lint outdated --- .github/workflows/lint.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 13089b3d0..9999d76f8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -66,3 +66,13 @@ jobs: with: tool: taplo-cli - run: taplo fmt --check + outdated: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/rust + - uses: taiki-e/install-action@v2 + with: + tool: cargo-outdated + - run: cargo xtask outdated From a0cc81ddeee10c645dced4910e189ee6430f9843 Mon Sep 17 00:00:00 2001 From: 0xaatif Date: Wed, 30 Oct 2024 16:49:14 +0000 Subject: [PATCH 5/6] chore: update description --- scripts/xtask.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/xtask.rs b/scripts/xtask.rs index be99f20a0..c60770e28 100644 --- a/scripts/xtask.rs +++ b/scripts/xtask.rs @@ -10,7 +10,11 @@ use serde::Deserialize; enum Args { /// Run `cargo-outdated`, printing warnings compatible with GitHub's CI. /// - /// Note that we only warn on our _direct_ dependencies. + /// If a direct dependency listed in our Cargo.lock is behind the latest + /// available on crates-io, a warning will be emitted. + /// + /// Note that we only warn on our _direct_ dependencies, + /// not the entire supply chain. Outdated, } From 7f83d19b1a98e28344f03298bbfa89bc10dfada9 Mon Sep 17 00:00:00 2001 From: 0xaatif Date: Wed, 30 Oct 2024 16:59:43 +0000 Subject: [PATCH 6/6] fix(ci): pin kurtosis version --- .github/workflows/jerigon-native.yml | 2 +- .github/workflows/jerigon-zero.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/jerigon-native.yml b/.github/workflows/jerigon-native.yml index 1ef443d9d..dbb7cdecd 100644 --- a/.github/workflows/jerigon-native.yml +++ b/.github/workflows/jerigon-native.yml @@ -52,7 +52,7 @@ jobs: run: | echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list sudo apt update - sudo apt install kurtosis-cli + sudo apt install kurtosis-cli=1.3.1 #It is much easier to use cast tool in scripts so install foundry - name: Install Foundry diff --git a/.github/workflows/jerigon-zero.yml b/.github/workflows/jerigon-zero.yml index e0dc4c40f..034c6b0cd 100644 --- a/.github/workflows/jerigon-zero.yml +++ b/.github/workflows/jerigon-zero.yml @@ -52,7 +52,7 @@ jobs: run: | echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list sudo apt update - sudo apt install kurtosis-cli + sudo apt install kurtosis-cli=1.3.1 #It is much easier to use cast tool in scripts so install foundry - name: Install Foundry