-
Notifications
You must be signed in to change notification settings - Fork 6
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
chore: made Rust CI workflow #27
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# This CI (Continuous Integration) file will automatically check your Rust code for errors. | ||
# It runs using GitHub Actions: https://docs.github.com/en/actions | ||
# It will check the code compiles, run tests, run lints, and check for security issues. | ||
# CI will help you standardise your code style and to detect issues with your code easily and early. | ||
# It makes it easier to integrate different branches once they're finished. | ||
# adapted from https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md and https://gist.github.com/LukeMathWalker/5ae1107432ce283310c3e601fac915f3 | ||
|
||
name: Rust CI | ||
|
||
on: | ||
push: | ||
# branches: | ||
# - main | ||
release: | ||
types: [published] | ||
pull_request: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
check: | ||
name: Check code compiles | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Run cargo check | ||
run: cargo check | ||
|
||
test: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Run tests | ||
run: cargo test | ||
|
||
fmt: | ||
name: Lint with rmstfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- name: Enforce formatting | ||
run: cargo fmt --check | ||
|
||
clippy: | ||
name: Lint with clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Linting | ||
run: cargo clippy -- -D warnings | ||
|
||
cargo_deny: | ||
name: cargo deny | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: taiki-e/install-action@cargo-deny | ||
- name: Scan for vulnerabilities | ||
run: cargo deny check advisories | ||
|
||
cargo-audit: | ||
name: cargo audit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- name: Install cargo audit | ||
run: cargo install cargo-audit | ||
- name: Run "cargo audit" to check for vulnerabilities | ||
run: cargo audit --color=always --deny=warnings |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Two things with this:
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.
Hey, thanks for your feedback.
To your first point, yeah, I'll change it over to the nightly toolchain if that's what your code needs.
To your second, there isn't an official Rust GitHub action, but dtolnay/rust-toolchain is now what most people use. I think the checkout action has been updated though, so I'll update it and also recheck everything else is up-to-date too.
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.
OK @Spydr06,
I just finished moving all the actions over to the nightly toolchain, updating the checkout action used, and moving everything over to the de-facto standard actions used for jobs. Please let me know if you have any further thoughts. Thanks! :)
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.
Ah ok, did not know that. Then it's fine ofc