-
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.
.github workflows with linting and tests
- Loading branch information
Showing
4 changed files
with
118 additions
and
1 deletion.
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,20 @@ | ||
name: 'Set up cargo cache' | ||
description: 'Sets up the cargo cache for the workflow' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up cargo cache | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo- |
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,60 @@ | ||
name: Format and Lint | ||
on: [push] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
fmt-and-lint: | ||
name: x86 Format and Lint Checks | ||
timeout-minutes: 30 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
components: clippy, rustfmt | ||
override: true | ||
profile: minimal | ||
toolchain: nightly-2023-06-01 | ||
|
||
- name: Cargo cache | ||
uses: ./.github/actions/cargo-cache | ||
|
||
- name: fmt check | ||
# Format checks aren't OS dependent. | ||
if: matrix.os == 'ubuntu-latest' | ||
run: cargo fmt --all -- --check --color always | ||
|
||
- name: Clippy lint | ||
run: cargo clippy --all-targets --all-features -- --D warnings | ||
|
||
wasm-lint: | ||
name: Wasm Lint Checks | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
components: clippy | ||
override: true | ||
profile: minimal | ||
toolchain: nightly-2023-06-01 | ||
target: wasm32-unknown-unknown | ||
|
||
- name: Cargo cache | ||
uses: ./.github/actions/cargo-cache | ||
|
||
- name: Clippy lint | ||
run: cargo clippy --target wasm32-unknown-unknown -- --D warnings |
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,35 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
x86-64-unit-tests: | ||
name: x86 Cargo unit tests | ||
timeout-minutes: 30 | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
components: clippy, rustfmt | ||
override: true | ||
profile: minimal | ||
toolchain: nightly-2023-06-01 | ||
|
||
- name: Cargo cache | ||
uses: ./.github/actions/cargo-cache | ||
|
||
- name: Cargo test | ||
run: cargo test --no-fail-fast |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
target/ | ||
|
||
.vscode/ | ||
.vscode/ | ||
|
||
.idea |