-
Notifications
You must be signed in to change notification settings - Fork 94
120 lines (99 loc) · 3.45 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
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
name: CI
on:
push:
pull_request:
env:
# https://doc.rust-lang.org/cargo/reference/profiles.html#release
RUSTFLAGS: -Coverflow-checks=y -Cdebug-assertions=y
# https://doc.rust-lang.org/cargo/reference/profiles.html#incremental
CARGO_INCREMENTAL: 1
# https://nexte.st/book/pre-built-binaries.html#using-nextest-in-github-actions
CARGO_TERM_COLOR: always
jobs:
run_checks:
strategy:
matrix:
rust_toolchain_version: ["1.71", "1.72", "1.73", "1.74"]
# FIXME: currently not available for 5.0.0.
# It might be related to boxroot dependency, and we would need to bump
# up the ocaml-rs dependency
ocaml_version: ["4.14"]
runs-on: ubuntu-latest
name: Run some basic checks and tests
steps:
- name: Checkout PR
uses: actions/[email protected]
# as action-rs does not seem to be maintained anymore, building from
# scratch the environment using rustup
- name: Setup Rust toolchain ${{ matrix.rust_toolchain_version }}
run:
|
curl --proto '=https' --tlsv1.2 -sSf -o rustup-init \
https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init
chmod +x ./rustup-init
./rustup-init -y --default-toolchain "${{ matrix.rust_toolchain_version }}" --profile default
rm ./rustup-init
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
# overwriting default rust-toolchain
echo ${{ matrix.rust_toolchain_version }} > rust-toolchain
- name: Setup OCaml ${{ matrix.ocaml_version }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml_version }}
# https://github.com/ocaml/setup-ocaml/issues/211#issuecomment-1058882386
# disable-cache: true
- name: Install markdownlint
run: |
npm install -g markdownlint-cli
#
# Doc & Spec
#
- name: Install cargo-spec for specifications
run: |
eval $(opam env)
cargo install --locked cargo-spec
- name: Build the kimchi specification
run: |
cd book/specifications
cd kimchi && make build
- name: Build the polynomial commitment specification
run: |
cd book/specifications
cd poly-commitment && make build
- name: Check that up-to-date specification is checked in
run: |
git diff --exit-code ":(exclude)rust-toolchain"
#
# Coding guidelines
#
- name: Enforce formating
run: |
eval $(opam env)
cargo fmt -- --check
- name: Lint (clippy)
run: |
eval $(opam env)
cargo clippy --all-features --all-targets --tests -- -W clippy::all -D warnings
#
# Build
#
- name: Ensure that everything builds
run: |
eval $(opam env)
cargo build --release --all-targets --all-features
#
# Tests
#
# https://nexte.st/book/pre-built-binaries.html#using-nextest-in-github-actions
- name: Install latest nextest release
run: |
eval $(opam env)
cargo install cargo-nextest --locked
- name: Test with latest nextest release (faster than cargo test)
run: |
eval $(opam env)
cargo nextest run --all-features --release
- name: Doc tests
run: |
eval $(opam env)
cargo test --all-features --release --doc