-
Notifications
You must be signed in to change notification settings - Fork 3
63 lines (59 loc) · 1.85 KB
/
rust-ci.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
name: Rust CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
static_code_analysis:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install stable toolchain
run: |
rustup show
rustup component add rustfmt clippy
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- run: cargo check --workspace
# Note: cargo check should use the --locked option
# Excluding it because of this known issue: https://github.com/mozilla/uniffi-rs/issues/1032
- run: cargo clippy --all-targets --all-features --workspace --no-deps -- -D warnings
- run: cargo fmt --all -- --check
- name: Run doctest only
# we run doctests here as cargo tarpaulin (our test runner)
# requires nightly toolchain to do so
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --doc
- name: Run cargo doc
# This step is required to detect possible errors in docs that are not doctests.
uses: actions-rs/cargo@v1
with:
command: doc
args: --workspace --no-deps # Warnings are treated as errors due to our .cargo/config file.
build_and_test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install stable toolchain
run: rustup show
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Test
run: cargo test