-
Notifications
You must be signed in to change notification settings - Fork 956
92 lines (85 loc) · 2.83 KB
/
checks.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
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Run checks
on:
push:
branches:
- main
# Run in PRs with conflicts (https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request)
pull_request_target:
types: [opened, synchronize, reopened]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
env:
GIT_LFS_SKIP_SMUDGE: 1
jobs:
clippy-fmt:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
nightly_version: [nightly-2023-06-01]
make:
- name: Clippy
command: clippy
cache_subkey: clippy
cache_version: v1
- name: Format
command: check && make fmt-check
cache_subkey: fmt
cache_version: v1
env:
CARGO_INCREMENTAL: 0
steps:
- name: Checkout repo
uses: actions/checkout@v3
if: ${{ github.event_name != 'pull_request_target' }}
- name: Checkout PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request_target' }}
# See comment in build-and-test.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup rust toolchain
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
target: wasm32-unknown-unknown
profile: default
override: true
- name: Setup rust nightly
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36
with:
toolchain: ${{ matrix.nightly_version }}
target: wasm32-unknown-unknown
profile: default
- name: Show rust toolchain info
run: rustup show
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
~/.cargo/.crates.toml
~/.cargo/.crates2.json
./target
./wasm/tx_template/target
./wasm/vp_template/target
./wasm_for_tests/wasm_source/target
key: ${{ runner.os }}-${{ matrix.make.cache_subkey }}-${{ matrix.make.cache_version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.make.cache_subkey }}-${{ matrix.make.cache_version }}-cargo-
- name: ${{ matrix.make.name }}
run: make ${{ matrix.make.command }}
- name: Clean cache folder
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache || true
cargo-cache