-
Notifications
You must be signed in to change notification settings - Fork 6
180 lines (157 loc) · 5.15 KB
/
release_linux.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
name: Make release
on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: Release type
options:
- major
- minor
- patch
default: minor
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
make-release-linux:
runs-on: [ "self-hosted", Linux, X64, "aws_autoscaling"]
env:
CONTAINER_TMP: /opt/
HOST_TMP: /home/runner/work/_temp/
DEBIAN_FRONTEND: noninteractive
BOOST_VERSION: "1.83.0"
container:
image: ubuntu:22.04
volumes:
- /home/runner/work/_temp/:/opt/
steps:
- name: Install dependencies
# Versions of runtime libraries are set in CPACK_DEBIAN_PACKAGE_DEPENDENCIES_MULTITHREADED_VERSION of CMakeLists.txt.
run: |
env && \
apt update && \
apt install -y \
build-essential \
libssl-dev \
cmake \
git \
unzip \
libicu-dev \
curl \
pkg-config \
wget \
\
libspdlog-dev \
liblz4-dev=1.9.3-2build2 \
libgnutls28-dev=3.7.3-4ubuntu1.3 \
libprotobuf-dev=3.12.4-1ubuntu7.22.04.1 \
libyaml-cpp-dev=0.7.0+dfsg-8build1 \
libsctp-dev \
ragel \
xfslibs-dev \
systemtap-sdt-dev \
libc-ares-dev=1.18.1-1ubuntu0.22.04.2 \
libhwloc-dev=2.7.0-2ubuntu1 \
libc-dev \
lksctp-tools \
libatomic1
- name: Print toolchain information
run: |
git --version
cc --version
cmake --version
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0
# 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: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install aws tools
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
pip3 install mkrepo
# Workaround: https://github.com/actions/checkout/issues/1169
- name: Mark directory as safe
run: |
git config --system --add safe.directory $PWD
- name: Compute release number
env:
RELEASE_TYPE: ${{ inputs.release_type }}
run: |
LATEST_TAG=`git describe --tags | cut -d'-' -f1 | tr -d v`
MAJOR=`echo $LATEST_TAG | cut -d'.' -f1`
MINOR=`echo $LATEST_TAG | cut -d'.' -f2`
PATCH=`echo $LATEST_TAG | cut -d'.' -f3`
case $RELEASE_TYPE in
major)
MAJOR=$((MAJOR+1))
MINOR=0
PATCH=0
;;
minor)
MINOR=$((MINOR+1))
PATCH=0
;;
patch)
PATCH=$((PATCH+1))
;;
*)
echo "Unknown release type"
exit 1
;;
esac
echo "VERSION=$MAJOR.$MINOR.$PATCH" >> $GITHUB_ENV
echo "VERSION=$MAJOR.$MINOR.$PATCH"
- name: Configure CMake
env:
BOOST_ROOT: "${{ steps.install-boost.outputs.BOOST_ROOT }}"
run: |
cmake -G "Unix Makefiles" \
-B build \
-DCMAKE_BUILD_TYPE=Release \
-DBoost_USE_STATIC_LIBS=ON \
-DPROOF_PRODUCER_VERSION=${{ env.VERSION }} .
- name: Build packages
run: |
make -C build package -j$(nproc)
- name: Create release
uses: ncipollo/release-action@v1
with:
name: "proof-producer-v${{ env.VERSION }}"
tag: "v${{ env.VERSION }}"
artifacts: "build/proof-producer_*.deb"
- name: Upload packages to repository
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_PRODUCER_PACKAGE=`ls build/proof-producer_*.deb | cut -d'/' -f2`
POOL="ubuntu/pool/main/z/proof-producer"
aws s3api put-object --bucket deb.nil.foundation --key $POOL/$PROOF_PRODUCER_PACKAGE --body build/$PROOF_PRODUCER_PACKAGE
mkrepo s3://deb.nil.foundation/ubuntu/