-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (66 loc) · 2.24 KB
/
rust.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
on:
merge_group:
types: [checks_requested]
pull_request:
push:
branches:
- main
permissions:
security-events: read
contents: read
name: build
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: dtolnay/rust-toolchain@315e265cd78dad1e1dcf3a5074f6d6c47029d5aa # stable
with:
toolchain: stable
- run: cargo test --all-features -- --nocapture
test_wasm:
name: Test WebAssembly (WASI)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: dtolnay/rust-toolchain@315e265cd78dad1e1dcf3a5074f6d6c47029d5aa # stable
with:
toolchain: stable
target: wasm32-wasi
- uses: taiki-e/install-action@f725b9adf3838dea66890ca9932712709858c409
with:
tool: wasmtime,cargo-wasi
- env:
CARGO_TARGET_WASM32_WASI_RUNNER: "wasmtime --dir=."
run: cargo wasi test -- --nocapture
fmt_lint:
permissions:
contents: read
name: Format/Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: dtolnay/rust-toolchain@315e265cd78dad1e1dcf3a5074f6d6c47029d5aa # stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Cargo fmt
run: cargo fmt --all --check
- name: Cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Check for diffs
run: git diff --ignore-space-at-eol --exit-code
build:
runs-on: ubuntu-latest
needs: [tests, fmt_lint, test_wasm]
# Skipping this results job results in a misleading status on PRs and in the queue,
# so instead lets always return an explicit success or failure.
if: ${{ always() }}
steps:
- name: Collect results on success
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
run: echo "All checks passed"
- name: Collect results on failure
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: echo "Some checks failed" && false