-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (74 loc) · 2.48 KB
/
rust.yml
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
73
74
75
76
77
78
79
name: rust
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Check formatting
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Stable rust toolchain
run: rustup toolchain install stable --profile minimal
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: windows-latest
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Stable rust toolchain
run: rustup toolchain install stable --profile minimal
- name: Add Clippy
run: rustup component add clippy
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "rust-stable"
shared-key: "clippy"
- name: Install cargo-binstall
run: wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-gnu.tgz -O - | tar -xz -C $HOME/.cargo/bin
- name: Install sarif-fmt & clippy-sarif
run: cargo binstall --no-confirm --force sarif-fmt clippy-sarif
- name: Run Clippy
run: cargo clippy --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif
build:
name: Build ${{ matrix.platform.os_name }} [rust ${{ matrix.toolchain }}]
runs-on: ${{ matrix.platform.os }}
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
strategy:
matrix:
platform:
- os_name: Windows-x86_64
os: windows-latest
target: x86_64-pc-windows-gnu
toolchain:
- nightly
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup ${{ matrix.toolchain }} toolchain
run: rustup toolchain install ${{ matrix.toolchain }} --target ${{ matrix.platform.target }} --profile minimal
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "rust-${{ matrix.toolchain }}"
shared-key: "build-${{ matrix.platform.target }}"
- name: Build
run: cargo build --target ${{ matrix.platform.target }}