-
Notifications
You must be signed in to change notification settings - Fork 22
155 lines (149 loc) · 4.79 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
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
name: CI
on:
push:
branches:
- main
- next
paths-ignore:
- "*.md"
- "*.txt"
- "docs"
pull_request:
paths-ignore:
- "*.md"
- "*.txt"
- "docs"
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# Use a common cache for the basic compilation/formatter/clippy checks
shared-key: ${{ github.workflow }}-shared
save-if: ${{ github.ref == 'refs/heads/next' }}
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Clippy
run: |
cargo make clippy
check_format:
name: check formatting
runs-on: ubuntu-latest
# Run this job after the linter, so the cache is hot
needs: [lint]
# But run this check even if the lint check failed
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# Use a common cache for the basic compilation/formatter/clippy checks
shared-key: ${{ github.workflow }}-shared
# But do not save this cache, just use it
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Check Formatting
run: |
cargo make check-format
unit_tests:
name: midenc unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# NOTE: We use a different cache for the tests, so they can be run in parallel, but we
# also share the cache for the tests for efficiency
shared-key: ${{ github.workflow }}-shared-tests
save-if: ${{ github.ref == 'refs/heads/next' }}
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Check
# We run `cargo check` to verify that the workspace compiles correctly before attempting
# to execute the tests from each crate. This produces easier to read output if a compilation
# error occurs
run: |
cargo make check --tests
- name: Test
run: |
cargo make test -E 'not (package(miden-integration-tests) or package(cargo-miden))'
midenc_integration_tests:
name: midenc integration tests
runs-on: ubuntu-latest
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-shared-tests
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
run: |
cargo make test -E 'package(miden-integration-tests)'
cargo_miden_integration_tests:
name: cargo-miden integration tests
runs-on: ubuntu-latest
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-shared-tests
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
run: |
cargo make test -E 'package(cargo-miden)'