Skip to content

Commit

Permalink
Add semver-checks test (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 committed Apr 9, 2023
1 parent 2101ab6 commit 24af65d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- uses: actions/checkout@v3
- run: rustup install nightly
- run: rustup component add --toolchain=nightly clippy miri rustfmt
- run: cargo +nightly install cargo-semver-checks
- name: cd lib && cargo +nightly fmt -- --check
run: cargo +nightly fmt -- --check
working-directory: lib
Expand Down Expand Up @@ -138,6 +139,15 @@ jobs:
run: cargo +nightly bench
working-directory: lib
- run: cd bin && ./bench.sh +nightly
- name: cd lib && cargo +nightly semver-checks check-release
run: cargo +nightly semver-checks check-release
working-directory: lib
- name: cd lib/macro/internal && cargo +nightly semver-checks check-release
run: cargo +nightly semver-checks check-release
working-directory: lib/macro/internal
- name: cd lib/macro && cargo +nightly semver-checks check-release
run: cargo +nightly semver-checks check-release
working-directory: lib/macro
- name: cd lib && cargo +nightly audit --deny=warnings
run: cargo +nightly audit --deny=warnings
working-directory: lib
Expand Down
17 changes: 17 additions & 0 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ enum Task {
#[strum(serialize = "bench")]
Bench,

#[strum(serialize = "semver-checks")]
SemverChecks,

#[strum(serialize = "audit")]
Audit,
}
Expand All @@ -113,6 +116,7 @@ impl Action {
(Task::Clippy, _) => &["--", "--deny=warnings"],
(Task::Build, Dir::Nostd) => &["--release"],
(Task::Miri, _) => &["test"],
(Task::SemverChecks, _) => &["check-release"],
(Task::Audit, _) => &["--deny=warnings"],
_ => &[],
};
Expand Down Expand Up @@ -372,6 +376,15 @@ impl Flags {
}
job.steps.push(WorkflowStep { run: Some(run), ..Default::default() });
}
if actions.iter().find(|x| matches!(x.task, Task::SemverChecks)).is_some() {
job.steps.push(WorkflowStep {
run: Some(format!(
"cargo +{} install cargo-semver-checks",
actions[0].toolchain
)),
..Default::default()
});
}
for action in actions {
for instruction in action.interpret().0 {
job.steps
Expand Down Expand Up @@ -432,6 +445,10 @@ impl Actions {
// Bench is only supported for lib and bin.
continue;
}
if task == Task::SemverChecks && (!dir.is_published() || matches!(dir, Dir::Bin)) {
// SemverChecks only makes sense for published library crates.
continue;
}
let os = Os::Ubuntu;
let toolchain = Toolchain::Nightly;
actions.insert(Action { os, toolchain, task, dir });
Expand Down

0 comments on commit 24af65d

Please sign in to comment.