-
Notifications
You must be signed in to change notification settings - Fork 52
234 lines (203 loc) · 7.63 KB
/
build.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
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
name: Build, Lint, and Test
on:
push:
branches:
- 'develop'
- 'main'
pull_request:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
just_variants:
- async_std
- tokio
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout Repository
- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching
with:
shared-key: ""
prefix-key: ${{ matrix.just_variants }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Install Just
run: |
wget https://github.com/casey/just/releases/download/1.14.0/just-1.14.0-x86_64-unknown-linux-musl.tar.gz
tar -vxf just-1.14.0-x86_64-unknown-linux-musl.tar.gz just
sudo cp just /usr/bin/just
- name: Run linting
run: |
just ${{ matrix.just_variants }} lint
- name: Build all crates in workspace
run: just ${{ matrix.just_variants }} build
- name: Unit and integration tests for all crates in workspace
run: |
just ${{ matrix.just_variants }} test
timeout-minutes: 60
env:
RUST_BACKTRACE: full
- name: Upload Binaries
uses: actions/upload-artifact@v3
with:
name: binaries-amd64-${{ matrix.just_variants }}
path: |
target/debug/examples/counter
target/debug/examples/libp2p-multi-validator
target/debug/examples/libp2p-orchestrator
target/debug/examples/libp2p-validator
target/debug/examples/multi-validator
target/debug/examples/multi-web-server
target/debug/examples/web-server
target/debug/examples/web-server-da-orchestrator
target/debug/examples/web-server-da-validator
build-arm:
strategy:
matrix:
just_variants:
- async_std
- tokio
runs-on: [self-hosted, arm64]
steps:
- name: Fix permissions
run: sudo chown -R runner1 /home/runner1/actions-runner/_work/HotShot
- uses: actions/checkout@v4
name: Checkout Repository
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
name: Enable Rust Caching
with:
shared-key: ""
prefix-key: arm-${{ matrix.just_variants }}
- name: Build all crates in workspace
run: just ${{ matrix.just_variants }} build
- name: Upload Binaries
uses: actions/upload-artifact@v3
with:
name: binaries-aarch64-${{ matrix.just_variants }}
path: |
target/debug/examples/counter
target/debug/examples/libp2p-multi-validator
target/debug/examples/libp2p-orchestrator
target/debug/examples/libp2p-validator
target/debug/examples/multi-validator
target/debug/examples/multi-web-server
target/debug/examples/web-server
target/debug/examples/web-server-da-orchestrator
target/debug/examples/web-server-da-validator
build-dockers:
strategy:
matrix:
just_variants:
- async_std
- tokio
runs-on: ubuntu-latest
needs: [build, build-arm]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Docker BuildKit (buildx)
uses: docker/setup-buildx-action@v3
- name: Login to Github Container Repo
uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download executables AMD
uses: actions/download-artifact@v3
with:
name: binaries-amd64-${{ matrix.just_variants }}
path: target/amd64/debug/examples
- name: Download executables ARM
uses: actions/download-artifact@v3
with:
name: binaries-aarch64-${{ matrix.just_variants }}
path: target/arm64/debug/examples
- name: Generate libp2p-orchestrator docker metadata
uses: docker/metadata-action@v5
id: libp2p-orchestrator
with:
images: ghcr.io/espressosystems/hotshot/libp2p-orchestrator
flavor: suffix=-${{ matrix.just_variants }}
- name: Generate libp2p-validator docker metadata
uses: docker/metadata-action@v5
id: libp2p-validator
with:
images: ghcr.io/espressosystems/hotshot/libp2p-validator
flavor: suffix=-${{ matrix.just_variants }}
- name: Generate web-server docker metadata
uses: docker/metadata-action@v5
id: web-server
with:
images: ghcr.io/espressosystems/hotshot/web-server
flavor: suffix=-${{ matrix.just_variants }}
- name: Generate web-server-da-orchestrator docker metadata
uses: docker/metadata-action@v5
id: web-server-da-orchestrator
with:
images: ghcr.io/espressosystems/hotshot/web-server-da-orchestrator
flavor: suffix=-${{ matrix.just_variants }}
- name: Generate web-server-da-validator docker metadata
uses: docker/metadata-action@v5
id: web-server-da-validator
with:
images: ghcr.io/espressosystems/hotshot/web-server-da-validator
flavor: suffix=-${{ matrix.just_variants }}
- name: Build and push libp2p-orchestrator docker
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/libp2p-orchestrator.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.libp2p-orchestrator.outputs.tags }}
labels: ${{ steps.libp2p-orchestrator.outputs.labels }}
- name: Build and push libp2p-validator docker
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/libp2p-validator.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.libp2p-validator.outputs.tags }}
labels: ${{ steps.libp2p-validator.outputs.labels }}
- name: Build and push web-server docker
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/web-server.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.web-server.outputs.tags }}
labels: ${{ steps.web-server.outputs.labels }}
- name: Build and push web-server-da-orchestrator docker
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/web-server-da-orchestrator.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.web-server-da-orchestrator.outputs.tags }}
labels: ${{ steps.web-server-da-orchestrator.outputs.labels }}
- name: Build and push web-server-da-validator docker
uses: docker/build-push-action@v5
with:
context: ./
file: ./docker/web-server-da-validator.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.web-server-da-validator.outputs.tags }}
labels: ${{ steps.web-server-da-validator.outputs.labels }}