From 309195bde216120c25c8cf27576b4a2604efe998 Mon Sep 17 00:00:00 2001 From: Florian Guggi Date: Sun, 15 Sep 2024 11:30:47 +0200 Subject: [PATCH] Run static checks in CI and compile only on master --- .github/workflows/cross.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/rust.yml | 30 ++++++++---------------------- 2 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/cross.yml diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml new file mode 100644 index 0000000..95e6f98 --- /dev/null +++ b/.github/workflows/cross.yml @@ -0,0 +1,30 @@ +name: Compile for the RPi + +on: + push: + branches: [ "master" ] + workflow_dispatch: + +jobs: + cross-compile: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Prepare + run: cargo install cross --git https://github.com/cross-rs/cross + - name: Build + run: | + cross build --examples --bins --release --target aarch64-unknown-linux-gnu + mv target/aarch64-unknown-linux-gnu/release/STS1_EDU_Scheduler . + mv target/aarch64-unknown-linux-gnu/release/examples/cli . + cp scheduler/config.toml . + cp scheduler/scheduler.service . + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: aarch64 package + path: | + STS1_EDU_Scheduler + config.toml + scheduler.service + cli diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1a18f22..d115c6a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,8 +1,6 @@ name: Build & Test on: - push: - branches: [ "master" ] pull_request: branches: [ "master" ] @@ -21,25 +19,13 @@ jobs: - name: Run tests run: cargo test --release --features mock - cross-compile: + static-checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Prepare - run: cargo install cross --git https://github.com/cross-rs/cross - - name: Build - run: | - cross build --examples --bins --release --target aarch64-unknown-linux-gnu - mv target/aarch64-unknown-linux-gnu/release/STS1_EDU_Scheduler . - mv target/aarch64-unknown-linux-gnu/release/examples/cli . - cp scheduler/config.toml . - cp scheduler/scheduler.service . - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: aarch64 package - path: | - STS1_EDU_Scheduler - config.toml - scheduler.service - cli + - uses: actions/checkout@v4 + - name: Install + run: sudo apt install libudev-dev + - name: Clippy + run: cargo clippy -- -D warnings + - name: Formatting + run: cargo fmt --all --check