Skip to content

Commit

Permalink
Impl initial version of bitte-ci
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blaggacao committed Aug 23, 2021
1 parent 4e48c2e commit ab62dc7
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 0 deletions.
136 changes: 136 additions & 0 deletions ci.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
ci: {
version: 1
steps: {
nixexpr: {
label: "ensure Nix expressions are up-to-date"
command: [ "./update-nix.sh", "--check" ]
outputs: [
"/local/repo/nix-expr.patch",
]
}
scalafix: {
label: "scalafix & scalafmt"
command: #sbt + ["formatCheck"]
}
compile: {
label: "compile everything"
command: #sbt + ["compile-all"]
after: ["scalafix"]
}
scalastyle: {
command: #sbt + ["coverage", "scalastyle", "test:scalastyle"]
after: ["compile"]
}
test_bytes: {
label: "bytes tests"
after: ["compile"]
command: #sbt + ["coverage", "bytes/test"]
outputs: [
"/local/repo/bytes/target/test-reports/**/*",
"/local/repo/bytes/target/scala-2.13/scoverage-report/**/*",
"/local/repo/bytes/target/scala-2.13/coverage-report/**/*",
]
}
test_crypto: {
label: "Crypto tests"
after: ["compile"]
command: #sbt + ["coverage", "crypto/test"]
outputs: [
"/local/repo/crypto/target/test-reports/**/*",
"/local/repo/crypto/target/scala-2.13/scoverage-report/**/*",
"/local/repo/crypto/target/scala-2.13/coverage-report/**/*",
]
}
test_rlp: {
label: "RLP tests"
after: ["compile"]
command: #sbt + ["coverage", "rlp/test"]
outputs: [
"/local/repo/rlp/target/test-reports/**/*",
"/local/repo/rlp/target/scala-2.13/scoverage-report/**/*",
"/local/repo/rlp/target/scala-2.13/coverage-report/**/*",
]
}
test_unit: {
label: "Unit tests"
after: ["compile"]
command: #sbt + ["coverage", "test"]
outputs: [
"/local/repo/target/test-reports/**/*",
"/local/repo/target/scala-2.13/scoverage-report/**/*",
"/local/repo/target/scala-2.13/coverage-report/**/*",
]
}
test_evm: {
label: "EVM tests"
after: ["compile"]
command: #sbt + ["coverage", "evm:test"]
outputs: [
"/local/repo/target/test-reports/**/*",
"/local/repo/target/scala-2.13/scoverage-report/**/*",
"/local/repo/target/scala-2.13/coverage-report/**/*",
]
}
test_ets: {
label: "ETS tests"
after: ["compile"]
command: ["./test-ets-bitte.sh"]
outputs: [
"/local/repo/mantis-log.txt",
"/local/repo/retesteth-GeneralStateTests-log.txt",
"/local/repo/retesteth-BlockchainTests-log.txt",
]
}
test_integration: {
label: "integration tests"
after: ["compile"]
command: #sbt + ["coverageOff", "it:test"]
outputs: [
"/local/repo/target/test-reports/**/*",
]
}
additional: {
label: "additional compilation & dist"
after: ["compile", "test_integration"]
command: #sbt + ["coverageOff", "benchmark:compile dist"]
outputs: [
"/local/repo/target/universal/mantis-*.zip",
]
}
publish: {
label: "Publishing libraries to Maven"
after: ["test_crypto", "test_rlp", "test_unit"]
command: [ ".buildkite/publish.sh" ] // TODO
outputs: [
"/local/repo/target/universal/mantis-*.zip",
]
}
}
}
// #sbt: ["sbt", "-v", "-mem", "2048", "-J-Xmx4g", "-Dsbt.ivy.home=/cache/ivy2", "-Dsbt.boot.directory=/cache/sbt", "-Dmaven.repo.local=/cache/maven", "-Dnix=true"]
#sbt: ["sbt", "-v", "-mem", "8192", "-Dnix=true"]

// https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#webhook-payload-object-33
#isNotDraft: pull_request.draft == false

// shared defaults for all steps
#step: {
enable: pull_request.base.ref == "develop" && #isNotDraft
cpu: 5000
memory: 9000
term_timeout: 60 * 60 * 3
kill_timeout: term_timeout + 30
flakes: "github:input-output-hk/mantis": [
"sbt",
"coreutils",
"gnused",
"gnupg",
"solc",
"lllc",
"jdk8",
"retesteth",
"netcat-gnu",
"gnugrep",
"protoc-wrapper",
]
}
1 change: 1 addition & 0 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ rev: final: prev: {

retesteth = final.callPackage ./retesteth.nix { };
lllc = final.callPackage ./lllc.nix { };
protoc-wrapper = final.callPackage ./protoc-wrapper.nix { };
}
16 changes: 16 additions & 0 deletions nix/protoc-wrapper.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ pkgs }:
# TODO, share this code with mantis build in this project
# sbt-protoc puts the scala plugin in /tmp/protobridge<some-random-number>.
# it is in fact a shell script with a standard `#!/usr/bin/env sh` shebang
# that makes the Nix sandbox ANGRY and breaks all the things in a cryptic,
# hairpull-inducing way. So we gotta sed it out. Not the prettiest thing
# but it works.
pkgs.writeShellScriptBin "protoc" ''
set -e
for f in "$@"; do
echo ''${f##*=}
done | grep protocbridge | xargs sed -i "1s|.*|#!${pkgs.bash}/bin/bash|"
exec ${pkgs.protobuf}/bin/protoc "$@"
''
28 changes: 28 additions & 0 deletions test-ets-bitte.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

git submodule init
git submodule update

echo "booting Mantis and waiting for RPC API to be up"
$SBT -Dconfig.file=./src/main/resources/conf/testmode.conf run &> mantis-log.txt &

while ! nc -z localhost 8546; do
sleep 0.1
done

final_exit_code=0

function run {
echo "running retesteth $1"
ets/retesteth -t "$1" &> "retesteth-$1-log.txt"
exit_code=$?
echo "retesteth $1 exit code: $exit_code"
}

run "GeneralStateTests"
run "BlockchainTests"

echo "shutting down mantis"
kill %1

exit $final_exit_code

0 comments on commit ab62dc7

Please sign in to comment.