Skip to content

Commit

Permalink
Merge pull request #817 from rust-embedded/regress-even-better
Browse files Browse the repository at this point in the history
regress even better
  • Loading branch information
burrbull authored Feb 24, 2024
2 parents 25c35b6 + 1b7e5e4 commit ee87aab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
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

0 comments on commit ee87aab

Please sign in to comment.