From a5f8a237c46882f0eb7f6a0f9be9ffefe5614473 Mon Sep 17 00:00:00 2001 From: nazarevsky Date: Sat, 25 Jul 2026 18:32:46 +0200 Subject: [PATCH 1/4] feature(ci): add basic workflow for linting Rust code This workflow includes: - pulling rust-toolchain commands - caching the compiled dependencies and cargo registry after a run - calling cargo fmt - calling cargo clippy --- .github/workflows/code.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/code.yml diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml new file mode 100644 index 0000000..c6bbac7 --- /dev/null +++ b/.github/workflows/code.yml @@ -0,0 +1,29 @@ +name: CI + +on: + pull_request: + branches: [master] + +jobs: + build-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Install protoc + uses: arduino/setup-protoc@v3 + + - name: Cache cargo + uses: Swatinem/rust-cache@v2 + + - name: Check formatting + run: cargo fmt --all --check + + - name: Run clippy + run: cargo clippy --all-targets --all-features -- -D warnings From 2c3947ae6435421f7cb0752b3085757c0366f50c Mon Sep 17 00:00:00 2001 From: nazarevsky Date: Sat, 25 Jul 2026 18:51:37 +0200 Subject: [PATCH 2/4] feature(ci): add Taskfile.yml which includes a persistent test running task In order for tests being launched in both CI and a local environment, a Taskfile.yml is introduced. It contains a couple of linting and testing tasks. More important is the way that a test task was introduced. So, we want that every each workspace member is always tested. That is achivable through running 'cargo test', however, some workspace members may require running that command with additional parameters (such as event-plugin with test-threads=1). We want to have a persitent way of testing members, so creating a general Taskfile which will contain a separate test for each member won't suit us since we want can possibly slip some out. Therefore, following an approach where every each member is tested by default except the predefined will suit here better. --- Taskfile.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Taskfile.yml diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..3426ead --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,27 @@ +version: "3" + +tasks: + fmt: + desc: "Format Rust code" + cmds: [cargo fmt] + + fmt:check: + desc: "Check Rust code formatting" + cmds: [ cargo fmt --check] + + lint: + desc: "Lint Rust code" + cmds: [cargo clippy --all-targets --all-features -- -D warnings] + + test: + desc: "Test Rust code" + cmds: + # We want to be sure every workspace member is always tested. + # However, some members need special parameters + # (e.g. event-plugin tests must run in a single thread), + # so a single 'cargo test' can't cover everything correctly. + # Therefore, task:test runs every workspace member EXCEPT the + # excluded ones (e.g. event-plugin), and the excluded members + # are run separately with their own command. + - cargo test --workspace --exclude event-plugin + - cargo test -p event-plugin -- --test-threads=1 \ No newline at end of file From e33687e98c1ac009b95fdf34b49d8054019baa1c Mon Sep 17 00:00:00 2001 From: nazarevsky Date: Sat, 25 Jul 2026 19:08:19 +0200 Subject: [PATCH 3/4] feature(ci): add testing step, change formatting and linting commands to task --- .github/workflows/code.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index c6bbac7..73a4c00 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -23,7 +23,10 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Check formatting - run: cargo fmt --all --check + run: task fmt:check - name: Run clippy - run: cargo clippy --all-targets --all-features -- -D warnings + run: task lint + + - name: Run tests + run: task test \ No newline at end of file From 9b9a4b317032ea16e77193fd11e885e8c6baa815 Mon Sep 17 00:00:00 2001 From: nazarevsky Date: Sat, 25 Jul 2026 19:14:20 +0200 Subject: [PATCH 4/4] feature(ci): add step that sets up task, change job name --- .github/workflows/code.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml index 73a4c00..41eb13b 100644 --- a/.github/workflows/code.yml +++ b/.github/workflows/code.yml @@ -5,7 +5,7 @@ on: branches: [master] jobs: - build-lint: + build-lint-test: runs-on: ubuntu-latest steps: - name: Checkout code @@ -22,6 +22,11 @@ jobs: - name: Cache cargo uses: Swatinem/rust-cache@v2 + - name: Install Task + uses: arduino/setup-task@v2 + with: + version: 3.x + - name: Check formatting run: task fmt:check