Skip to content

Commit 0e86807

Browse files
committed
Migrate CircleCI to Buildkite
- Use Nixkite to define a Buildkite pipeline in Nix. - Modify the "test-ets.sh" script to reflect the new Buildkite environment. - Remove old CircleCI config. - Update the solidity compiler to version 0.5.1 because that's the version currently available in the Nix environment.
1 parent 6a58490 commit 0e86807

File tree

19 files changed

+248
-171
lines changed

19 files changed

+248
-171
lines changed

.buildkite/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import (import ../nix/sources.nix).nixkite

.buildkite/pipeline.nix

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{ cfg, pkgs, ... }:
2+
3+
with cfg.steps.commands;
4+
5+
let
6+
commonAttrs = {
7+
retry.automatic = true;
8+
agents.queue = "project42";
9+
};
10+
in
11+
12+
{
13+
steps.commands = {
14+
compile = commonAttrs // {
15+
label = "compile everything";
16+
command = ''
17+
nix-shell --run '$SBT compile-all'
18+
'';
19+
};
20+
21+
style = commonAttrs // {
22+
dependsOn = [ compile ];
23+
label = "scalastyle";
24+
command = ''
25+
nix-shell --run '$SBT scalastyle test:scalastyle'
26+
'';
27+
};
28+
29+
test-unit = commonAttrs // {
30+
dependsOn = [ compile ];
31+
label = "unit tests";
32+
command = ''
33+
nix-shell --run '$SBT coverage test'
34+
'';
35+
artifactPaths = [
36+
"target/test-reports/**/*"
37+
"target/scala/2.12/scoverage-report/**/*"
38+
"target/scala/2.12/coverage-report/**/*"
39+
];
40+
};
41+
42+
test-evm = commonAttrs // {
43+
dependsOn = [ compile ];
44+
label = "EVM tests";
45+
command = ''
46+
nix-shell --run '$SBT coverage evm:test'
47+
'';
48+
artifactPaths = [
49+
"target/test-reports/**/*"
50+
"target/scala/2.12/scoverage-report/**/*"
51+
"target/scala/2.12/coverage-report/**/*"
52+
];
53+
};
54+
55+
test-integration = commonAttrs // {
56+
dependsOn = [ compile ];
57+
label = "integration tests";
58+
command = ''
59+
nix-shell --run '$SBT coverageOff it:test'
60+
'';
61+
artifactPaths = [ "target/test-reports/**/*" ];
62+
};
63+
64+
test-ets = commonAttrs // {
65+
dependsOn = [ compile ];
66+
label = "ETS";
67+
command = ''
68+
nix-shell --run './test-ets.sh'
69+
'';
70+
};
71+
72+
coverageReport = commonAttrs // {
73+
dependsOn = [ test-unit test-evm ];
74+
label = "coverage report";
75+
command = ''
76+
nix-shell --run '$SBT coverageReport coverageAggregate'
77+
'';
78+
};
79+
80+
additional = commonAttrs // {
81+
dependsOn = [ compile ];
82+
label = "additional compilation & dist";
83+
command = ''
84+
nix-shell --run '$SBT benchmark:compile snappy:compile dist'
85+
'';
86+
};
87+
};
88+
}

.buildkite/pipeline.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# steps:
2+
# - label: compile everything
3+
# command:
4+
# - "nix-shell --run '$SBT compile-all'"
5+
# retry:
6+
# automatic: true
7+
8+
# - wait
9+
10+
# # - label: scalastyle
11+
# # command:
12+
# # - "nix-shell --run '$SBT scalastyle test:scalastyle'"
13+
14+
# # - wait
15+
16+
# # - label: unit tests
17+
# # command:
18+
# # - "nix-shell --run '$SBT coverage test'"
19+
# # artifact_paths:
20+
# # - "target/test-reports/**/*"
21+
# # - "target/scala/2.12/scoverage-report/**/*"
22+
# # - "target/scala/2.12/coverage-report/**/*"
23+
24+
# # - wait
25+
26+
# # - label: EVM tests
27+
# # command:
28+
# # - "nix-shell --run '$SBT coverage evm:test'"
29+
# # artifact_paths:
30+
# # - "target/test-reports/**/*"
31+
# # - "target/scala/2.12/scoverage-report/**/*"
32+
# # - "target/scala/2.12/coverage-report/**/*"
33+
34+
# # - wait
35+
36+
# # - label: integration tests
37+
# # command:
38+
# # - "nix-shell --run '$SBT coverageOff it:test'"
39+
# # artifact_paths:
40+
# # - "target/test-reports/**/*"
41+
42+
# # - wait
43+
44+
# # - label: coverage report
45+
# # command:
46+
# # - "nix-shell --run '$SBT coverageReport coverageAggregate'"
47+
# # retry:
48+
# # automatic: true
49+
50+
# # - wait
51+
52+
# # - label: ETS
53+
# # command:
54+
# # - "nix-shell --run './test-ets.sh'"
55+
56+
# # - wait
57+
58+
# # - label: additional compilation & dist
59+
# # command:
60+
# # - "nix-shell --run '$SBT benchmark:compile snappy:compile dist'"
61+
steps:
62+
- label: ":nix::point_right::pipeline:"
63+
command: |
64+
export NIX_PATH="nixpkgs=$(nix eval --raw '(import nix/sources.nix).nixpkgs')"
65+
nix eval --json '(import ./.buildkite { pipeline = ./.buildkite/pipeline.nix; })' \
66+
| buildkite-agent pipeline upload --no-interpolation
67+
agents:
68+
queue: project42

.buildkite/shell.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{ pkgs }:
2+
3+
let
4+
5+
# TODO, share this code with mantis build in this project
6+
# sbt-protoc puts the scala plugin in /tmp/protobridge<some-random-number>.
7+
# it is in fact a shell script with a standard `#!/usr/bin/env sh` shebang
8+
# that makes the Nix sandbox ANGRY and breaks all the things in a cryptic,
9+
# hairpull-inducing way. So we gotta sed it out. Not the prettiest thing
10+
# but it works.
11+
protoc-wrapper = pkgs.writeShellScriptBin "protoc" ''
12+
set -e
13+
14+
for f in "$@"; do
15+
echo ''${f##*=}
16+
done | grep protocbridge | xargs sed -i "1s|.*|#!${pkgs.bash}/bin/bash|"
17+
18+
exec ${pkgs.protobuf}/bin/protoc "$@"
19+
'';
20+
21+
in
22+
23+
with pkgs;
24+
25+
mkShell {
26+
27+
buildInputs = [ sbt solc jdk8 protoc-wrapper ];
28+
# SBT = "sbt -v -mem 2048 -J-Xmx4g -Dsbt.ivy.home=/cache/ivy2 -Dsbt.boot.directory=/cache/sbt -Dmaven.repo.local=/cache/maven -Dnix=true";
29+
SBT = "sbt -v -mem 2048 -J-Xmx4g -Dnix=true";
30+
}

.circleci/Dockerfile

Lines changed: 0 additions & 28 deletions
This file was deleted.

.circleci/config.yml

Lines changed: 0 additions & 100 deletions
This file was deleted.

nix/sources.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@
3535
"url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz",
3636
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
3737
},
38+
"nixkite": {
39+
"branch": "master",
40+
"description": "Nixkite is a Buildkite pipeline generation tool using the NixOS module system",
41+
"homepage": null,
42+
"owner": "input-output-hk",
43+
"repo": "nixkite",
44+
"rev": "11c40d1591e294a2da275aaeb9e21a45319a4673",
45+
"sha256": "1cfiqv4n54g9xkm5zvypxfrr8ajpbggvpjn6dp1l9kfc2aknpgiz",
46+
"type": "tarball",
47+
"url": "https://github.com/input-output-hk/nixkite/archive/11c40d1591e294a2da275aaeb9e21a45319a4673.tar.gz",
48+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
49+
},
3850
"nixpkgs": {
3951
"branch": "nixos-20.03",
4052
"description": "Nixpkgs/NixOS branches that track the Nixpkgs/NixOS channels",

src/evmTest/resources/solidity/CallSelfDestruct.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
pragma solidity ^0.4.10;
1+
pragma solidity ^0.5.1;
22

33
contract CallSelfDestruct {
44

5-
function callDestruct() {
5+
function callDestruct() public {
66
CallSelfDestruct firstCall = CallSelfDestruct(this);
77
firstCall.doSelfdestruct();
88

99
CallSelfDestruct secondCall = CallSelfDestruct(this);
1010
secondCall.doSelfdestruct();
1111
}
1212

13-
function doSelfdestruct() {
13+
function doSelfdestruct() public {
1414
selfdestruct(msg.sender);
1515
}
1616

src/evmTest/resources/solidity/Caller.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
pragma solidity ^0.4.10;
1+
pragma solidity ^0.5.1;
22

33
contract Callee {
44

55
uint foo = 2;
66

7-
function setFoo(uint v) {
7+
function setFoo(uint v) public {
88
foo = v;
99
}
1010

11-
function getFoo() constant returns (uint) {
11+
function getFoo() view public returns (uint) {
1212
return foo;
1313
}
1414

1515
}
1616

1717
contract Caller {
1818

19-
function makeACall(address calleeAddr, uint fooVal) {
19+
function makeACall(address calleeAddr, uint fooVal) public {
2020
Callee callee = Callee(calleeAddr);
2121
callee.setFoo(fooVal);
2222
}

0 commit comments

Comments
 (0)