diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml new file mode 100644 index 000000000..515133509 --- /dev/null +++ b/.github/workflows/cargo.yml @@ -0,0 +1,25 @@ +name: rust format + +on: + push: + branches: [master] + pull_request: + merge_group: + + check-doc: + name: Check Documentation Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + target: thumbv7em-none-eabihf + - run: cargo doc --features=stm32f303xc + + cargo-deny: + name: Cargo Deny + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: EmbarkStudios/cargo-deny-action@v1 diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 000000000..87d77ef4e --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,20 @@ +on: + pull_request_target: + types: [labeled, unlabeled, opened, synchronize, reopened] + +name: Changelog check + +jobs: + changelog: + name: Changelog check + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Changelog updated + uses: Zomzog/changelog-checker@v1.3.0 + with: + fileName: CHANGELOG.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efc3fa338..d3cc7654e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: push: branches: [master] pull_request: + merge_group: jobs: check: @@ -38,177 +39,31 @@ jobs: # - stm32f334x6 # - stm32f334x8 steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: toolchain: stable target: thumbv7em-none-eabihf - override: true - profile: minimal - run: cargo build --features=${{ matrix.mcu }} --lib --examples - # This is our MSRV. However this is only for documentation - # purposes and should be increased if newer features are used. - # This should not stop anyone from bumping the MSRV. - check-msrv: - name: Check MSRV - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.59.0 - target: thumbv7em-none-eabihf - override: true - profile: minimal - - uses: actions-rs/cargo@v1 - with: - command: check - args: --features=stm32f303xc,stm32-usbd,rt,can,ld --lib - - check-min-deps: - name: Check Minimal Dependency Versions - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: thumbv7em-none-eabihf - override: true - profile: minimal - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - target: thumbv7em-none-eabihf - profile: minimal - - run: cargo +nightly update -Z minimal-versions - - uses: actions-rs/cargo@v1 - with: - command: check - args: --features=stm32f303xc,stm32-usbd,rt,can,ld --lib --examples - check-minimal-feature-set: name: Check minimal feature set runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: toolchain: stable target: thumbv7em-none-eabihf - override: true - profile: minimal - - uses: actions-rs/cargo@v1 - with: - command: check - args: --no-default-features --features=stm32f303xc --lib --examples + - run: cargo check --no-default-features --features=stm32f303xc --lib --examples build-testsuite: name: Build Testsuite runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable with: toolchain: stable target: thumbv7em-none-eabihf - override: true - profile: minimal - - uses: actions-rs/cargo@v1 - with: - command: test - args: -p testsuite --no-run - - check-doc: - name: Check Documentation Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - target: thumbv7em-none-eabihf - override: true - profile: minimal - - uses: actions-rs/cargo@v1 - with: - command: doc - args: --features=stm32f303xc - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: thumbv7em-none-eabihf - override: true - profile: minimal - components: clippy - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: > - --features=stm32f303xc --lib --examples - -- -D warnings - - rustfmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - profile: minimal - components: rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - codegen: - name: Check Codegen - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - profile: minimal - components: rustfmt - - run: cargo check --target "x86_64-unknown-linux-gnu" -p codegen - - markdown-lint: - name: Markdown Lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: nosborn/github-action-markdown-cli@v2.0.0 - with: - files: . - config_file: .markdownlint.yml - ignore_files: target/ - - link-checker: - name: Link Checker - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Check URLs in documentation - uses: lycheeverse/lychee-action@v1.0.8 - with: - args: --verbose --no-progress "**/*.md" "**/*.rs" "Cargo.toml" "**/Cargo.toml" -h accept=text/html - - cargo-deny: - name: Cargo Deny - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: EmbarkStudios/cargo-deny-action@v1 + - run: cargo test -p testsuite --no-run diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 000000000..3e3118a8f --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,21 @@ +name: clippy + +on: + push: + branches: [master] + pull_request: + merge_group: + +jobs: + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + target: thumbv7em-none-eabihf + components: clippy + - run: cargo clippy --features=stm32f303xc --lib --examples -- -D warnings + diff --git a/.github/workflows/codegen.yml b/.github/workflows/codegen.yml new file mode 100644 index 000000000..01e935d93 --- /dev/null +++ b/.github/workflows/codegen.yml @@ -0,0 +1,20 @@ +name: codegen +on: + push: + branches: [master] + pull_request: + merge_group: + +jobs: + codegen: + name: Check Codegen + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + component: clippy + target: x86_64-unknown-linux-gnu + - run: cargo clippy -p codegen --target x86_64-unknown-linux-gnu + diff --git a/.github/workflows/markdown.yml b/.github/workflows/markdown.yml new file mode 100644 index 000000000..164df0371 --- /dev/null +++ b/.github/workflows/markdown.yml @@ -0,0 +1,31 @@ +name: markdown + +on: + push: + branches: [master] + pull_request: + merge_group: + +jobs: + markdown-lint: + name: Markdown Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: nosborn/github-action-markdown-cli@v3.3.0 + with: + files: . + config_file: .markdownlint.yml + ignore_files: target/ + + link-checker: + name: Link Checker + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check URLs in documentation + uses: lycheeverse/lychee-action@v1.8.0 + with: + args: --verbose --no-progress "**/*.md" "**/*.rs" "Cargo.toml" "**/Cargo.toml" -h accept=text/html + diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml new file mode 100644 index 000000000..c7fd6e911 --- /dev/null +++ b/.github/workflows/msrv.yml @@ -0,0 +1,39 @@ +name: MSRV + +on: + push: + branches: [master] + pull_request: + merge_group: + +jobs: + # This is our MSRV. However this is only for documentation + # purposes and should be increased if newer features are used. + # This should not stop anyone from bumping the MSRV. + check-msrv: + name: Check MSRV + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.59.0 + target: thumbv7em-none-eabihf + - run: cargo check --features=stm32f303xc,stm32-usbd,rt,can,ld --lib + + check-min-deps: + name: Check Minimal Dependency Versions + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + target: thumbv7em-none-eabihf + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + target: thumbv7em-none-eabihf + - run: cargo +nightly update -Z minimal-versions + - run: cargo check --features=stm32f303xc,stm32-usbd,rt,can,ld --lib --examples + diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml new file mode 100644 index 000000000..4f65f58b7 --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,20 @@ +name: rust format + +on: + push: + branches: [master] + pull_request: + merge_group: + +jobs: + rustfmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: rustfmt + - run: cargo fmt --all --check + diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c2ab0a9..7130c0fda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Add `impl From for Switch` to reduce churn. - Fix undefined behavior in SPI implementation ([#346]) - Add `num_traits::PrimInt` bounds to `Word` +- Remove `Serial::split`, which possibly creates two mutable references two + one Serial instance, which could've caused UB. The use case of this function + was hard to find out anyway. ([#352]) ### Added @@ -599,6 +602,7 @@ let clocks = rcc [defmt]: https://github.com/knurling-rs/defmt [filter]: https://defmt.ferrous-systems.com/filtering.html +[#352]: https://github.com/stm32-rs/stm32f3xx-hal/pull/352 [#345]: https://github.com/stm32-rs/stm32f3xx-hal/pull/345 [#346]: https://github.com/stm32-rs/stm32f3xx-hal/pull/346 [#347]: https://github.com/stm32-rs/stm32f3xx-hal/pull/347 @@ -714,7 +718,6 @@ let clocks = rcc [v0.9.1]: https://github.com/stm32-rs/stm32f3xx-hal/releases/tag/v0.9.1 [v0.9.0]: https://github.com/stm32-rs/stm32f3xx-hal/releases/tag/v0.9.0 [v0.8.1]: https://github.com/stm32-rs/stm32f3xx-hal/releases/tag/v0.8.1 -[v0.8.1]: https://github.com/stm32-rs/stm32f3xx-hal/releases/tag/v0.8.1 [v0.8.0]: https://github.com/stm32-rs/stm32f3xx-hal/releases/tag/v0.8.0 [v0.7.0]: https://github.com/stm32-rs/stm32f3xx-hal/releases/tag/v0.7.0 [v0.6.1]: https://github.com/stm32-rs/stm32f3xx-hal/releases/tag/v0.6.1