Skip to content

Commit 506effb

Browse files
committed
wip: github actions for rust
1 parent d589371 commit 506effb

File tree

3 files changed

+42
-40
lines changed

3 files changed

+42
-40
lines changed

.github/workflows/build-firmware.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/rust_ci.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- "**/README.md"
7+
pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
14+
jobs:
15+
rust-checks:
16+
name: Rust Checks
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
action:
22+
- command: build
23+
args: --no-default-features --features=esp32c3 --target=riscv32imc-unknown-none-elf --release
24+
- command: fmt
25+
args: --all -- --check --color always
26+
- command: clippy
27+
args: --no-default-features --features=esp32c3 --target=riscv32imc-unknown-none-elf --workspace -- -D warnings
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
- name: Setup Rust
32+
uses: dtolnay/rust-toolchain@v1
33+
with:
34+
target: riscv32imc-unknown-none-elf
35+
toolchain: stable
36+
components: rust-src, rustfmt, clippy
37+
- name: Enable caching
38+
uses: Swatinem/rust-cache@v2
39+
- name: Run command
40+
run: cargo ${{ matrix.action.command }} ${{ matrix.action.args }}

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
path::{Path, PathBuf},
44
};
55

6-
const VERSION_TEMPLATE: &'static str = r#"
6+
const VERSION_TEMPLATE: &str = r#"
77
pub const VERSION: &'static str = "{version}";
88
pub const CHIP: &'static str = "{chip}";
99
pub const FIRMWARE: &'static str = "{firmware}";
@@ -23,7 +23,7 @@ fn main() {
2323
crc_walkdir(PathBuf::from("src"), &mut hasher);
2424
let src_crc = hasher.finalize();
2525

26-
let mut version_str = if let Ok(rel) = std::env::var("RELEASE_BUILD") {
26+
let version_str = if let Ok(rel) = std::env::var("RELEASE_BUILD") {
2727
rel
2828
} else {
2929
let epoch = std::time::SystemTime::now()

0 commit comments

Comments
 (0)