Skip to content

Commit 61f6b9d

Browse files
committed
.github workflows with linting and tests
1 parent 9b79ae3 commit 61f6b9d

File tree

4 files changed

+118
-1
lines changed

4 files changed

+118
-1
lines changed
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Set up cargo cache'
2+
description: 'Sets up the cargo cache for the workflow'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Checkout repository
7+
uses: actions/checkout@v3
8+
9+
- name: Set up cargo cache
10+
uses: actions/cache@v3
11+
continue-on-error: false
12+
with:
13+
path: |
14+
~/.cargo/bin/
15+
~/.cargo/registry/index/
16+
~/.cargo/registry/cache/
17+
~/.cargo/git/db/
18+
target/
19+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
20+
restore-keys: ${{ runner.os }}-cargo-

.github/workflows/fmt-and-lint.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Format and Lint
2+
on: [push]
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6+
cancel-in-progress: true
7+
8+
jobs:
9+
fmt-and-lint:
10+
name: x86 Format and Lint Checks
11+
timeout-minutes: 30
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Install Rust toolchain
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
components: clippy, rustfmt
24+
override: true
25+
profile: minimal
26+
toolchain: nightly-2023-06-01
27+
28+
- name: Cargo cache
29+
uses: ./.github/actions/cargo-cache
30+
31+
- name: fmt check
32+
# Format checks aren't OS dependent.
33+
if: matrix.os == 'ubuntu-latest'
34+
run: cargo fmt --all -- --check
35+
36+
- name: Clippy lint
37+
run: cargo clippy --all-targets --all-features -- --D warnings
38+
39+
wasm-lint:
40+
name: Wasm Lint Checks
41+
timeout-minutes: 30
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout code
45+
uses: actions/checkout@v4
46+
47+
- name: Install Rust toolchain
48+
uses: actions-rs/toolchain@v1
49+
with:
50+
components: clippy
51+
override: true
52+
profile: minimal
53+
toolchain: nightly-2023-06-01
54+
target: wasm32-unknown-unknown
55+
56+
- name: Cargo cache
57+
uses: ./.github/actions/cargo-cache
58+
59+
- name: Clippy lint
60+
run: cargo clippy --target wasm32-unknown-unknown -- --D warnings

.github/workflows/test.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
on:
3+
push:
4+
branches-ignore:
5+
- main
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
x86-64-unit-tests:
13+
name: x86 Cargo unit tests
14+
timeout-minutes: 30
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Install Rust toolchain
24+
uses: actions-rs/toolchain@v1
25+
with:
26+
components: clippy, rustfmt
27+
override: true
28+
profile: minimal
29+
toolchain: nightly-2023-06-01
30+
31+
- name: Cargo cache
32+
uses: ./.github/actions/cargo-cache
33+
34+
- name: Cargo test
35+
run: cargo test --no-fail-fast

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
target/
22

3-
.vscode/
3+
.vscode/
4+
5+
.idea

0 commit comments

Comments
 (0)