Skip to content

Commit ab62dc7

Browse files
committed
Impl initial version of bitte-ci
unfortunately bitte-ci does not (yet) support annotations. We could implement them as a PR comment but having some sort of UX consumable metadata on ci steps might be something worth looking at.
1 parent 4e48c2e commit ab62dc7

File tree

4 files changed

+181
-0
lines changed

4 files changed

+181
-0
lines changed

ci.cue

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
ci: {
2+
version: 1
3+
steps: {
4+
nixexpr: {
5+
label: "ensure Nix expressions are up-to-date"
6+
command: [ "./update-nix.sh", "--check" ]
7+
outputs: [
8+
"/local/repo/nix-expr.patch",
9+
]
10+
}
11+
scalafix: {
12+
label: "scalafix & scalafmt"
13+
command: #sbt + ["formatCheck"]
14+
}
15+
compile: {
16+
label: "compile everything"
17+
command: #sbt + ["compile-all"]
18+
after: ["scalafix"]
19+
}
20+
scalastyle: {
21+
command: #sbt + ["coverage", "scalastyle", "test:scalastyle"]
22+
after: ["compile"]
23+
}
24+
test_bytes: {
25+
label: "bytes tests"
26+
after: ["compile"]
27+
command: #sbt + ["coverage", "bytes/test"]
28+
outputs: [
29+
"/local/repo/bytes/target/test-reports/**/*",
30+
"/local/repo/bytes/target/scala-2.13/scoverage-report/**/*",
31+
"/local/repo/bytes/target/scala-2.13/coverage-report/**/*",
32+
]
33+
}
34+
test_crypto: {
35+
label: "Crypto tests"
36+
after: ["compile"]
37+
command: #sbt + ["coverage", "crypto/test"]
38+
outputs: [
39+
"/local/repo/crypto/target/test-reports/**/*",
40+
"/local/repo/crypto/target/scala-2.13/scoverage-report/**/*",
41+
"/local/repo/crypto/target/scala-2.13/coverage-report/**/*",
42+
]
43+
}
44+
test_rlp: {
45+
label: "RLP tests"
46+
after: ["compile"]
47+
command: #sbt + ["coverage", "rlp/test"]
48+
outputs: [
49+
"/local/repo/rlp/target/test-reports/**/*",
50+
"/local/repo/rlp/target/scala-2.13/scoverage-report/**/*",
51+
"/local/repo/rlp/target/scala-2.13/coverage-report/**/*",
52+
]
53+
}
54+
test_unit: {
55+
label: "Unit tests"
56+
after: ["compile"]
57+
command: #sbt + ["coverage", "test"]
58+
outputs: [
59+
"/local/repo/target/test-reports/**/*",
60+
"/local/repo/target/scala-2.13/scoverage-report/**/*",
61+
"/local/repo/target/scala-2.13/coverage-report/**/*",
62+
]
63+
}
64+
test_evm: {
65+
label: "EVM tests"
66+
after: ["compile"]
67+
command: #sbt + ["coverage", "evm:test"]
68+
outputs: [
69+
"/local/repo/target/test-reports/**/*",
70+
"/local/repo/target/scala-2.13/scoverage-report/**/*",
71+
"/local/repo/target/scala-2.13/coverage-report/**/*",
72+
]
73+
}
74+
test_ets: {
75+
label: "ETS tests"
76+
after: ["compile"]
77+
command: ["./test-ets-bitte.sh"]
78+
outputs: [
79+
"/local/repo/mantis-log.txt",
80+
"/local/repo/retesteth-GeneralStateTests-log.txt",
81+
"/local/repo/retesteth-BlockchainTests-log.txt",
82+
]
83+
}
84+
test_integration: {
85+
label: "integration tests"
86+
after: ["compile"]
87+
command: #sbt + ["coverageOff", "it:test"]
88+
outputs: [
89+
"/local/repo/target/test-reports/**/*",
90+
]
91+
}
92+
additional: {
93+
label: "additional compilation & dist"
94+
after: ["compile", "test_integration"]
95+
command: #sbt + ["coverageOff", "benchmark:compile dist"]
96+
outputs: [
97+
"/local/repo/target/universal/mantis-*.zip",
98+
]
99+
}
100+
publish: {
101+
label: "Publishing libraries to Maven"
102+
after: ["test_crypto", "test_rlp", "test_unit"]
103+
command: [ ".buildkite/publish.sh" ] // TODO
104+
outputs: [
105+
"/local/repo/target/universal/mantis-*.zip",
106+
]
107+
}
108+
}
109+
}
110+
// #sbt: ["sbt", "-v", "-mem", "2048", "-J-Xmx4g", "-Dsbt.ivy.home=/cache/ivy2", "-Dsbt.boot.directory=/cache/sbt", "-Dmaven.repo.local=/cache/maven", "-Dnix=true"]
111+
#sbt: ["sbt", "-v", "-mem", "8192", "-Dnix=true"]
112+
113+
// https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#webhook-payload-object-33
114+
#isNotDraft: pull_request.draft == false
115+
116+
// shared defaults for all steps
117+
#step: {
118+
enable: pull_request.base.ref == "develop" && #isNotDraft
119+
cpu: 5000
120+
memory: 9000
121+
term_timeout: 60 * 60 * 3
122+
kill_timeout: term_timeout + 30
123+
flakes: "github:input-output-hk/mantis": [
124+
"sbt",
125+
"coreutils",
126+
"gnused",
127+
"gnupg",
128+
"solc",
129+
"lllc",
130+
"jdk8",
131+
"retesteth",
132+
"netcat-gnu",
133+
"gnugrep",
134+
"protoc-wrapper",
135+
]
136+
}

nix/overlay.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ rev: final: prev: {
4242

4343
retesteth = final.callPackage ./retesteth.nix { };
4444
lllc = final.callPackage ./lllc.nix { };
45+
protoc-wrapper = final.callPackage ./protoc-wrapper.nix { };
4546
}

nix/protoc-wrapper.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{ pkgs }:
2+
# TODO, share this code with mantis build in this project
3+
# sbt-protoc puts the scala plugin in /tmp/protobridge<some-random-number>.
4+
# it is in fact a shell script with a standard `#!/usr/bin/env sh` shebang
5+
# that makes the Nix sandbox ANGRY and breaks all the things in a cryptic,
6+
# hairpull-inducing way. So we gotta sed it out. Not the prettiest thing
7+
# but it works.
8+
pkgs.writeShellScriptBin "protoc" ''
9+
set -e
10+
11+
for f in "$@"; do
12+
echo ''${f##*=}
13+
done | grep protocbridge | xargs sed -i "1s|.*|#!${pkgs.bash}/bin/bash|"
14+
15+
exec ${pkgs.protobuf}/bin/protoc "$@"
16+
''

test-ets-bitte.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
git submodule init
4+
git submodule update
5+
6+
echo "booting Mantis and waiting for RPC API to be up"
7+
$SBT -Dconfig.file=./src/main/resources/conf/testmode.conf run &> mantis-log.txt &
8+
9+
while ! nc -z localhost 8546; do
10+
sleep 0.1
11+
done
12+
13+
final_exit_code=0
14+
15+
function run {
16+
echo "running retesteth $1"
17+
ets/retesteth -t "$1" &> "retesteth-$1-log.txt"
18+
exit_code=$?
19+
echo "retesteth $1 exit code: $exit_code"
20+
}
21+
22+
run "GeneralStateTests"
23+
run "BlockchainTests"
24+
25+
echo "shutting down mantis"
26+
kill %1
27+
28+
exit $final_exit_code

0 commit comments

Comments
 (0)