Skip to content

Add ci workflow

Add ci workflow #5

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-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-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/Cargo.lock
- run: |
cd ${{ runner.temp }}/$PROJECT_NAME
cargo build --release