Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Rust Tests

on:
push:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

env:
CARGO_TERM_COLOR: always

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
test:
name: Test
runs-on: ubuntu-latest
if: github.event_name == 'push' || !github.event.pull_request.draft
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: dsherret/rust-toolchain-file@v1
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --workspace --verbose

fmt:
name: Rustfmt
runs-on: ubuntu-latest
if: github.event_name == 'push' || !github.event.pull_request.draft
steps:
- uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- run: cargo fmt --all -- --check
Copy link
Collaborator

Choose a reason for hiding this comment

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

The problem with formatting is that Eldar used a custom styleguide for this repo, allowing 2 empty lines between the blocks. However, the blank_lines_upper_bound option in rustfmt is still unstable. So applying the formatting at the moment will try to remove extra empty lines in all of the files

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do we consider unifying the style-guides on the org level or at least standardizing style-guide for the repo so that it can be enforced? Otherwise either no style guide is followed, or it becomes tedious to battle with the tools, that apply default fmt rules.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Usually we follow the default style-guide in the company. Only this repo has its own one which, unfortunately, can't be enforced at the moment. Actually, maybe enabling unstable features for rustfmt alone is not a bad solution 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes it could be done just on the rustfmt level.
But are there any reasons not to switch to the default org-wide style-guide for this repo?

If you are worrying about tools like git-blame - it's easily solved with:

git config blame.ignoreRevsFile .git-blame-ignore-revs

and .git-blame-ignore-revs file that includes commit refs that did massive reformatting.


clippy:
name: Clippy
runs-on: ubuntu-latest
if: github.event_name == 'push' || !github.event.pull_request.draft
steps:
- uses: actions/checkout@v4
- uses: dsherret/rust-toolchain-file@v1
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features -- -D warnings
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ tracing = "0.1.41"
tracing-subscriber = "0.3.19"
url = "2.5.4"
valuable = "0.1.1"

[workspace.lints.clippy]
all = "warn"
correctness = "deny"
suspicious = "warn"
perf = "warn"
1 change: 1 addition & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[toolchain]
channel = "1.89"
components = [ "rustfmt", "clippy" ]
Loading