-
Notifications
You must be signed in to change notification settings - Fork 97
138 lines (130 loc) · 5.14 KB
/
pr-tests.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
130
131
132
133
134
135
136
137
138
name: PR tests
on:
workflow_dispatch:
pull_request:
merge_group:
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: ⚡ Restore rust cache
id: cache
uses: actions/cache/restore@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-pr-tests-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-pr-tests-
- name: Install Rust toolchain 1.74 (with clippy and rustfmt)
run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.74-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.74-x86_64-unknown-linux-gnu
- name: Lint
run: cargo clippy --all --all-targets --all-features --profile pr-tests -- -D warnings
- name: Lint
run: cargo clippy --all --all-targets --no-default-features --profile pr-tests -- -D warnings
- name: Format
run: cargo fmt --all --check --verbose
- name: Build
run: cargo build --all-targets --all --all-features --profile pr-tests
- name: Check without Halo2
run: cargo check --all --no-default-features --profile pr-tests
- uses: taiki-e/install-action@nextest
- name: Create tests archive
run: cargo nextest archive --archive-file tests.tar.zst --cargo-profile pr-tests --workspace --all-features
- name: ⚡ Save rust cache
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-pr-tests-${{ hashFiles('**/Cargo.toml') }}
- name: Upload tests archive
uses: actions/upload-artifact@v2
with:
name: tests_archive
path: tests.tar.zst
test_quick:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: tests_archive
- name: ⚡ Cache nodejs
uses: actions/cache@v3
with:
path: |
~/pilcom/node_modules
key: ${{ runner.os }}-pilcom-node-modules
- name: Install Rust toolchain 1.74 (with clippy and rustfmt)
run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.74-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.74-x86_64-unknown-linux-gnu
- name: Install nightly
run: rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install riscv target
run: rustup target add riscv32imac-unknown-none-elf --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install stdlib
run: rustup component add rust-src --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install pilcom
run: git clone https://github.com/0xPolygonHermez/pilcom.git && cd pilcom && npm install
- uses: taiki-e/install-action@nextest
- name: Run default tests
run: PILCOM=$(pwd)/pilcom/ cargo nextest run --archive-file tests.tar.zst --verbose
test_slow:
strategy:
matrix:
test:
- "subset1"
- "subset2"
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: tests_archive
- name: ⚡ Cache nodejs
uses: actions/cache@v3
with:
path: |
~/pilcom/node_modules
key: ${{ runner.os }}-pilcom-node-modules
- name: Install Rust toolchain 1.74 (with clippy and rustfmt)
run: rustup toolchain install 1.74-x86_64-unknown-linux-gnu && rustup component add clippy --toolchain 1.74-x86_64-unknown-linux-gnu && rustup component add rustfmt --toolchain 1.74-x86_64-unknown-linux-gnu
- name: Install nightly
run: rustup toolchain install nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install riscv target
run: rustup target add riscv32imac-unknown-none-elf --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install stdlib
run: rustup component add rust-src --toolchain nightly-2023-01-03-x86_64-unknown-linux-gnu
- name: Install pilcom
run: git clone https://github.com/0xPolygonHermez/pilcom.git && cd pilcom && npm install
- uses: taiki-e/install-action@nextest
- name: Run slow tests
# Number threads is set to 1 because the runner does not have enough memory for more.
run: |
if [[ "${{ matrix.test }}" == "subset1" ]]; then
TESTS="test(=test_keccak) | test(=test_vec_median) | test(=instruction_tests::addi) | test(=arith_test)"
elif [[ "${{ matrix.test }}" == "subset2" ]]; then
TESTS="test(=test_many_chunks)"
fi
PILCOM=$(pwd)/pilcom/ cargo nextest run --archive-file tests.tar.zst --verbose --run-ignored=ignored-only --no-capture -E "$TESTS"
shell: bash