-
Notifications
You must be signed in to change notification settings - Fork 21
254 lines (215 loc) · 6.43 KB
/
on-pr.yaml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# Placeholder for the PR workflow.
name: on-pr
on:
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
pull-requests: write
contents: read
env:
RUST_BACKTRACE: full
CONSENSUS_ENCLAVE_CSS: /tmp/consensus-enclave.css
INGEST_ENCLAVE_CSS: /tmp/ingest-enclave.css
jobs:
# lint-actions:
# runs-on: mco-dev-small-x64
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Run actionlint with reviewdog
# uses: reviewdog/action-actionlint@v1
# with:
# level: error
# reporter: github-pr-review
# lint-helm:
# runs-on: mco-dev-small-x64
# container:
# image: mobilecoin/gha-k8s-toolbox:v1
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Run helm lint
# run: |
# chart_base=".internal-ci/helm"
# chart_files=$(find "${chart_base}" -name Chart.yaml -type f)
# # helm lint on directories where there are chart.yaml files
# for c in ${chart_files}
# do
# chart=$(dirname "${c}")
# helm lint --quiet "${chart}" 2>&1
# done
# CBB: Need to do refactoring of shell scripts in the repo for this to run cleanly.
# lint-shell:
# runs-on: mco-dev-small-x64
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Run shellcheck with reviewdog
# uses: reviewdog/action-shellcheck@v1
# with:
# level: error
# reporter: github-pr-review
# lint-docker:
# runs-on: mco-dev-small-x64
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Install wget
# run: |
# sudo apt-get update
# sudo apt-get install -y wget
# - name: Run hadolint with reviewdog
# uses: reviewdog/action-hadolint@v1
# with:
# level: error
# reporter: github-pr-review
# exclude: |
# *.dockerignore
# lint-rust:
# runs-on: mco-dev-large-x64
# container:
# image: mobilecoin/rust-sgx-base:v0.0.36
# env:
# SGX_MODE: SW
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Consensus SigStruct
# uses: ./.github/actions/download-sigstruct
# with:
# sigstruct: consensus
# network: test
# download_path: ${{ env.CONSENSUS_ENCLAVE_CSS }}
# - name: Ingest SigStruct
# uses: ./.github/actions/download-sigstruct
# with:
# sigstruct: ingest
# network: test
# download_path: ${{ env.INGEST_ENCLAVE_CSS }}
# - name: Cargo sort
# shell: bash
# run: |
# cargo install cargo-sort --force
# cargo sort --workspace --grouped --check
# - name: Cargo fmt
# shell: bash
# run: |
# cargo fmt -- --unstable-features --check
# - name: Cargo Clippy
# shell: bash
# run: |
# cargo clippy --all --all-features
# test-rust:
# runs-on: mco-dev-large-x64
# container:
# image: mobilecoin/rust-sgx-base:v0.0.36
# env:
# SGX_MODE: SW
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Consensus SigStruct
# uses: ./.github/actions/download-sigstruct
# with:
# sigstruct: consensus
# network: test
# download_path: ${{ env.CONSENSUS_ENCLAVE_CSS }}
# - name: Ingest SigStruct
# uses: ./.github/actions/download-sigstruct
# with:
# sigstruct: ingest
# network: test
# download_path: ${{ env.INGEST_ENCLAVE_CSS }}
# - name: Cargo Test
# shell: bash
# env:
# CARGO_INCREMENTAL: "0"
# RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
# RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
# run: |
# cargo test
# skip coverage for now, old actions-rs/grcov is deprecated
# need to learn how to generate .xml reports for codecov below
# - name: grcov
# shell: bash
# run: |
# cargo install grcov
# - name: Codecov
# uses: codecov/codecov-action@v3.1.4
# with:
# files: ${{ steps.coverage.outputs.report }}
# verbose: true
# fail_ci_if_error: true
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# build-rust-linux:
# strategy:
# matrix:
# runner:
# - mco-dev-large-x64
# network:
# - main
# - test
# runs-on: ${{ matrix.runner }}
# container:
# image: mobilecoin/rust-sgx-base:v0.0.36
# steps:
# - name: Checkout
# uses: mobilecoinofficial/gh-actions/checkout@v0
# - name: Build Rust
# uses: ./.github/actions/build-rust
# with:
# network: ${{ matrix.network }}
build-rust-macos:
strategy:
fail-fast: false
matrix:
runner:
- [self-hosted, macOS, X64]
- [self-hosted, macOS, ARM64]
network:
# - main
- test
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: mobilecoinofficial/gh-actions/checkout@v0
- name: Bootstrap macOS
shell: bash
run: |
echo "-- install brew dependencies"
rm -rf "$(brew --prefix)/var/homebrew/locks"
brew bundle --quiet
echo "-- install rust toolchain"
rm -rf /Users/runner/.cargo
rm -rf /Users/runner/.rustup
rustup toolchain install "$(cat rust-toolchain)"
echo "-- add cargo to path"
rustup_cargo=$(rustup which cargo)
echo "CARGO_HOME=${HOME}/.cargo" >> "${GITHUB_ENV}"
echo "RUSTUP_HOME=${HOME}/.rustup" >> "${GITHUB_ENV}"
echo "${HOME}/.cargo/bin" >> "${GITHUB_PATH}"
echo "$(dirname "${rustup_cargo}")" >> "${GITHUB_PATH}"
- name: Build Rust
uses: ./.github/actions/build-rust
with:
network: ${{ matrix.network }}
# build binaries:
# testnet, mainnet
# linux amd64 arm64
# macos intel, apple
# containers:
# linux arm64, amd64
# test:
# lint
# docker (hadolint)
# shellcheck
# actionlint
# helm lint
# rust/cargo fmt
# rust/cargo clippy
# rust/cargo sort
# unit
# integration - testnet, mainnet