Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 42 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,63 @@ jobs:
# Verify

verify:
name: "Check ${{ matrix.chip }}"
runs-on: ubuntu-latest
runs-on: macos-m1-self-hosted

strategy:
fail-fast: false
matrix:
chip: [esp32, esp32c2, esp32c3, esp32c6, esp32h2, esp32s2, esp32s3]
# chip: [esp32, esp32c2, esp32c3, esp32c6, esp32h2, esp32s2, esp32s3]

steps:
- uses: actions/checkout@v4

# Rust toolchain for Xtensa:
- if: ${{ contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.chip) }}
uses: esp-rs/[email protected]
# # Rust toolchain for Xtensa:
# - if: ${{ contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.chip) }}
# uses: esp-rs/[email protected]
# with:
# default: true
# buildtargets: ${{ matrix.chip }}
# ldproxy: false

# # Rust toolchain for RISC-V:
# - if: ${{ !contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.chip) }}
# uses: dtolnay/rust-toolchain@stable
# with:
# target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
# components: clippy,rustfmt,rust-src

# # Rust toolchain for RISC-V:
# - if: ${{ !contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.chip) }}
# uses: dtolnay/rust-toolchain@nightly
# with:
# target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
# components: clippy,rustfmt,rust-src

# Install the Rust toolchain for Xtensa devices:
- uses: esp-rs/[email protected]
with:
default: true
buildtargets: ${{ matrix.chip }}
ldproxy: false
version: 1.90.0.0

# Rust toolchain for RISC-V:
- if: ${{ !contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.chip) }}
uses: dtolnay/rust-toolchain@stable
# Install the Rust stable toolchain for RISC-V devices:
- uses: dtolnay/rust-toolchain@v1
with:
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
components: clippy,rustfmt,rust-src
toolchain: stable
components: rust-src

# Rust toolchain for RISC-V:
- if: ${{ !contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.chip) }}
uses: dtolnay/rust-toolchain@nightly
with:
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf
components: clippy,rustfmt,rust-src
# Prepare cargo-batch
- name: Setup cargo-batch
run: |
if ! command -v cargo-batch &> /dev/null; then
cargo install --git https://github.com/embassy-rs/cargo-batch cargo --bin cargo-batch --locked --force
fi
Comment on lines +86 to +88
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't do this on the normal runners, the xtask should detect if cargo-batch is present and fall back to individual cargo commands otherwise, just like we do for esp-hal. forcing cargo-batch is not the best idea (what if you simply don't want it on your PC, or what if your antivirus decides to remove it suddenly?), we have the code to somewhat smartly generate the commands.


# //Define a new environment variable called toolchain
- if: ${{ contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.chip) }}
run: echo "TOOLCHAIN=+esp" >> $GITHUB_ENV
# # //Define a new environment variable called toolchain
# - if: ${{ contains(fromJson('["esp32", "esp32s2", "esp32s3"]'), matrix.chip) }}
# run: echo "TOOLCHAIN=+esp" >> $GITHUB_ENV

- uses: Swatinem/rust-cache@v2

- name: Generate and check project
run: cargo ${{ env.TOOLCHAIN }} xtask check ${{ matrix.chip }} ${{ fromJSON('["", "--all-combinations"]')[inputs.all_combinations || github.event_name == 'schedule'] }} ${{ fromJSON('["", "--build"]')[inputs.build || github.event_name == 'schedule'] }}
run: cargo xtask check-all
# run: cargo ${{ env.TOOLCHAIN }} xtask check ${{ matrix.chip }} --all-combinations --build

- if: github.event_name == 'schedule'
name: Run cargo-package
Expand Down
7 changes: 7 additions & 0 deletions template/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ rustflags = [
#IF option("stack-smashing-protection")
"-Z", "stack-protector=all",
#ENDIF
#IF option("defmt")
"-C", "link-arg=-Tdefmt.x",
#ENDIF
#IF option("embedded-test")
"-C", "link-arg=-Tembedded-test.x",
#ENDIF
"-C", "link-arg=-Tlinkall.x",
]

#REPLACE riscv32imac-unknown-none-elf rust_target
Expand Down
1 change: 1 addition & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ esp-generate = { path = "..", default-features = false }
log = "0.4.28"
tempfile = "3.23.0"
serde_yaml = "0.9.33"
strum = { version = "0.27.1", features = ["derive"] }
Loading
Loading