Skip to content

Commit

Permalink
separation of CI
Browse files Browse the repository at this point in the history
  • Loading branch information
romancardenas committed Nov 17, 2023
1 parent 612d58d commit edf4dac
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 40 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/clippy.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ master, add-riscv-rt ]
branches: [ master ]
pull_request:
merge_group:

Expand All @@ -14,28 +14,46 @@ jobs:
strategy:
matrix:
toolchain: [ stable, nightly ]
cargo_flags:
- "--no-default-features"
- "--all-features"
include:
# Nightly is only for reference and allowed to fail
- toolchain: nightly
experimental: true
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: Run clippy
run: cargo clippy --all ${{ matrix.cargo_flags }} -- -D warnings
- name: Run clippy (no features)
run: cargo clippy --all --no-default-features -- -D warnings
- name: Run clippy (all features)
run: cargo clippy --all --all-features -- -D warnings

# Additonal clippy checks for riscv-rt
clippy-riscv-rt:
strategy:
matrix:
toolchain: [ stable, nightly ]
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: Run clippy (s-mode)
run: cargo clippy --package riscv-rt --all --features=s-mode -- -D warnings
- name: Run clippy (single-hart)
run: cargo clippy --package riscv-rt --all --features=single-hart -- -D warnings

# Job to check that all the lint checks succeeded
clippy-check:
needs:
- clippy
- clippy-riscv-rt
runs-on: ubuntu-latest
if: always()
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
pull_request:
merge_group:

name: Build check
name: Build check (riscv-rt)

jobs:
build-riscv:
build:
strategy:
matrix:
# All generated code should be running on stable now, MRSV is 1.59.0
Expand All @@ -21,28 +21,31 @@ jobs:
example:
- empty
- multi_core
cargo_flags: [ "--no-default-features", "--all-features" ]
include:
# Nightly is only for reference and allowed to fail
- toolchain: nightly
experimental: true
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
- name: Build library
run: cargo build --target ${{ matrix.target }} ${{ matrix.cargo_flags }}
- name: Build example
run: RUSTFLAGS="-C link-arg=-Texamples/device.x" cargo build --target ${{ matrix.target }} --example ${{ matrix.example }} ${{ matrix.cargo_flags }}
- name: Build (no features)
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }}
- name : Build example (s-mode)
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --features=s-mode
- name : Build example (single-hart)
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --features=single-hart
- name: Build example (all features)
run: RUSTFLAGS="-C link-arg=-Triscv-rt/examples/device.x" cargo build --package riscv-rt --target ${{ matrix.target }} --example ${{ matrix.example }} --all-features

# Job to check that all the builds succeeded
build-check:
needs:
- build-riscv
- build
runs-on: ubuntu-latest
if: always()
steps:
Expand Down
34 changes: 12 additions & 22 deletions .github/workflows/build.yaml → .github/workflows/riscv.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
on:
push:
branches: [ master, add-riscv-rt ]
branches: [ master ]
pull_request:
merge_group:

name: Build check
name: Build check (riscv)

jobs:
# We check that the crate builds and links for all the toolchains and targets.
Expand All @@ -13,52 +13,42 @@ jobs:
matrix:
# All generated code should be running on stable now, MRSV is 1.59.0
toolchain: [ stable, nightly, 1.60.0 ]
package:
- riscv
- riscv-rt
target:
- riscv32i-unknown-none-elf
- riscv32imc-unknown-none-elf
- riscv32imac-unknown-none-elf
- riscv64imac-unknown-none-elf
- riscv64gc-unknown-none-elf
cargo_flags: [ "--no-default-features", "--all-features" ]
include:
# Nightly is only for reference and allowed to fail
- toolchain: nightly
experimental: true
- package: riscv-rt
cargo_flags:
- "--features=s-mode"
- "--features=single-hart"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
- name: Build library
run: cargo build --package ${{ matrix.package }} --target ${{ matrix.target }} ${{ matrix.cargo_flags }}
- name: Build (no features)
run: cargo build --package riscv --target ${{ matrix.target }}
- name: Build (all features)
run: cargo build --package riscv --target ${{ matrix.target }} --all-features

# On MacOS, Ubuntu, and Windows, we at least make sure that the crate builds and links.
build-others:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
package:
- riscv
cargo_flags: [ "--no-default-features", "--all-features" ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Build crate for host OS
run: cargo build --package ${{ matrix.package }} ${{ matrix.cargo_flags }}
- name: Build (no features)
run: cargo build --package riscv
- name: Build (all features)
run: cargo build --package riscv --all-features

# Job to check that all the builds succeeded
build-check:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rustfmt.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ master, add-riscv-rt ]
branches: [ master ]
pull_request:
merge_group:

Expand All @@ -10,7 +10,7 @@ jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
Expand Down

0 comments on commit edf4dac

Please sign in to comment.