-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from taeh98/master
chore: made Rust CI workflow
- Loading branch information
Showing
1 changed file
with
87 additions
and
0 deletions.
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 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 |