-
-
Notifications
You must be signed in to change notification settings - Fork 239
185 lines (181 loc) · 5.48 KB
/
Copy pathrust.yml
File metadata and controls
185 lines (181 loc) · 5.48 KB
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
name: Rust
on:
push:
branches:
- master
pull_request:
paths:
- .cargo/config.toml
- .github/workflows/rust.yml
- crates/**
- legacy/**
- wasm/**
- Cargo.lock
- Cargo.toml
- rust-toolchain.toml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
WARPGATE_PLUGINS_DIR: ${{ github.workspace }}/wasm
# WARPGATE_HTTP_NO_TIMEOUTS: true
# WARPGATE_OCI_NO_TIMEOUTS: true
# MOON_DEBUG_WASM: true
MOON_PLUGINS_USE_URL_DIST: true
PROTO_PLUGINS_USE_URL_DIST: true
# RUST_LOG: trace
# setup-rust
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# sccache
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
RUSTC_WRAPPER: ${{ vars.ENABLE_SCCACHE == 'true' && 'sccache' || '' }}
SCCACHE_BUCKET: moon-ci-sccache
SCCACHE_S3_KEY_PREFIX: v1
SCCACHE_GHA_ENABLED: ${{ vars.ENABLE_SCCACHE == 'true' }}
# SCCACHE_LOG: trace
# SCCACHE_NO_DAEMON: 1
SCCACHE_REGION: us-east-2
jobs:
build-wasm:
name: Build WASM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: moonrepo/setup-rust@v1
with:
bins: just
cache: false
targets: wasm32-wasip1
- uses: mozilla-actions/sccache-action@v0.0.9
if: ${{ vars.ENABLE_SCCACHE == 'true' }}
- name: Building crates
run: just build-wasm
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: moonrepo/setup-rust@v1
with:
bins: just
cache: false
components: rustfmt
- uses: mozilla-actions/sccache-action@v0.0.9
if: ${{ vars.ENABLE_SCCACHE == 'true' }}
- name: Check formatting
run: just format-check
lint:
name: Lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v6
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: moonrepo/setup-rust@v1
with:
bins: just
cache: false
components: clippy
- uses: mozilla-actions/sccache-action@v0.0.9
if: ${{ vars.ENABLE_SCCACHE == 'true' }}
- name: Run linter
run: just lint
test-plan:
name: Test plan
runs-on: ubuntu-latest
outputs:
coverage: ${{ steps.plan.outputs.coverage }}
os: ${{ steps.plan.outputs.os }}
steps:
- uses: actions/checkout@v6
- id: plan
run: bash ./scripts/ci/generateTestPlan.sh
env:
COVERAGE:
"${{ (github.event_name == 'pull_request' && contains(github.head_ref, 'develop-') ||
github.event_name == 'push' && github.ref_name == 'master') }}"
test:
name: Test
needs:
- test-plan
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ${{ fromJSON(needs.test-plan.outputs.os) }}
fail-fast: false
env:
# Windows runs out of disk space
COVERAGE: ${{ needs.test-plan.outputs.coverage == 'true' && !contains(matrix.os, 'windows') }}
# Temporary until we upgrade starbase
GIT_AUTHOR_NAME: 'Sandbox'
GIT_AUTHOR_EMAIL: 'fakeemail@somedomain.dev'
GIT_COMMITTER_NAME: 'Sandbox'
GIT_COMMITTER_EMAIL: 'fakeemail@somedomain.dev'
steps:
- uses: actions/checkout@v6
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: moonrepo/setup-rust@v1
with:
bins: just, cargo-nextest, cargo-llvm-cov
cache: false
components: llvm-tools-preview
targets: wasm32-wasip1
- uses: moonrepo/setup-toolchain@v0
with:
auto-install: true
cache: true
proto-version: '0.59.0' # Keep in sync
env:
PROTO_LOG: trace
- uses: mozilla-actions/sccache-action@v0.0.9
if: ${{ vars.ENABLE_SCCACHE == 'true' }}
# Fixes issues where proto can't find a version because nothing is pinned globally
- run: cp .prototools ~/.proto/.prototools
# - run: bash ./scripts/ci/warmPluginsCache.sh
- name: Build plugins
run: just build-wasm
- name: Run tests
if: ${{ env.COVERAGE == 'false' }}
run: just test-ci
- name: Run tests with coverage
if: ${{ env.COVERAGE == 'true' }}
run: just cov
- name: Generate code coverage
if: ${{ env.COVERAGE == 'true' }}
run: just gen-report
- name: Upload coverage report
uses: actions/upload-artifact@v6
if: ${{ env.COVERAGE == 'true' }}
with:
name: coverage-${{ runner.os }}
path: ./report.txt
if-no-files-found: error
coverage:
if: ${{ needs.test-plan.outputs.coverage == 'true' }}
name: Code coverage
runs-on: ubuntu-latest
needs:
- test-plan
- test
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v7
name: Download coverage reports
with:
path: coverage
- uses: codecov/codecov-action@v4
name: Upload to Codecov
with:
# files: ./coverage/coverage-Linux/report.txt,./coverage/coverage-macOS/report.txt,./coverage/coverage-Windows/report.txt
files: ./coverage/coverage-Linux/report.txt,./coverage/coverage-macOS/report.txt
flags: rust
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true