From 440248c011a0efdd9a59d0e5d206d68ba0baa544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sat, 24 Feb 2024 12:14:30 +0100 Subject: [PATCH 1/3] semver has a default chip --- ci/svd2rust-regress/src/diff.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/svd2rust-regress/src/diff.rs b/ci/svd2rust-regress/src/diff.rs index a2e132ff..3220157f 100644 --- a/ci/svd2rust-regress/src/diff.rs +++ b/ci/svd2rust-regress/src/diff.rs @@ -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()) From a351921cc1dbb89a00a1726620954f06535692cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sat, 24 Feb 2024 12:14:49 +0100 Subject: [PATCH 2/3] workaround cargo issue --- ci/svd2rust-regress/src/svd_test.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ci/svd2rust-regress/src/svd_test.rs b/ci/svd2rust-regress/src/svd_test.rs index 13bb6648..1ea01f2e 100644 --- a/ci/svd2rust-regress/src/svd_test.rs +++ b/ci/svd2rust-regress/src/svd_test.rs @@ -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") @@ -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) From 1b7e5e47adf37e669d92c53c34575fac82b03ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sat, 24 Feb 2024 12:17:25 +0100 Subject: [PATCH 3/3] check for membership later, since the check seems to not work --- .github/workflows/diff.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/diff.yml b/.github/workflows/diff.yml index 2ab5dc72..a055ddec 100644 --- a/.github/workflows/diff.yml +++ b/.github/workflows/diff.yml @@ -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