Add ci workflow #4
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
name: Build Template | |
on: | |
push: | |
branches: [ "*" ] | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
branches: [ "*" ] | |
paths-ignore: | |
- "**.md" | |
env: | |
CARGO_TERM_COLOR: always | |
PROJECT_NAME: ch32-blink | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cargo-generate/cargo-generate-action@latest | |
with: | |
name: ${{ env.PROJECT_NAME }} | |
arguments: "--define mcu_family=ch32v003" | |
# we need to move the generated project to a temp folder, away from the template project | |
# otherwise `cargo` runs would fail | |
# see https://github.com/rust-lang/cargo/issues/9922 | |
- run: | | |
mv $PROJECT_NAME ${{ runner.temp }}/ | |
- name: Use nightly Rust | |
run: | | |
cd ${{ runner.temp }}/$PROJECT_NAME | |
rustup default nightly | |
rustup component add rust-src | |
rustup update | |
rustup target add riscv32imac-unknown-none-elf | |
rustup target add riscv32imafc-unknown-none-elf | |
rustup target add riscv32i-unknown-none-elf | |
# See https://github.com/rust-lang/rust/issues/12880 | |
touch ~/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/Cargo.lock | |
- run: | | |
cd ${{ runner.temp }}/$PROJECT_NAME | |
cargo build --release | |