Skip to content

CI: add build + lint + test job - #7

Merged
Nazarevsky merged 4 commits into
masterfrom
feature/add-basic-ci
Jul 27, 2026
Merged

CI: add build + lint + test job#7
Nazarevsky merged 4 commits into
masterfrom
feature/add-basic-ci

Conversation

@Nazarevsky

@Nazarevsky Nazarevsky commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

Add a CI workflow that checks formatting, lints, and tests the Rust code on every PR into master, using Task to drive the underlying cargo commands instead of invoking them directly from the workflow.

Changes

  • Taskfile.yml: defines fmt, fmt:check, lint, and test tasks.
    • test runs in two steps rather than a single cargo test --workspace: the workspace is tested with event-plugin excluded, and event-plugin is tested separately with --test-threads=1. This is because event-plugin's config tests mutate shared process-wide environment variables and a shared temp config file, so running them in parallel with the rest of the suite races and produces flaky failures - single-threaded execution is required for that crate specifically.
  • .github/workflows/code.yml: new build-lint-test job that checks out the code, installs the Rust toolchain (with rustfmt/clippy), protoc, sets up cargo caching, installs Task, and runs task fmt:check, task lint, and task test.

Related issue: 5

This workflow includes:
- pulling rust-toolchain commands
- caching the compiled dependencies and cargo registry after a run
- calling cargo fmt
- calling cargo clippy
…g 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.
@Nazarevsky Nazarevsky changed the title Feature/add basic ci CI: add build + lint + test job Jul 25, 2026
@Nazarevsky
Nazarevsky requested a review from olegfomenko July 25, 2026 17:24
@Nazarevsky Nazarevsky self-assigned this Jul 25, 2026
Comment thread Taskfile.yml
# 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should create separate tasks/makefiles for each project and define a naming convention for tasks across all plugins (like, each plugin should have task called test, build, etc)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might have that one and thats sounds pretty logical. However, I'd like to go with more error-prone way. To have a task/makefile for each project is fine for me, but:

  • requires code reduplicating - e.g. we would need to write the same cargo fmt task command for each project taskfile. Of course, we can create a single taskfile and just import what we need from it, however, we'd like to make plugins independent from each other;
  • for an every new plugin we should update the root taskfile. And that's might be fine, but we should always remember to do so. If the testing command is somehow slipped from adding to the root taskfile, then we are risking to leave the plugin without tests which may lead to the unwanted consequences.

The approach that I introduced here helps us to mitigate cases stated above - the code is always tested no matter a new plugin was introduced or not; no additional steps are required (unless there're some special testing cases that we might introduce); no code duplicated; plugins are independent. What do you think about my intention?

@Nazarevsky
Nazarevsky merged commit f518bfb into master Jul 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants