Skip to content
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

regress even better #817

Merged
merged 3 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ on:
jobs:
generate:
name: |
Generate matrix. ${{ github.event.comment.user.name }}: ${{ github.event.comment.author_association}}
Generate matrix.
runs-on: ubuntu-latest
outputs:
diffs: ${{ steps.regress-ci.outputs.diffs }}
if: github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && (contains(toJson(github.event.comment.body), '\n/ci') || startsWith(github.event.comment.body, '/ci'))
if: contains(toJson(github.event.comment.body), '\n/ci') || startsWith(github.event.comment.body, '/ci')
steps:
- name: Is member
run: |
if [[ "${{ github.event.comment.author_association }}" != "MEMBER" && "${{ github.event.comment.author_association }}" != "OWNER" ]]; then
exit 1
fi

- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@master
Expand Down
2 changes: 1 addition & 1 deletion ci/svd2rust-regress/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl Diffing {

let test = match (tests.len(), self.sub.as_ref(), self.url.as_ref()) {
(1, _, None) => tests[0].clone(),
(_, Some(DiffingMode::Pr { .. }), None) => tests
(_, Some(DiffingMode::Pr { .. } | DiffingMode::Semver { .. }), None) => tests
.iter()
.find(|t| t.chip == "STM32F103")
.map(|t| (*t).clone())
Expand Down
7 changes: 7 additions & 0 deletions ci/svd2rust-regress/src/svd_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ impl TestCase {
self.name(),
chip_dir.display()
);
// XXX: Workaround for https://github.com/rust-lang/cargo/issues/6009#issuecomment-1925445245
let manifest_path = crate::get_cargo_workspace().join("Cargo.toml");
let workspace_toml =
fs::read(&manifest_path).context("failed to read workspace Cargo.toml")?;
Command::new("cargo")
.env("USER", user)
.arg("init")
Expand All @@ -201,6 +205,9 @@ impl TestCase {
.arg(&chip_dir)
.capture_outputs(true, "cargo init", None, None, &[])
.with_context(|| "Failed to cargo init")?;
std::fs::write(manifest_path, workspace_toml)
.context("failed to write workspace Cargo.toml")?;

let svd_toml = path_helper_base(&chip_dir, &["Cargo.toml"]);
let mut file = OpenOptions::new()
.write(true)
Expand Down
Loading