-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: warn on outdated top level dependencies #757
Merged
+118
−2
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
504b443
mark: 0xaatif/outdated
0xaatif 46af7c5
run: cargo init scripts
0xaatif d8bd536
feat: cargo xtask outdated
0xaatif 9177acf
ci: lint outdated
0xaatif a0cc81d
chore: update description
0xaatif 7f83d19
fix(ci): pin kurtosis version
0xaatif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I am starting to feel just slightly uncomfortable about number of external GithubAction dependencies we are including in our CI. |
||
with: | ||
tool: cargo-outdated | ||
- run: cargo xtask outdated |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//! 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. | ||
/// | ||
/// 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, | ||
} | ||
|
||
#[derive(Deserialize)] | ||
struct Outdated<'a> { | ||
crate_name: &'a str, | ||
dependencies: Vec<Dependency<'a>>, | ||
} | ||
|
||
#[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::<Outdated<'_>>() | ||
.collect::<Result<Vec<_>, _>>() | ||
.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(()) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you could probably use
@v4
here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update all of these at once: #759