Skip to content

Commit a743114

Browse files
authored
Arch/Ubuntu Linux packaging (#398)
* package/PKGBUILD: add packaging file for arch * INSTALL: add installation instructions for packaging KEVM * Jenkinsfile: add Deploy stage for building/uploading packages * .gitignore: update ignored files * package/debian: packaging setup for ubuntu 18.04 * package/Dockerfile.{arch,ubuntu-bionic}: dockerfiles for building the Arch/Ubuntu packages * package/{debian,PKGBUILD}: set DESTDIR and INSTALL_PREFIX manually * Jenkinsfile: only run build/test steps on PRs * Jenkinsfile: add slack notification on deploy failure * .gitignore: update ignored dirs
1 parent beb07a1 commit a743114

File tree

10 files changed

+368
-83
lines changed

10 files changed

+368
-83
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
/.build/*
22
/rustc-*
3+
/pkg
4+
/src
5+
/package/pkg
6+
/package/src

INSTALL.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
Installing Release Builds
2+
=========================
3+
4+
These instructions explain how to download, install, and build the KEVM packages.
5+
Current supported systems are:
6+
7+
- Arch Linux
8+
- Ubuntu Bionic (18.04)
9+
10+
Downloading Packages
11+
--------------------
12+
13+
We release our packages on GitHub, visit the [Releases](https://github.com/kframework/evm-semantics/releases) page to see available versions.
14+
Releases are generated as often as possible from the `master` branch of the repository.
15+
16+
Installing Packages
17+
-------------------
18+
19+
### Ubuntu/Debian
20+
21+
Install the package with (`X.Y.Z` is version number, `ID` is platform identifier):
22+
23+
```sh
24+
sudo apt install ./kevm_X.Y.Z_amd64_ID.deb
25+
```
26+
27+
### Arch
28+
29+
Install the package with (`X.Y.Z-V` is version number):
30+
31+
```sh
32+
sudo pacman -U ./kevm-git-X.Y.Z-V-x86_64.pkg.tar.xz
33+
```
34+
35+
Building Packages
36+
-----------------
37+
38+
Make sure to bump the version numbers in the following places:
39+
40+
- `RELEASE_ID` in `Jenkinsfile`,
41+
- `pkgver` in `package/PKGBUILD`, and
42+
- version number in `package/debian/changelog`.
43+
44+
If these numbers do not agree, then building the release will not work.
45+
46+
### Ubuntu/Debian
47+
48+
Build the package in by running:
49+
50+
```sh
51+
cp -r package/debian ./
52+
dpkg-buildpackage --no-sign
53+
```
54+
55+
This will throw an error for any build dependencies you're missing, install them with `sudo apt install ...`.
56+
The `kevm_X.Y.Z_amd64_ID.deb` package will be placed one directory up from the repository root.
57+
58+
### Arch
59+
60+
Build the package with:
61+
62+
```sh
63+
cd package
64+
makepkg -s
65+
```
66+
67+
This will put `kevm-git-X.Y.Z-V-x86_64.pkg.tar.xz` in the current directory.

Jenkinsfile

Lines changed: 174 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
pipeline {
2-
agent {
3-
dockerfile {
4-
additionalBuildArgs '--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)'
5-
args '-m 60g'
6-
}
7-
}
2+
agent none
83
options {
94
ansiColor('xterm')
105
}
@@ -17,117 +12,213 @@ pipeline {
1712
}
1813
}
1914
}
20-
stage('Dependencies') {
21-
steps {
22-
sh '''
23-
make all-deps -B
24-
make split-tests -B
25-
'''
26-
}
27-
}
28-
stage('Build') {
29-
steps {
30-
sh '''
31-
make build build-llvm build-haskell build-node -j4 -B
32-
'''
15+
stage('Build and Test') {
16+
when { changeRequest() }
17+
agent {
18+
dockerfile {
19+
additionalBuildArgs '--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)'
20+
args '-m 60g'
21+
}
3322
}
34-
}
35-
stage('Test Execution') {
36-
failFast true
37-
parallel {
38-
stage('Conformance (OCaml)') {
23+
stages {
24+
stage('Dependencies') {
3925
steps {
4026
sh '''
41-
nprocs=$(nproc)
42-
[ "$nprocs" -gt '16' ] && nprocs='16'
43-
make test-conformance -j"$nprocs" TEST_CONCRETE_BACKEND=ocaml
27+
make all-deps -B
28+
make split-tests -B
4429
'''
4530
}
4631
}
47-
stage('Conformance (LLVM)') {
32+
stage('Build') {
4833
steps {
4934
sh '''
50-
nprocs=$(nproc)
51-
[ "$nprocs" -gt '16' ] && nprocs='16'
52-
make test-conformance -j"$nprocs" TEST_CONCRETE_BACKEND=llvm
35+
make build build-llvm build-haskell build-node -j4 -B
5336
'''
5437
}
5538
}
56-
}
57-
}
58-
stage('Test Proofs (Java)') {
59-
options {
60-
lock("proofs-${env.NODE_NAME}")
61-
}
62-
steps {
63-
sh '''
64-
nprocs=$(nproc)
65-
[ "$nprocs" -gt '6' ] && nprocs='6'
66-
make test-proof -j"$nprocs"
67-
'''
68-
}
69-
}
70-
stage('Test Interactive') {
71-
failFast true
72-
parallel {
73-
stage('OCaml krun') {
74-
steps {
75-
sh '''
76-
make test-interactive-run TEST_CONCRETE_BACKEND=ocaml
77-
'''
39+
stage('Test Execution') {
40+
failFast true
41+
parallel {
42+
stage('Conformance (OCaml)') {
43+
steps {
44+
sh '''
45+
nprocs=$(nproc)
46+
[ "$nprocs" -gt '16' ] && nprocs='16'
47+
make test-conformance -j"$nprocs" TEST_CONCRETE_BACKEND=ocaml
48+
'''
49+
}
50+
}
51+
stage('Conformance (LLVM)') {
52+
steps {
53+
sh '''
54+
nprocs=$(nproc)
55+
[ "$nprocs" -gt '16' ] && nprocs='16'
56+
make test-conformance -j"$nprocs" TEST_CONCRETE_BACKEND=llvm
57+
'''
58+
}
59+
}
7860
}
7961
}
80-
stage('LLVM krun') {
81-
steps {
82-
sh '''
83-
make test-interactive-run TEST_CONCRETE_BACKEND=llvm
84-
'''
62+
stage('Test Proofs (Java)') {
63+
options {
64+
lock("proofs-${env.NODE_NAME}")
8565
}
86-
}
87-
stage('Java krun') {
8866
steps {
8967
sh '''
90-
make test-interactive-run TEST_CONCRETE_BACKEND=java
68+
nprocs=$(nproc)
69+
[ "$nprocs" -gt '6' ] && nprocs='6'
70+
make test-proof -j"$nprocs"
9171
'''
9272
}
9373
}
94-
stage('Haskell krun') {
95-
steps {
96-
sh '''
97-
make test-interactive-run TEST_CONCRETE_BACKEND=haskell
98-
'''
74+
stage('Test Interactive') {
75+
failFast true
76+
parallel {
77+
stage('OCaml krun') {
78+
steps {
79+
sh '''
80+
make test-interactive-run TEST_CONCRETE_BACKEND=ocaml
81+
'''
82+
}
83+
}
84+
stage('LLVM krun') {
85+
steps {
86+
sh '''
87+
make test-interactive-run TEST_CONCRETE_BACKEND=llvm
88+
'''
89+
}
90+
}
91+
stage('Java krun') {
92+
steps {
93+
sh '''
94+
make test-interactive-run TEST_CONCRETE_BACKEND=java
95+
'''
96+
}
97+
}
98+
stage('Haskell krun') {
99+
steps {
100+
sh '''
101+
make test-interactive-run TEST_CONCRETE_BACKEND=haskell
102+
'''
103+
}
104+
}
105+
stage('OCaml kast') {
106+
steps {
107+
sh '''
108+
make test-parse TEST_CONCRETE_BACKEND=ocaml
109+
'''
110+
}
111+
}
112+
stage('Failing tests') {
113+
steps {
114+
sh '''
115+
make test-failure TEST_CONCRETE_BACKEND=ocaml
116+
make test-failure TEST_CONCRETE_BACKEND=llvm
117+
'''
118+
}
119+
}
120+
stage('Java KLab') {
121+
steps {
122+
sh '''
123+
make test-klab-prove TEST_SYMBOLIC_BACKEND=java
124+
'''
125+
}
126+
}
127+
stage('KEVM help') {
128+
steps {
129+
sh '''
130+
./kevm help
131+
'''
132+
}
133+
}
99134
}
100135
}
101-
stage('OCaml kast') {
102-
steps {
103-
sh '''
104-
make test-parse TEST_CONCRETE_BACKEND=ocaml
105-
'''
106-
}
136+
}
137+
}
138+
stage('Deploy') {
139+
when {
140+
not { changeRequest() }
141+
branch 'master'
142+
beforeAgent true
143+
}
144+
agent { label 'docker' }
145+
options { skipDefaultCheckout() }
146+
environment {
147+
GITHUB_TOKEN = credentials('rv-jenkins')
148+
RELEASE_ID = '1.0.0'
149+
}
150+
stages {
151+
stage('Checkout SCM') {
152+
steps { dir("kevm-${env.RELEASE_ID}") { checkout scm } }
107153
}
108-
stage('Failing tests') {
154+
stage('Build Ubuntu Package') {
155+
agent {
156+
dockerfile {
157+
dir "kevm-${env.RELEASE_ID}/package"
158+
filename 'Dockerfile.ubuntu-bionic'
159+
reuseNode true
160+
}
161+
}
109162
steps {
110-
sh '''
111-
make test-failure TEST_CONCRETE_BACKEND=ocaml
112-
make test-failure TEST_CONCRETE_BACKEND=llvm
113-
'''
163+
dir("kevm-${env.RELEASE_ID}") {
164+
sh '''
165+
sudo apt update && sudo apt upgrade --yes
166+
cp -r package/debian ./
167+
dpkg-buildpackage --no-sign
168+
'''
169+
}
170+
stash name: 'bionic', includes: "kevm_${env.RELEASE_ID}_amd64.deb"
114171
}
115172
}
116-
stage('Java KLab') {
173+
stage('Build Arch Package') {
174+
agent {
175+
dockerfile {
176+
dir "kevm-${env.RELEASE_ID}/package"
177+
filename 'Dockerfile.arch'
178+
additionalBuildArgs '--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g)'
179+
reuseNode true
180+
}
181+
}
117182
steps {
118-
sh '''
119-
make test-klab-prove TEST_SYMBOLIC_BACKEND=java
120-
'''
183+
dir("kevm-${env.RELEASE_ID}") {
184+
sh '''
185+
sudo pacman -Syu
186+
cd package
187+
makepkg --noconfirm --syncdeps
188+
'''
189+
}
190+
stash name: 'arch', includes: "kevm-${env.RELEASE_ID}/package/kevm-git-${env.RELEASE_ID}-1-x86_64.pkg.tar.xz"
121191
}
122192
}
123-
stage('KEVM help') {
193+
stage('Upload Packages') {
194+
agent {
195+
dockerfile {
196+
dir 'package'
197+
filename 'Dockerfile.arch'
198+
reuseNode true
199+
}
200+
}
124201
steps {
202+
unstash 'bionic'
203+
unstash 'arch'
125204
sh '''
126-
./kevm help
205+
git_commit=$(cd kevm-$RELEASE_ID && git rev-parse --short HEAD)
206+
hub release create \
207+
--attach "kevm_${RELEASE_ID}_amd64.deb#Ubuntu Bionic (18.04) Package" \
208+
--attach "kevm-${RELEASE_ID}/package/kevm-git-${RELEASE_ID}-1-x86_64.pkg.tar.xz#Arch Package" \
209+
--message "$(echo -e "KEVM Release $RELEASE_ID - $git_commit\n\n" ; cat kevm-${RELEASE_ID}/INSTALL.md ;)" \
210+
--commitish $(git rev-parse HEAD) "v$RELEASE_ID-$git_commit"
127211
'''
128212
}
129213
}
130214
}
215+
post {
216+
failure {
217+
slackSend color: '#cb2431' \
218+
, channel: '#kevm' \
219+
, message: "KEVM Packaging Failed: ${env.BUILD_URL}"
220+
}
221+
}
131222
}
132223
}
133224
}

package/Dockerfile.arch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM archlinux/base
2+
3+
RUN pacman -Syu --noconfirm \
4+
&& pacman -S --noconfirm git hub sudo
5+
6+
ADD https://github.com/kframework/k/releases/download/nightly-89361d7c8/kframework-5.0.0-1-x86_64.pkg.tar.xz kframework_5.0.0-1_x86_64.pkg.tar.xz
7+
RUN pacman --noconfirm -U ./kframework_5.0.0-1_x86_64.pkg.tar.xz
8+
9+
ARG USER_ID=1000
10+
ARG GROUP_ID=1000
11+
RUN groupadd -g $GROUP_ID user \
12+
&& useradd --create-home --uid $USER_ID --shell /bin/sh --gid $GROUP_ID user \
13+
&& echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

0 commit comments

Comments
 (0)