Skip to content

Commit 8b8cd9f

Browse files
authored
Merge pull request #10039 from ethereum/bytecodeComparison
Bytecode comparison on CircleCI
2 parents 3c63be5 + a7b8ad3 commit 8b8cd9f

File tree

4 files changed

+113
-43
lines changed

4 files changed

+113
-43
lines changed

.circleci/build_win.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ $ErrorActionPreference = "Stop"
22

33
cd "$PSScriptRoot\.."
44

5-
if ("$Env:FORCE_RELEASE") {
5+
if ("$Env:FORCE_RELEASE" -Or "$Env:CIRCLE_TAG") {
66
New-Item prerelease.txt -type file
77
Write-Host "Building release version."
88
}

.circleci/config.yml

Lines changed: 109 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ jobs:
481481
steps:
482482
- checkout
483483
- run: *run_build
484-
- persist_to_workspace: *artifacts_build_dir
484+
- persist_to_workspace: *artifacts_executables
485485

486486
t_ubu_codecov:
487487
<<: *test_ubuntu2004
@@ -592,7 +592,12 @@ jobs:
592592
- run: *run_build
593593
- store_artifacts: *artifacts_solc
594594
- store_artifacts: *artifacts_tools
595-
- persist_to_workspace: *artifacts_build_dir
595+
- persist_to_workspace:
596+
root: .
597+
paths:
598+
- build/solc/solc
599+
- build/test/soltest
600+
- build/test/tools/solfuzzer
596601

597602
t_osx_soltest:
598603
macos:
@@ -607,7 +612,7 @@ jobs:
607612
keys:
608613
- dependencies-osx-{{ checksum ".circleci/osx_install_dependencies.sh" }}
609614
- attach_workspace:
610-
at: build
615+
at: .
611616
- run: *run_soltest
612617
- store_test_results: *store_test_results
613618
- store_artifacts: *artifacts_test_results
@@ -623,7 +628,7 @@ jobs:
623628
keys:
624629
- dependencies-osx-{{ checksum ".circleci/osx_install_dependencies.sh" }}
625630
- attach_workspace:
626-
at: build
631+
at: .
627632
- run: *run_cmdline_tests
628633
- store_artifacts: *artifacts_test_results
629634

@@ -919,7 +924,11 @@ jobs:
919924
name: "Run solc.exe to make sure build was successful."
920925
command: .\build\solc\Release\solc.exe --version
921926
- store_artifacts: *artifact_solc_windows
922-
- persist_to_workspace: *artifacts_build_dir
927+
- persist_to_workspace:
928+
root: build
929+
paths:
930+
- .\solc\*\solc.exe
931+
- .\test\*\soltest.exe
923932

924933
b_win_release:
925934
<<: *b_win
@@ -945,6 +954,81 @@ jobs:
945954
t_win_release:
946955
<<: *t_win
947956

957+
b_bytecode_ubu:
958+
docker:
959+
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
960+
steps:
961+
- checkout
962+
- attach_workspace:
963+
at: build
964+
- run: scripts/bytecodecompare/storebytecode.sh && cp -v report.txt bytecode-report-ubuntu.txt
965+
- store_artifacts:
966+
path: report.txt
967+
- persist_to_workspace:
968+
root: .
969+
paths:
970+
- bytecode-report-ubuntu.txt
971+
972+
b_bytecode_osx:
973+
macos:
974+
xcode: "11.0.0"
975+
environment:
976+
TERM: xterm
977+
steps:
978+
- checkout
979+
- attach_workspace:
980+
at: .
981+
- run: scripts/bytecodecompare/storebytecode.sh && cp -v report.txt bytecode-report-osx.txt
982+
- store_artifacts:
983+
path: report.txt
984+
- persist_to_workspace:
985+
root: .
986+
paths:
987+
- bytecode-report-osx.txt
988+
989+
b_bytecode_win:
990+
executor:
991+
name: win/default
992+
shell: cmd.exe
993+
steps:
994+
- checkout
995+
- attach_workspace:
996+
at: build
997+
- run: python scripts\isolate_tests.py test\
998+
- run: python scripts\bytecodecompare\prepare_report.py build\solc\Release\solc.exe
999+
- run: cp report.txt bytecode-report-windows.txt
1000+
- store_artifacts:
1001+
path: report.txt
1002+
- persist_to_workspace:
1003+
root: .
1004+
paths:
1005+
- bytecode-report-windows.txt
1006+
1007+
b_bytecode_ems:
1008+
docker:
1009+
- image: circleci/node:10
1010+
environment:
1011+
SOLC_EMSCRIPTEN: "On"
1012+
steps:
1013+
- checkout
1014+
- attach_workspace:
1015+
at: emscripten_build/libsolc
1016+
- run: scripts/bytecodecompare/storebytecode.sh && cp -v report.txt bytecode-report-emscripten.txt
1017+
- store_artifacts:
1018+
path: report.txt
1019+
- persist_to_workspace:
1020+
root: .
1021+
paths:
1022+
- bytecode-report-emscripten.txt
1023+
1024+
t_bytecode_compare:
1025+
docker:
1026+
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
1027+
steps:
1028+
- attach_workspace:
1029+
at: .
1030+
- run: diff --report-identical-files --from-file bytecode-report-emscripten.txt bytecode-report-ubuntu.txt bytecode-report-osx.txt bytecode-report-windows.txt
1031+
9481032
workflows:
9491033
version: 2
9501034

@@ -1002,6 +1086,26 @@ workflows:
10021086
- t_win: *workflow_win
10031087
- t_win_release: *workflow_win_release
10041088

1089+
# Bytecode comparison:
1090+
- b_bytecode_ubu:
1091+
requires:
1092+
- b_ubu
1093+
- b_bytecode_win:
1094+
requires:
1095+
- b_win
1096+
- b_bytecode_osx:
1097+
requires:
1098+
- b_osx
1099+
- b_bytecode_ems:
1100+
requires:
1101+
- b_ems
1102+
- t_bytecode_compare:
1103+
requires:
1104+
- b_bytecode_ubu
1105+
- b_bytecode_win
1106+
- b_bytecode_osx
1107+
- b_bytecode_ems
1108+
10051109
nightly:
10061110

10071111
triggers:

scripts/bytecodecompare/storebytecode.sh

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@
2727

2828
set -e
2929

30-
if [[ "${TRAVIS_PULL_REQUEST_BRANCH}" != "" ]]; then
31-
# Variable is set to the branch's name iff current job is a pull request,
32-
# or is set to empty string if it is a push build.
33-
echo "Skipping bytecode comparison."
34-
exit 0
35-
fi
36-
3730
REPO_ROOT="$(dirname "$0")"/../..
3831

3932
if test -z "$1"; then
@@ -120,34 +113,7 @@ EOF
120113
$REPO_ROOT/scripts/bytecodecompare/prepare_report.py $REPO_ROOT/$BUILD_DIR/solc/solc
121114
fi
122115

123-
if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]
124-
then
125-
openssl aes-256-cbc -K $encrypted_60701c962b9c_key -iv $encrypted_60701c962b9c_iv -in "$REPO_ROOT"/scripts/bytecodecompare/deploy_key.enc -out deploy_key -d
126-
chmod 600 deploy_key
127-
eval `ssh-agent -s`
128-
ssh-add deploy_key
129-
130-
git clone --depth 2 git@github.com:ethereum/solidity-test-bytecode.git
131-
cd solidity-test-bytecode
132-
git config user.name "travis"
133-
git config user.email "chris@ethereum.org"
134-
git clean -f -d -x
135-
136-
DIRNAME=$(cd "$REPO_ROOT" && git show -s --format="%cd-%H" --date="format:%Y-%m-%d-%H-%M")
137-
mkdir -p "$DIRNAME"
138-
REPORT="$DIRNAME/$ZIP_SUFFIX.txt"
139-
cp ../report.txt "$REPORT"
140-
# Only push if adding actually worked, i.e. there were changes.
141-
if git add "$REPORT" && git commit -a -m "Added report $REPORT"
142-
then
143-
git pull --rebase
144-
git push origin
145-
else
146-
echo "Adding report failed, it might already exist in the repository."
147-
fi
148-
else
149-
echo "Not storing bytecode because the keys are not available."
150-
fi
116+
cp report.txt $REPO_ROOT
151117
)
152118
rm -rf "$TMPDIR"
153-
echo "Storebytecode finished."
119+
echo "Storebytecode finished."

scripts/ci/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ROOTDIR="$(dirname "$0")/../.."
55
cd "${ROOTDIR}"
66

77
# shellcheck disable=SC2166
8-
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]; then echo -n >prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" >prerelease.txt; fi
8+
if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]; then echo -n >prerelease.txt; fi
99
if [ -n "$CIRCLE_SHA1" ]
1010
then
1111
echo -n "$CIRCLE_SHA1" >commit_hash.txt

0 commit comments

Comments
 (0)