This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
85 lines (72 loc) · 2.36 KB
/
build.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
# This CI Tries to be both simple and effective. It is inspired by:
# https://github.com/marketplace/actions/rust-cache
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
# https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml
name: Rust Checks
on:
pull_request:
push:
branches:
- main
jobs:
check-cargo-toml-format:
name: "Check Cargo.toml files format"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: rustup show
- name: Check Cargo.toml files format with toml_sort
run: chmod u+x ./scripts/check-cargo-toml-files-format.sh && ./scripts/check-cargo-toml-files-format.sh
check-rust-fmt:
name: Check rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup rust toolchain
run: rustup show
- name: Run cargo fmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
cargo-check:
name: Cargo check
runs-on: ubuntu-latest
steps:
- name: Install tooling
run: |
sudo apt-get install -y protobuf-compiler
protoc --version
- name: Checkout sources
uses: actions/checkout@v2
- name: Setup rust toolchain
run: rustup show
- name: Rust Cache
uses: Swatinem/rust-cache@v1
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
check-copyright:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Find un-copyrighted files
run: |
find . -name '*.rs' -not -path "*/parachain-template/*" -exec grep -H -E -o -c Copyright {} \; | grep ':0' || true
FILECOUNT=$(find . -name '*.rs' -not -path "*/parachain-template/*" -exec grep -H -E -o -c 'Copyright' {} \; | grep -c ':0' || true)
if [[ $FILECOUNT -eq 0 ]]; then
true
else
false
fi