Skip to content

Add ci workflow

Add ci workflow #3

Workflow file for this run

name: Build Template
on:
push:
branches: [ "*" ]
paths-ignore:
- "**.md"
pull_request:
branches: [ "*" ]
paths-ignore:
- "**.md"
env:
CARGO_TERM_COLOR: always
PROJECT_NAME: ch32-hal-template
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"
- 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
# 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 }}/
cd ${{ runner.temp }}/$PROJECT_NAME
cargo build --release