-
Notifications
You must be signed in to change notification settings - Fork 2
Add Github Actions CI jobs for testing, linting, formatting etc #2
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
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a6992f4
Add Github Actions CI jobs for testing, linting, formatting etc
faern e3530a9
Ignore Windows for now
faern 7903ddb
Allow dead_code for now, since we are in early prototyping
faern cbd33cc
Fix clippy warning around useless ?
faern eca94b1
Add preceding underscore to unused variable
faern faff4a7
Upgrade trycmd to solve minimal-versions issue
faern e811175
Use dtolnay/rust-toolchain github actions instead of actions-rs
faern 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 hidden or 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,61 @@ | ||
| --- | ||
| name: Build and test | ||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| # TODO: Do not allow dead_code once crate is out of early prototyping stage | ||
| RUSTFLAGS: --deny warnings --allow dead_code | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| strategy: | ||
| matrix: | ||
| # TODO: Add and make Windows work in CI also | ||
| os: [ubuntu-latest, macos-latest] | ||
| # Keep MSRV in sync with rust-version in Cargo.toml | ||
| rust: [stable, beta, nightly, 1.79.0] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17 # master at the time of writing this | ||
| with: | ||
| toolchain: ${{ matrix.rust }} | ||
|
|
||
| - name: Build | ||
| run: cargo --version && cargo build --all-targets --locked | ||
|
|
||
| - name: Test | ||
| run: cargo test --locked | ||
|
|
||
| # Make sure documentation builds without warnings (broken links etc) | ||
| - name: Generate documentation | ||
| if: matrix.rust == 'stable' | ||
| run: RUSTDOCFLAGS="--deny warnings" cargo doc | ||
|
|
||
| # Make sure the library builds with all dependencies downgraded to their | ||
| # oldest versions allowed by the semver spec. This ensures we have not | ||
| # under-specified any dependency | ||
| minimal-versions: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install stable Rust | ||
| uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17 # master at the time of writing this | ||
| with: | ||
| toolchain: stable | ||
|
|
||
| - name: Install nightly Rust | ||
| uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17 # master at the time of writing this | ||
| with: | ||
| toolchain: nightly | ||
|
|
||
| - name: Downgrade dependencies to minimal versions | ||
| run: cargo +nightly update -Z minimal-versions | ||
|
|
||
| - name: Compile with minimal versions | ||
| run: cargo +stable build --all-targets --locked |
This file contains hidden or 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,29 @@ | ||
| --- | ||
| name: Audit dependencies | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/cargo-audit.yml | ||
| - Cargo.toml | ||
| - Cargo.lock | ||
| schedule: | ||
| # At 06:20 UTC every day. Will create an issue if a CVE is found. | ||
| - cron: '20 6 * * *' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| audit: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| issues: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions-rust-lang/audit@160ac8b6edd32f74656cabba9d1de3fc8339f676 # v1.2 | ||
| name: Audit Rust Dependencies | ||
| with: | ||
| denyWarnings: true | ||
| # Ignored audit issues. This list should be kept short, and effort should be | ||
| # put into removing items from the list. | ||
| ignore: | ||
This file contains hidden or 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,24 @@ | ||
| --- | ||
| name: Rust formatting | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/formatting.yml | ||
| - '**/*.rs' | ||
| workflow_dispatch: | ||
| jobs: | ||
| check-formatting: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install stable Rust | ||
| uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17 # master at the time of writing this | ||
| with: | ||
| toolchain: stable | ||
| components: rustfmt | ||
|
|
||
| - name: Check formatting | ||
| run: | | ||
| rustfmt --version | ||
| cargo fmt -- --check |
This file contains hidden or 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,32 @@ | ||
| --- | ||
| name: Git - Check commit message style | ||
| on: | ||
| push: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| check-commit-message-style: | ||
| name: Check commit message style | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # Make sure there are no whitespaces other than space, tab and newline in a commit message. | ||
| - name: Check for unicode whitespaces | ||
| uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee #v2.0.0 | ||
| with: | ||
| # Pattern matches strings not containing weird unicode whitespace/separator characters | ||
| # \P{Z} = All non-whitespace characters (the u-flag is needed to enable \P{Z}) | ||
| # [ \t\n] = Allowed whitespace characters | ||
| pattern: '^(\P{Z}|[ \t\n])+$' | ||
| flags: 'u' | ||
| error: 'Detected unicode whitespace character in commit message.' | ||
| checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request | ||
| accessToken: ${{ secrets.GITHUB_TOKEN }} # only required if checkAllCommitMessages is true | ||
|
|
||
| # Git commit messages should follow these guidelines: https://cbea.ms/git-commit/ | ||
| - name: Check against guidelines | ||
| uses: mristin/opinionated-commit-message@f3b9cec249cabffbae7cd564542fd302cc576827 #v3.1.1 | ||
| with: | ||
| # Commit messages are allowed to be subject only, no body | ||
| allow-one-liners: 'true' | ||
| # This action defaults to 50 char subjects, but 72 is fine. | ||
| max-subject-line-length: '72' |
This file contains hidden or 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,28 @@ | ||
| --- | ||
| name: Rust linting | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - .github/workflows/linting.yml | ||
| - '**/*.rs' | ||
| - Cargo.toml | ||
| - Cargo.lock | ||
| workflow_dispatch: | ||
| jobs: | ||
| clippy-linting: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
|
|
||
| - name: Install stable Rust | ||
| uses: dtolnay/rust-toolchain@21dc36fb71dd22e3317045c0c31a3f4249868b17 # master at the time of writing this | ||
| with: | ||
| toolchain: stable | ||
| components: clippy | ||
|
|
||
| - name: Clippy check | ||
| env: | ||
| # TODO: Do not allow dead_code once crate is out of early prototyping stage | ||
| RUSTFLAGS: --deny warnings --allow dead_code | ||
| run: cargo clippy --locked --all-targets |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.