-
Notifications
You must be signed in to change notification settings - Fork 2
158 lines (127 loc) · 4.82 KB
/
pr.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: PR
on:
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# TODO move to a release ci
# build:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# path: snarkos-test
# - name: Checkout snarkOS
# uses: actions/checkout@v4
# with:
# repository: AleoNet/snarkOS
# path: snarkos
# - name: Checkout snarkVM
# uses: actions/checkout@v4
# with:
# repository: AleoNet/snarkVM
# path: snarkvm
# - name: Use mold linker
# uses: rui314/setup-mold@v1
# - name: Install nightly and cranelift
# uses: dtolnay/rust-toolchain@nightly
# with:
# toolchain: nightly
# components: rustc-codegen-cranelift-preview
# - uses: Swatinem/rust-cache@v2
# with:
# key: cache-v1
# - name: Build
# env:
# RUSTFLAGS: -Zcodegen-backend=cranelift -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort
# run: cargo +nightly build --verbose
fmt:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: ☁️ Install Nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: 📋 Format Check
run: cargo +nightly fmt -- --check
test:
runs-on: ubuntu-latest
permissions: read-all
env:
RUSTFLAGS: -Zcodegen-backend=cranelift
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: 🥬 Use Mold Linker
uses: rui314/setup-mold@v1
- name: ☁️ Install Nightly
uses: dtolnay/rust-toolchain@nightly
with:
components: rustc-codegen-cranelift-preview clippy
- name: 🫙 Cache
uses: Swatinem/rust-cache@v2
with:
key: cache-v1
cache-on-failure: true
- name: ☁️ Install Nextest
uses: taiki-e/install-action@nextest
# - name: ☁️ Install cargo-machete
# run: cargo install cargo-machete
# - name: 📋 Clippy Check
# env:
# RUSTFLAGS: -Zcodegen-backend=cranelift
# run: cargo +nightly clippy --all --all-targets -- -D warnings
# - name: 📋 Check Unused Deps
# if: always()
# env:
# RUSTFLAGS: -Zcodegen-backend=cranelift
# run: cargo machete
- uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref_name }}
filters: |
top_toml:
- 'Cargo.toml'
aot:
- 'crates/aot/**/*'
checkpoint:
- 'crates/checkpoint/**/*'
control_plane:
- 'crates/snops/**/*'
agent:
- 'crates/snops-agent/**/*'
scli:
- 'crates/snops-cli/**/*'
common:
- 'crates/snops-common/**/*'
- name: 🧪 Test All
if: steps.changes.outputs.top_toml == 'true'
run: cargo +nightly nextest run --all --verbose --fail-fast --all-features
- name: 🧪 Test Aot
if: steps.changes.outputs.aot == 'true' && steps.changes.outputs.top_toml == 'false'
run: cargo +nightly nextest run -p snarkos-aot --verbose --fail-fast --all-features
- name: 🧪 Test Checkpoint
if: steps.changes.outputs.checkpoint == 'true' && steps.changes.outputs.top_toml == 'false'
run: cargo +nightly nextest run -p checkpoint --verbose --fail-fast --all-features
- name: 🧪 Test Common
if: steps.changes.outputs.common == 'true' && steps.changes.outputs.top_toml == 'false'
run: cargo +nightly nextest run -p snops-common --verbose --fail-fast --all-features
- name: 🧪 Test Control Plane
if: (steps.changes.outputs.control_plane == 'true' || steps.changes.outputs.common == 'true') && steps.changes.outputs.top_toml == 'false'
run: cargo +nightly nextest run -p snops --verbose --fail-fast --all-features
- name: 🧪 Test Agent
if: (steps.changes.outputs.agent == 'true' || steps.changes.outputs.common == 'true') && steps.changes.outputs.top_toml == 'false'
run: cargo +nightly nextest run -p snops-agent --verbose --fail-fast --all-features
- name: 🧪 Test Scli
if: (steps.changes.outputs.scli == 'true' || steps.changes.outputs.common == 'true') && steps.changes.outputs.top_toml == 'false'
run: cargo +nightly nextest run -p snops-cli --verbose --fail-fast --all-features