forked from esp-rs/esp-hal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Use an action to remove duplication
- Loading branch information
1 parent
6268510
commit 3481ab8
Showing
3 changed files
with
125 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Build and Check | ||
description: Build and check the esp-hal and esp-lp-hal pacakges for a specified device | ||
inputs: | ||
device: | ||
description: "Device SOC" | ||
required: true | ||
target: | ||
description: "Target" | ||
required: true | ||
toolchain: | ||
description: "Toolchain channel" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up cargo environment | ||
shell: bash | ||
run: | | ||
# Convert the target triple from kebab-case to SCREAMING_SNAKE_CASE: | ||
big_target=$(echo "${{ matrix.device.target }}" | tr [:lower:] [:upper:] | tr '-' '_') | ||
# Set the *target specific* RUSTFLAGS for the current device: | ||
echo "CARGO_TARGET_${big_target}_RUSTFLAGS=-Dwarnings" >> $GITHUB_ENV | ||
# Linting toolchain (stable cant build documentation) | ||
if [ "${{ inputs.toolchain }}" == "nightly" ]; then | ||
echo "LINTING_TOOLCHAIN=+nightly" >> $GITHUB_ENV | ||
else | ||
echo "LINTING_TOOLCHAIN=+esp" >> $GITHUB_ENV | ||
fi | ||
# Clippy and docs checks | ||
- name: Clippy | ||
shell: bash | ||
run: cargo $LINTING_TOOLCHAIN xtask lint-packages --chips ${{ inputs.device }} | ||
- name: Check doc-tests | ||
shell: bash | ||
run: cargo $LINTING_TOOLCHAIN xtask run-doc-test esp-hal ${{ inputs.device }} | ||
- name: Check documentation | ||
shell: bash | ||
run: cargo $LINTING_TOOLCHAIN xtask build-documentation --packages esp-hal --chips ${{ inputs.device }} | ||
# Build all supported examples for the low-power core first (if present): | ||
- name: Build prerequisite examples (esp-lp-hal) | ||
shell: bash | ||
if: contains(fromJson('["esp32c6", "esp32s2", "esp32s3"]'), inputs.device) | ||
run: cargo +${{ inputs.toolchain }} xtask build-examples esp-lp-hal ${{ inputs.device }} | ||
- name: Check esp-lp-hal documentation | ||
shell: bash | ||
if: contains(fromJson('["esp32c6", "esp32s2", "esp32s3"]'), inputs.device) | ||
run: cargo $LINTING_TOOLCHAIN xtask build-documentation --packages esp-lp-hal --chips ${{ inputs.device }} | ||
# Make sure we're able to build the HAL without the default features | ||
# enabled: | ||
- name: Build (no features) | ||
shell: bash | ||
run: | | ||
cargo xtask build-package \ | ||
--no-default-features \ | ||
--toolchain=${{ inputs.toolchain }} \ | ||
--features=${{ inputs.device }} \ | ||
--target=${{ inputs.target }} \ | ||
esp-hal | ||
- name: Build (examples) | ||
shell: bash | ||
run: cargo +${{ inputs.toolchain }} xtask build-examples esp-hal ${{ inputs.device }} |
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,57 @@ | ||
name: CI - nightly | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches-ignore: | ||
- "gh-readonly-queue/**" | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RUSTDOCFLAGS: -Dwarnings | ||
|
||
jobs: | ||
|
||
esp-hal-nightly: | ||
name: esp-hal | nightly (${{ matrix.device.soc }}) | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
env: | ||
SSID: SSID | ||
PASSWORD: PASSWORD | ||
STATIC_IP: 1.1.1.1 | ||
GATEWAY_IP: 1.1.1.1 | ||
HOST_IP: 1.1.1.1 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
device: [ | ||
# RISC-V devices: | ||
{ soc: "esp32c2", target: "riscv32imc-unknown-none-elf" }, | ||
{ soc: "esp32c3", target: "riscv32imc-unknown-none-elf" }, | ||
{ soc: "esp32c6", target: "riscv32imac-unknown-none-elf" }, | ||
{ soc: "esp32h2", target: "riscv32imac-unknown-none-elf" }, | ||
] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Install the Rust nightly toolchain for RISC-V devices: | ||
- uses: dtolnay/rust-toolchain@v1 | ||
with: | ||
target: riscv32imc-unknown-none-elf,riscv32imac-unknown-none-elf | ||
toolchain: nightly | ||
components: rust-src, clippy, rustfmt | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Build and Check | ||
uses: ./.github/actions/check-packages | ||
with: | ||
device: ${{ matrix.device.soc }} | ||
target: ${{ matrix.device.target }} | ||
toolchain: nightly |