-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (119 loc) · 4.36 KB
/
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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Smoldot
# Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
# SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
name: continuous-integration
on:
pull_request:
jobs:
test:
name: Build and test
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v2.3.4
- uses: Swatinem/rust-cache@v1
- name: Run tests, with all features
run: cargo test --locked --workspace --all-features
wasm-node-check:
name: Check javascript node
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v2.3.4
- uses: Swatinem/rust-cache@v1
- uses: actions/setup-node@v2.1.4
with:
node-version: '12'
- run: apt-get update && apt install -y binaryen # For `wasm-opt`
# The Rust version used for compiling the Wasm node is pinned.
- run: rustup install --profile=minimal 1.48.0
- run: rustup target add --toolchain=1.48.0 wasm32-wasi
- run: cd bin/wasm-node/javascript && npm install && npm test
check-features:
name: Check that combination of features compiles
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v2.3.4
- uses: Swatinem/rust-cache@v1
- run: cargo check --package smoldot --locked --no-default-features
- run: cargo check --package smoldot --locked --no-default-features --features database-sled
- run: cargo check --package smoldot --locked --no-default-features --features std
- run: cargo check --package smoldot --locked --no-default-features --features database-sled --features std
check-rustdoc-links:
name: Check rustdoc intra-doc links
runs-on: ubuntu-latest
container:
image: rust
steps:
- uses: actions/checkout@v2.3.4
- name: Check rustdoc links
run: cargo doc --verbose --workspace --all-features --no-deps --document-private-items
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2.3.4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install rustfmt
run: rustup component add rustfmt
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# TODO: as explained in the official repo (https://github.com/actions-rs/clippy), this action uses unstable GH actions features, but has the huge advantage of not requiring `GITHUB_TOKEN` and working on PRs from forked repositories ; should eventually replace `actions-rs/clippy@master` with a specific version
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy
override: true
- uses: actions-rs/clippy@master
with:
args: --all-features --all-targets
cargo-deny:
runs-on: ubuntu-latest
strategy:
matrix:
# The `advisories` check isn't done, because pragmatically speaking it fails CI too often.
# See `audit.yml` instead.
checks:
- bans licenses sources
steps:
- uses: actions/checkout@v2.3.4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check --config .github/cargo-deny.toml ${{ matrix.checks }}
arguments: --workspace --all-features
all-ci:
# This dummy job depends on all the mandatory checks. It succeeds if and only if CI is
# considered successful.
needs: [test, wasm-node-check, check-features, check-rustdoc-links, fmt, clippy, cargo-deny]
runs-on: ubuntu-latest
steps:
- run: echo Success