Skip to content

Commit

Permalink
xtask: add build-release and test-release (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipc authored Mar 19, 2024
1 parent f3432e9 commit 90f6573
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
toolchain: ${{matrix.rust_channel}}
- run: cargo xtask check
- run: cargo xtask test
- run: cargo xtask test-release

features:
runs-on: ubuntu-latest
Expand Down
10 changes: 9 additions & 1 deletion crates/rewrite/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ fn main() -> Result<()> {
let in_data = unsafe { memmap2::Mmap::map(&in_file) }
.with_context(|| format!("Failed to map input file '{}'", in_path.display()))?;
let in_data = &*in_data;
match object::FileKind::parse(in_data) {
Ok(object::FileKind::Elf32) | Ok(object::FileKind::Elf64) => {}
_ => return Ok(()),
}
let mut rewriter = rewrite::Rewriter::read(in_data)
.with_context(|| format!("Failed to parse input file '{}'", in_path.display()))?;

Expand Down Expand Up @@ -350,7 +354,11 @@ fn main() -> Result<()> {
fs::remove_file(out_path).ok();
}
}
format!("Failed to write output file '{}'", out_path.display())
format!(
"Failed to write output file '{}' from input '{}'",
out_path.display(),
in_path.display()
)
})?;
Ok(())
}
22 changes: 20 additions & 2 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,18 @@ type Task = (&'static str, fn() -> Result<(), DynError>, &'static str);
const TASKS: &[Task] = &[
("ci", cmd_ci, "runs everything in CI"),
("check", cmd_check, "checks everything"),
("build", cmd_build, "builds everything"),
("test", cmd_test, "tests everything"),
("build", cmd_build, "builds everything with dev profile"),
(
"build-release",
cmd_build_release,
"builds everything with release profile",
),
("test", cmd_test, "tests everything with dev profile"),
(
"test-release",
cmd_test_release,
"tests everything with release profile",
),
(
"test-update",
cmd_test_update,
Expand Down Expand Up @@ -83,10 +93,18 @@ fn cmd_build() -> Result<(), DynError> {
cargo(&["build", "--workspace", "--features", "all"])
}

fn cmd_build_release() -> Result<(), DynError> {
cargo(&["build", "--workspace", "--features", "all", "--release"])
}

fn cmd_test() -> Result<(), DynError> {
cargo(&["test", "--workspace", "--features", "all"])
}

fn cmd_test_release() -> Result<(), DynError> {
cargo(&["test", "--workspace", "--features", "all", "--release"])
}

fn cmd_test_update() -> Result<(), DynError> {
cargo_with(&["test", "--workspace", "--features", "all"], |cmd| {
cmd.env("OBJECT_TESTFILES_UPDATE", "1");
Expand Down

0 comments on commit 90f6573

Please sign in to comment.