-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4221 from wasmerio/bump-msrv
Bump the MSRV from 1.69 to 1.70
- Loading branch information
Showing
21 changed files
with
194 additions
and
87 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
|
||
env: | ||
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git | ||
MSRV: "1.67" | ||
MSRV: "1.70" | ||
|
||
jobs: | ||
run_benchmark: | ||
|
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Release cloudcompiler.wasm | |
|
||
env: | ||
RUST_BACKTRACE: 1 | ||
MSRV: "1.67" | ||
MSRV: "1.70" | ||
|
||
on: | ||
push: | ||
|
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
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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
1.69 | ||
1.70 |
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,119 @@ | ||
//! Integration tests which makes sure various parts of the project (CI, | ||
//! Dockerfiles, etc.) are all using the Rust version specified in `/Cargo.toml`. | ||
use std::path::Path; | ||
|
||
use once_cell::sync::Lazy; | ||
use regex::Regex; | ||
|
||
static MSRV: Lazy<String> = Lazy::new(|| { | ||
let cargo_toml = project_root().join("Cargo.toml"); | ||
let contents = std::fs::read_to_string(cargo_toml).unwrap(); | ||
let rust_version_line = contents | ||
.lines() | ||
.find(|line| line.contains("rust-version") && line.contains('"')) | ||
.unwrap(); | ||
let pieces: Vec<_> = rust_version_line.split('"').collect(); | ||
let [_, msrv, _] = pieces.as_slice() else { | ||
panic!(); | ||
}; | ||
|
||
msrv.to_string() | ||
}); | ||
|
||
#[test] | ||
fn docker_file_is_up_to_date() { | ||
let pattern = Regex::new(r"1\.\d\d").unwrap(); | ||
let dockerfile = project_root() | ||
.join(".github") | ||
.join("cross-linux-riscv64") | ||
.join("Dockerfile"); | ||
|
||
let contents = std::fs::read_to_string(&dockerfile).unwrap(); | ||
let expected = pattern.replace_all(&contents, MSRV.as_str()); | ||
|
||
ensure_file_contents(dockerfile, expected); | ||
} | ||
|
||
#[test] | ||
fn rust_toolchain_file_is_up_to_date() { | ||
let pattern = Regex::new(r"1\.\d\d").unwrap(); | ||
let rust_toolchain = project_root().join("rust-toolchain"); | ||
|
||
let contents = std::fs::read_to_string(&rust_toolchain).unwrap(); | ||
let expected = pattern.replace_all(&contents, MSRV.as_str()); | ||
|
||
ensure_file_contents(rust_toolchain, expected); | ||
} | ||
|
||
#[test] | ||
fn wasi_web_is_up_to_date() { | ||
let pattern = Regex::new(r#"rust-version\s*=\s*"\d\.\d\d""#).unwrap(); | ||
let rust_toolchain = project_root() | ||
.join("lib") | ||
.join("wasi-web") | ||
.join("Cargo.toml"); | ||
|
||
let replacement = format!("rust-version = \"{}\"", MSRV.as_str()); | ||
let contents = std::fs::read_to_string(&rust_toolchain).unwrap(); | ||
let expected = pattern.replace_all(&contents, replacement); | ||
|
||
ensure_file_contents(rust_toolchain, expected); | ||
} | ||
|
||
#[test] | ||
fn ci_files_are_up_to_date() { | ||
let pattern = Regex::new(r#"MSRV:\s*"\d+\.\d+""#).unwrap(); | ||
let replacement = format!("MSRV: \"{}\"", MSRV.as_str()); | ||
let workflows = project_root().join(".github").join("workflows"); | ||
|
||
for result in workflows.read_dir().unwrap() { | ||
let path = result.unwrap().path(); | ||
|
||
let contents = std::fs::read_to_string(&path).unwrap(); | ||
let expected = pattern.replace_all(&contents, &replacement); | ||
|
||
ensure_file_contents(path, expected); | ||
} | ||
} | ||
|
||
/// Get the root directory for this repository. | ||
fn project_root() -> &'static Path { | ||
Path::new(env!("CARGO_MANIFEST_DIR")) | ||
.ancestors() | ||
.nth(3) | ||
.unwrap() | ||
} | ||
|
||
/// Check that a particular file has the desired contents. | ||
/// | ||
/// If the file is missing or outdated, this function will update the file and | ||
/// trigger a panic to fail any test this is called from. | ||
fn ensure_file_contents(path: impl AsRef<Path>, contents: impl AsRef<str>) { | ||
let path = path.as_ref(); | ||
let contents = contents.as_ref(); | ||
|
||
if let Ok(old_contents) = std::fs::read_to_string(path) { | ||
if contents == old_contents { | ||
// File is already up to date | ||
return; | ||
} | ||
} | ||
|
||
let display_path = path.strip_prefix(project_root()).unwrap_or(path); | ||
|
||
eprintln!("{} was not up-to-date, updating...", display_path.display()); | ||
|
||
if std::env::var("CI").is_ok() { | ||
eprintln!("Note: run `cargo test` locally and commit the updated files"); | ||
} | ||
|
||
if let Some(parent) = path.parent() { | ||
let _ = std::fs::create_dir_all(parent); | ||
} | ||
std::fs::write(&path, contents).unwrap(); | ||
panic!( | ||
"\"{}\" was not up to date and has been updated. Please commit the changes and re-run the tests.", | ||
path.strip_prefix(project_root()).unwrap_or(path).display() | ||
); | ||
} |
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