-
Notifications
You must be signed in to change notification settings - Fork 20
165 lines (142 loc) · 5.21 KB
/
main.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
name: Build
on: [push]
jobs:
build:
# needs: [test]
runs-on: ubuntu-latest-8-cores
steps:
- name: Install libarchive-tools
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential autoconf automake libarchive-dev libarchive-tools pandoc
# Building from source cause the provided debian package is for Debian Bookworm
- name: Download, build and install xgenext2fs
run: |
wget https://github.com/cartesi/genext2fs/archive/refs/tags/v1.5.6.tar.gz
echo "34bfc26a037def23b85b676912462a3d126a87ef15c66c212b3500650da44f9e v1.5.6.tar.gz" | sha256sum -c -
tar -xzf v1.5.6.tar.gz
cd genext2fs-1.5.6
./autogen.sh
./configure
make
sudo make install
rm -rf genext2fs-1.5.6 v1.5.6.tar.gz
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Export makefile variables
run: make env >> $GITHUB_ENV
- name: Create debian package control file
run: make control
- name: Create version file
run: make package.json
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Buildx setup
uses: docker/setup-buildx-action@v3
- name: Build [${{ env.TOOLS_DEB }}]
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ env.TOOLS_IMAGE }}
push: false
load: true
build-args: |
TOOLS_DEB=${{ env.TOOLS_DEB }}
IMAGE_KERNEL_VERSION=${{ env.IMAGE_KERNEL_VERSION }}
LINUX_VERSION=${{ env.LINUX_VERSION }}
LINUX_HEADERS_URLPATH=${{ env.LINUX_HEADERS_URLPATH }}
cache-from: type=gha,scope=regular,mode=max
cache-to: type=gha,scope=regular
- name: Retrieve artifacts
run: make copy
- name: Build rootfs
run: make fs
- name: Auto-generate rootfs license information
if: startsWith(github.ref, 'refs/tags/v')
run: make fs-license
- name: Upload rootfs license information
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: |
${{ env.TOOLS_ROOTFS }}.html
- name: Build libcmt
id: docker_build_libcmt
uses: docker/build-push-action@v5
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ env.TOOLS_IMAGE }}-libcmt
push: false
load: true
build-args: |
VERSION=${{ env.VERSION }}
target: libcmt-debian-packager
cache-from: type=gha,scope=regular,mode=max
cache-to: type=gha,scope=regular
- name: Retrieve artifacts
run: make copy-libcmt
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: |
${{ env.TOOLS_DEB }}
${{ env.TOOLS_ROOTFS }}
libcmt/deb/*
- name: Checksum artifacts
if: startsWith(github.ref, 'refs/tags/v')
run: |
sha512sum ${{ env.TOOLS_DEB }} > ${{ env.TOOLS_DEB }}.sha512
sha512sum ${{ env.TOOLS_ROOTFS }} > ${{ env.TOOLS_ROOTFS }}.sha512
for f in libcmt/deb/*; do sha512sum $f > $f.sha512; done
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
prerelease: true
files: |
${{ env.TOOLS_DEB }}
${{ env.TOOLS_DEB }}.sha512
${{ env.TOOLS_ROOTFS }}
${{ env.TOOLS_ROOTFS }}.html
${{ env.TOOLS_ROOTFS }}.sha512
libcmt/deb/*
test:
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Test libcmt mock on host
run: |
make -C sys-utils/libcmt/ -j$(nproc) host test
- name: Test rollup-http-server and echo-dapp client on host
run: |
cd rollup-http/rollup-http-server
MOCK_BUILD=true cargo test -- --show-output --test-threads=1
- name: Test rollup-http-server api schema
run: |
sudo apt-get update
sudo apt-get install -y wait-for-it python3 python3-pip
pip3 install schemathesis
cd rollup-http/rollup-http-server
wget https://raw.githubusercontent.com/cartesi/openapi-interfaces/v0.9.0/rollup.yaml
MOCK_BUILD=true cargo run -- "echo 1" &
wait-for-it localhost:5004 --timeout=30
st run rollup.yaml --checks all --validate-schema true --hypothesis-phases explicit --base-url http://localhost:5004