-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add rust ci #3
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Formatting Check | ||
description: Checks that the code is formatted according to rustfmt | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install stable | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
|
||
- name: Check formatting | ||
shell: bash | ||
run: cargo fmt --check | ||
... |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,21 @@ | ||||||
name: Hack | ||||||
description: Check feature flag combinations with cargo-hack | ||||||
|
||||||
runs: | ||||||
using: composite | ||||||
steps: | ||||||
- name: Check out repository | ||||||
uses: actions/checkout@v4 | ||||||
with: | ||||||
submodules: true | ||||||
|
||||||
- name: Install stable Rust | ||||||
uses: dtolnay/rust-toolchain@stable | ||||||
|
||||||
- name: Install cargo-hack | ||||||
uses: taiki-e/install-action@cargo-hack | ||||||
|
||||||
- name: Run cargo hack | ||||||
shell: bash | ||||||
run: cargo hack --feature-powerset check | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (performance): Consider using --each-feature for large feature sets If your project has many features, using
Suggested change
|
||||||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: Clippy Lint Check | ||
description: Checks that the code does not contain any Clippy warnings | ||
|
||
inputs: | ||
toolchain: | ||
description: The Rust toolchain to use | ||
required: false | ||
default: stable | ||
github_token: | ||
description: The GitHub token to use | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install ${{ inputs.toolchain }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ inputs.toolchain }} | ||
components: clippy | ||
|
||
- name: cargo clippy | ||
uses: giraffate/clippy-action@v1 | ||
with: | ||
reporter: 'github-pr-check' | ||
github_token: ${{ inputs.github_token }} | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: MSRV | ||
description: Check minimal supported Rust version | ||
|
||
inputs: | ||
msrv: | ||
description: The minimal supported Rust version | ||
required: false | ||
default: "1.56.1" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install minimal supported Rust version | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ inputs.msrv }} | ||
|
||
- name: Run cargo check with msrv ${{ inputs.msrv }} | ||
shell: bash | ||
run: cargo +${{ inputs.msrv }} check | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
name: Semver | ||
description: Check semantic versioning with cargo-semver-checks | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install stable Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
|
||
- name: Run cargo-semver-checks | ||
uses: obi1kenobi/cargo-semver-checks-action@v2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Add a comment explaining the semver check Consider adding a comment explaining what the cargo-semver-checks action does. This would improve the self-documentation of the workflow for maintainers who might not be familiar with it.
|
||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
name: Integration Test | ||
description: Run the integration test suite and upload coverage to Codecov | ||
|
||
inputs: | ||
toolchain: | ||
description: Rust toolchain to test against | ||
required: false | ||
default: stable | ||
github_token: | ||
description: GitHub token to use | ||
required: true | ||
codecov_token: | ||
description: Codecov token to upload coverage | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain ${{ inputs.toolchain }} | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ inputs.toolchain }} | ||
|
||
- name: Generate lockfile if missing | ||
shell: bash | ||
if: hashFiles('Cargo.lock') == '' | ||
run: cargo generate-lockfile | ||
|
||
- name: Run integration tests with ${{ inputs.toolchain }} Rust | ||
shell: bash | ||
run: cargo test --test '*' --locked --all-features --all-targets | ||
|
||
- name: Install stable Rust and LLVM tools | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: llvm-tools-preview | ||
|
||
- name: Install cargo-llvm-cov | ||
uses: taiki-e/install-action@cargo-llvm-cov | ||
|
||
- name: Run cargo llvm-cov | ||
shell: bash | ||
run: cargo llvm-cov --tests --locked --all-features --lcov --output-path lcov.info | ||
|
||
- name: Upload coverage report | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: true | ||
token: ${{ inputs.codecov_token }} | ||
env_vars: OS,RUST,TOOLCHAIN=${{ inputs.toolchain }} | ||
flags: integration-test | ||
name: coverage-integration-${{ inputs.toolchain }} | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
name: Minimal Dependency Version Test | ||
description: Run the test suite with minimal versions of dependencies | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install stable Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Install nightly Rust | ||
uses: dtolnay/rust-toolchain@nightly | ||
|
||
- name: Set default Rust to stable | ||
shell: bash | ||
run: rustup default stable | ||
|
||
- name: Update cargo with minimal versions | ||
shell: bash | ||
run: cargo +nightly update -Zminimal-versions | ||
|
||
- name: Run tests with minimal versions | ||
shell: bash | ||
run: cargo test --locked --all-features --all-targets | ||
... |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
name: Unit Test | ||
description: Run the unit test suite and upload coverage to Codecov | ||
|
||
inputs: | ||
toolchain: | ||
description: Rust toolchain to test against | ||
required: false | ||
default: stable | ||
github_token: | ||
description: GitHub token to use | ||
required: true | ||
codecov_token: | ||
description: Codecov token to upload coverage | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install stable Rust | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ inputs.toolchain }} | ||
|
||
- name: Generate lockfile if missing | ||
shell: bash | ||
if: hashFiles('Cargo.lock') == '' | ||
run: cargo generate-lockfile | ||
|
||
- name: Run unit tests with ${{ inputs.toolchain }} Rust | ||
shell: bash | ||
run: cargo test --lib --locked --all-features --all-targets | ||
|
||
- name: Install stable Rust and LLVM tools | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: llvm-tools-preview | ||
|
||
- name: Install cargo-llvm-cov | ||
uses: taiki-e/install-action@cargo-llvm-cov | ||
|
||
- name: Run cargo llvm-cov | ||
shell: bash | ||
run: cargo llvm-cov --lib --locked --all-features --lcov --output-path lcov.info | ||
|
||
- name: Upload coverage report | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: true | ||
token: ${{ inputs.codecov_token }} | ||
flags: unit-test | ||
env_vars: OS,RUST,TOOLCHAIN=${{ inputs.toolchain }} | ||
name: coverage-unit-${{ inputs.toolchain }} | ||
... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this effectively doing? Even by quickly checking their readme it's not clear https://github.com/taiki-e/cargo-hack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its is supposed to:
I am currently adding all other ations as well that make sense, there is a possibility that some might have overlaping functionality, that we can decide once this PR is ready and tested with all other actions as well.
Lemme know know if there are anything I'm missing: