Skip to content

Commit

Permalink
Merge pull request #831 from knurling-rs/fix-ci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
Urhengulas authored May 13, 2024
2 parents cf4ca82 + bae9ace commit 97f6e80
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 24 deletions.
14 changes: 14 additions & 0 deletions .github/actions/update-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Update Rust"
description: "Update the Rust toolchain"
inputs:
toolchain:
required: true
default: "stable"
description: "The toolchain channel or version to use"
runs:
using: "composite"
steps:
- run: rustup update --no-self-update ${{ inputs.toolchain }}
shell: bash
- run: rustup default ${{ inputs.toolchain }}
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Check that changelog updated
uses: dangoslen/changelog-enforcer@v3
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use the latest stable release
run: rustup update stable && rustup default stable
uses: ./.github/actions/update-rust
- name: Install C libraries for tooling on ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install libudev-dev libusb-1.0-0-dev
Expand All @@ -36,38 +36,38 @@ jobs:
cross:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use the latest stable release
run: rustup update stable && rustup default stable
uses: ./.github/actions/update-rust
- name: Install Rust targets, build defmt crates for no_std targets, build defmt dependent crates for cortex-m targets, build panic-probe with different features
run: cargo xtask test-cross

lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use the latest stable release
run: rustup update stable && rustup default stable
uses: ./.github/actions/update-rust
- name: Run rustfmt & clippy
run: cargo xtask test-lint

ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use the latest stable release
run: rustup update stable && rustup default stable
uses: ./.github/actions/update-rust
- name: Install Rust stable, run all UI tests on the host
run: cargo xtask test-ui

mdbook:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use the latest stable release
run: rustup update stable && rustup default stable
uses: ./.github/actions/update-rust
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
Expand All @@ -83,9 +83,11 @@ jobs:
# - nightly # some tests use unstable features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use the latest stable release
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- uses: actions/checkout@v4
- name: Use the latest ${{ matrix.toolchain }} release
uses: ./.github/actions/update-rust
with:
toolchain: ${{ matrix.toolchain }}
- name: Install QEMU_TARGET
run: rustup target add ${{ env.QEMU_TARGET }}
- name: Install dependencies
Expand All @@ -96,11 +98,11 @@ jobs:
backcompat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use the latest stable release
run: rustup update stable && rustup default stable
uses: ./.github/actions/update-rust
- name: Install QEMU_TARGET
run: rustup target add ${{ env.QEMU_TARGET }}
- name: Install dependencies
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

- [#831]: Fix CI
- [#828]: `defmt-decoder`: Update to `gimli 0.29`
- [#821]: Cleanup
- [#813]: doc: add note for the alloc feature flag
- [#812]: `defmt`: Add a feature to stop linking a default panic handler
- [#811]: `book`: Add some examples for byte slice/array hints as well
- [#800]: `defmt-macros`: Fix generic trait bounds in Format derive macro

[#831]: https://github.com/knurling-rs/defmt/pull/831
[#828]: https://github.com/knurling-rs/defmt/pull/828
[#821]: https://github.com/knurling-rs/defmt/pull/821
[#813]: https://github.com/knurling-rs/defmt/pull/813
Expand Down
1 change: 1 addition & 0 deletions defmt/src/encoding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub struct Encoder {

impl Encoder {
/// Create a new `Encoder`.
#[allow(clippy::new_without_default)]
pub const fn new() -> Self {
Self {
inner: inner::Encoder::new(),
Expand Down
1 change: 1 addition & 0 deletions defmt/tests/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ fn c_like_enum() {
}

#[test]
#[allow(dead_code)]
fn uninhabited_enum() {
#[derive(Format)]
enum Void {}
Expand Down
16 changes: 8 additions & 8 deletions firmware/qemu/tests/defmt-test.out
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(1/8) running `change_init_struct`...
(2/8) running `test_for_changed_init_struct`...
(3/8) running `assert_true`...
(4/8) running `assert_imported_max`...
(5/8) running `result`...
(6/8) running `should_error`...
(7/8) ignoring `ignored`...
(8/8) running `fail`...
(1/9) running `change_init_struct`...
(2/9) running `test_for_changed_init_struct`...
(3/9) running `assert_true`...
(4/9) running `assert_imported_max`...
(5/9) running `result`...
(6/9) running `should_error`...
(7/9) ignoring `ignored`...
(8/9) running `fail`...
ERROR panicked at '`#[should_error]` test failed with outcome: Ok(this should have returned `Err`)'
9 changes: 9 additions & 0 deletions firmware/qemu/tests/defmt-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ mod tests {

Ok("this should have returned `Err`")
}

#[test]
fn assert_some_data() {
let a = SomeData {
elem1: 1,
elem2: 2.0,
};
assert_eq!(a.elem2, 2.0);
}
}

// like `panic-semihosting` but doesn't print to stdout (that would corrupt the defmt stream)
Expand Down

0 comments on commit 97f6e80

Please sign in to comment.