-
Notifications
You must be signed in to change notification settings - Fork 6
176 lines (153 loc) · 5.4 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
name: Build
on:
pull_request:
push:
branches:
- 'master'
tags:
- '**'
jobs:
handle-syncwith:
if: github.event_name == 'pull_request'
name: Call Reusable SyncWith Handler
uses: NilFoundation/ci-cd/.github/workflows/[email protected]
with:
ci-cd-ref: 'v1.1.2'
secrets: inherit
build-linux:
runs-on: [ "self-hosted", "aws_autoscaling"]
needs:
- handle-syncwith
# skipped status occurs on push event
if: ${{ needs.handle-syncwith.result == 'success' || needs.handle-syncwith.result == 'skipped' }}
env:
CONTAINER_TMP: /opt/
HOST_TMP: /home/runner/work/_temp/
DEBIAN_FRONTEND: noninteractive
BOOST_VERSION: "1.80.0"
container:
image: ubuntu:22.04
volumes:
- /home/runner/work/_temp/:/opt/
steps:
- name: Install dependencies
run: |
env && \
apt update && \
apt install -y \
build-essential \
libssl-dev \
cmake \
git \
unzip \
libicu-dev \
curl \
pkg-config \
wget \
\
libspdlog-dev \
liblz4-dev \
libgnutls28-dev \
libprotobuf-dev \
libyaml-cpp-dev \
libsctp-dev \
ragel \
xfslibs-dev \
systemtap-sdt-dev \
libc-ares-dev \
libhwloc-dev
- name: Print toolchain information
run: |
git --version
cc --version
cmake --version
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0
- name: Checkout modules to specified refs
if: needs.handle-syncwith.outputs.prs-refs != ''
uses: NilFoundation/ci-cd/actions/[email protected]
# TODO: figure out the mapping of volumes and use variable here, not hardcoded path
with:
paths: |
/__w/proof-producer/proof-producer/**
!/__w/proof-producer/proof-producer/**/.git/**
refs: ${{ needs.handle-syncwith.outputs.prs-refs }}
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
# Workaround: https://github.com/actions/checkout/issues/1169
- name: Mark directory as safe
run: |
git config --system --add safe.directory $PWD
- name: Install boost
uses: MarkusJx/[email protected]
id: install-boost
with:
# A list of supported versions can be found here:
# https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json
boost_version: ${{ env.BOOST_VERSION }}
boost_install_dir: ${{ env.CONTAINER_TMP }}
platform_version: 22.04
toolset: gcc
arch: x86
- name: Set VERSION variable
# required for building deb packages
# TODO: replace with getting version from git tag or commit SHA1
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Configure CMake
env:
BOOST_ROOT: "${{ steps.install-boost.outputs.BOOST_ROOT }}"
run: |
cmake -G "Unix Makefiles" \
-B build \
-DCMAKE_BUILD_TYPE=Release
- name: Build proof-producers (single- and multithreaded)
# working-directory: build
env:
BOOST_ROOT: "${{ steps.install-boost.outputs.BOOST_ROOT }}"
run: |
cd build
make
cd ..
# make -j $(nproc) -k
- name: Create .deb package
# always build deb packages to check that they're buildable
# although, push them only on tags (see later)
run: |
mkdir -p .debpkg/usr/bin
cp ./build/bin/proof-generator/proof-generator .debpkg/usr/bin
cp ./build/bin/proof-generator-multithreaded/proof-generator-multithreaded .debpkg/usr/bin
chmod +x .debpkg/usr/bin/proof-generator
chmod +x .debpkg/usr/bin/proof-generator-multithreaded
mkdir -p .debpkg/DEBIAN
- uses: jiro4989/build-deb-action@v3
with:
package: proof-generator
package_root: .debpkg
maintainer: =nil; Foundation
version: ${{ env.VERSION }}
arch: 'amd64'
desc: 'zkllvm proof-generator'
- name: Install aws tools
# these steps run only on tag push => deb package release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
pip3 install mkrepo
- name: Upload packages to repository
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
PROOF_GENERATOR_PACKAGE=`ls proof-generator*.deb | cut -d'/' -f2`
POOL="ubuntu/pool/main/p/proof-generator"
aws s3api put-object --bucket deb.nil.foundation --key $POOL/$PROOF_GENERATOR_PACKAGE --body $PROOF_GENERATOR_PACKAGE
mkrepo s3://deb.nil.foundation/ubuntu/