-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from sevetis/main
[ci] update github actions to support Rust compile-time checks
- Loading branch information
Showing
3 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Cargo Test | ||
|
||
on: | ||
workflow_call: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUSTFLAGS: | ||
|
||
jobs: | ||
fmt: | ||
name: Rustfmt all packages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: rustfmt | ||
- name: Rustfmt Check | ||
run: cargo fmt --all -- --check | ||
|
||
make: | ||
name: Cargo Make | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
toolchain: nightly-2024-10-01 | ||
- name: Setup env | ||
run: | | ||
rustup component add llvm-tools-preview | ||
rustup target add riscv64imac-unknown-none-elf | ||
cargo install cargo-binutils | ||
- name: Cargo Make | ||
run: | | ||
rustc -vV | ||
cargo make --release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Check | ||
|
||
on: | ||
push: | ||
branches: [ "main", "dev" ] | ||
pull_request: | ||
branches: [ "main", "dev" ] | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
is_rust: ${{ steps.check_type.outputs.is_rust }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Determine Rust or C check | ||
id: check_type | ||
run: | | ||
PREV_SHA=$(git rev-parse HEAD^) | ||
if git diff --name-only $PREV_SHA ${{ github.sha }} | \ | ||
grep -qE '^(rust/|board/100ask-d1-h-rs/)'; then | ||
echo "::set-output name=is_rust::true" | ||
else | ||
echo "::set-output name=is_rust::false" | ||
fi | ||
cargo_check: | ||
needs: check | ||
if: ${{ needs.check.outputs.is_rust == 'true' }} | ||
uses: ./.github/workflows/Cargo.yml | ||
|
||
cmake_check: | ||
needs: check | ||
if: ${{ needs.check.outputs.is_rust == 'false' }} | ||
uses: ./.github/workflows/CMake.yml |