-
Notifications
You must be signed in to change notification settings - Fork 75
290 lines (250 loc) · 9.53 KB
/
build.yml
File metadata and controls
290 lines (250 loc) · 9.53 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
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build and test
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GHCR_REGISTRY: ghcr.io
CI_TAG: ci-${{ github.sha }}
jobs:
basic-checks:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Check conventional commit
uses: cocogitto/cocogitto-action@v3
id: conventional_commit_check
with:
check-latest-tag-only: true
- name: Check license header
uses: viperproject/check-license-header@v2
with:
path: ./
config: .github/license-check/config.json
- name: Lint Markdown docs
uses: DavidAnson/markdownlint-cli2-action@v16
with:
globs: |
*.md
docs/*.md
build:
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: read
packages: write
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup variables
run: echo ROLLUPS_NODE_VERSION=`make version` >> $GITHUB_ENV
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Build rollups-node image (amd64)
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
platforms: linux/amd64
tags: ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:devel-amd64-${{ env.CI_TAG }}
push: true
project: ${{ vars.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}
- name: Build rollups-node image (arm64)
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
platforms: linux/arm64
tags: ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:devel-arm64-${{ env.CI_TAG }}
push: true
project: ${{ vars.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}
- name: Build tester image
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
target: tester
platforms: linux/amd64
tags: ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:tester-${{ env.CI_TAG }}
push: true
project: ${{ vars.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}
- name: Build devnet image
uses: depot/build-push-action@v1
with:
file: test/devnet/Dockerfile
context: .
platforms: linux/amd64
tags: ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node-devnet:${{ env.CI_TAG }}
push: true
project: ${{ vars.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}
- name: Build debian package (amd64)
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
target: debian-packager
platforms: linux/amd64
tags: ${{ github.repository_owner }}/rollups-node:debian-packager-amd64
push: false
load: true
project: ${{ vars.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}
- name: Export deb package artifact (amd64)
run: make copy-debian-package BUILD_PLATFORM=linux/amd64 DEB_ARCH=amd64 DEB_PACKAGER_IMG=${{ github.repository_owner }}/rollups-node:debian-packager-amd64
- name: Build debian package (arm64)
uses: depot/build-push-action@v1
with:
file: Dockerfile
context: .
target: debian-packager
platforms: linux/arm64
tags: ${{ github.repository_owner }}/rollups-node:debian-packager-arm64
push: false
load: true
project: ${{ vars.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}
- name: Export deb package artifact (arm64)
run: make copy-debian-package BUILD_PLATFORM=linux/arm64 DEB_ARCH=arm64 DEB_PACKAGER_IMG=${{ github.repository_owner }}/rollups-node:debian-packager-arm64
- name: Upload deb artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
cartesi-rollups-node-v${{ env.ROLLUPS_NODE_VERSION }}_amd64.deb
cartesi-rollups-node-v${{ env.ROLLUPS_NODE_VERSION }}_arm64.deb
lint:
# disabled for now
if: false
runs-on: ubuntu-24.04
needs: [build]
permissions:
contents: read
packages: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull and tag tester image
run: |
docker pull ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:tester-${{ env.CI_TAG }}
docker tag ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:tester-${{ env.CI_TAG }} \
cartesi/rollups-node:tester
- name: Run linting
run: make lint-with-docker
unit-test:
runs-on: ubuntu-24.04
needs: [build]
permissions:
contents: read
packages: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull and tag CI images
run: |
docker pull ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:tester-${{ env.CI_TAG }}
docker pull ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:devel-amd64-${{ env.CI_TAG }}
docker pull ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node-devnet:${{ env.CI_TAG }}
docker tag ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:tester-${{ env.CI_TAG }} \
cartesi/rollups-node:tester
docker tag ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:devel-amd64-${{ env.CI_TAG }} \
cartesi/rollups-node:devel
docker tag ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node-devnet:${{ env.CI_TAG }} \
cartesi/rollups-node-devnet:devel
- name: Cache test machine images
uses: actions/cache@v4
with:
path: test/downloads
key: test-deps-${{ hashFiles('test/dependencies.sha256') }}
- name: Download test dependencies
run: make download-test-dependencies
- name: Run unit tests
run: make unit-test-with-compose
integration-test:
runs-on: ubuntu-24.04
needs: [build]
timeout-minutes: 60
permissions:
contents: read
packages: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull and tag CI images
run: |
docker pull ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:tester-${{ env.CI_TAG }}
docker pull ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:devel-amd64-${{ env.CI_TAG }}
docker pull ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node-devnet:${{ env.CI_TAG }}
docker tag ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:tester-${{ env.CI_TAG }} \
cartesi/rollups-node:tester
docker tag ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node:devel-amd64-${{ env.CI_TAG }} \
cartesi/rollups-node:devel
docker tag ${{ env.GHCR_REGISTRY }}/${{ github.repository_owner }}/rollups-node-devnet:${{ env.CI_TAG }} \
cartesi/rollups-node-devnet:devel
- name: Cache test machine images
uses: actions/cache@v4
with:
path: test/downloads
key: test-deps-${{ hashFiles('test/dependencies.sha256') }}
- name: Download test dependencies
run: make download-test-dependencies
- name: Run integration tests
run: make integration-test-with-compose
- name: Upload integration test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-test-logs
path: integration-logs.txt
retention-days: 3
publish_artifacts:
name: Publish artifacts
needs: [basic-checks, build, unit-test, integration-test]
runs-on: ubuntu-24.04
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
permissions:
contents: write
steps:
- name: Checkout emulator source code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Upload products to GitHub Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
artifacts/cartesi-rollups-node-v*.deb