Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bytecode comparison on CircleCI #10039

Merged
merged 5 commits into from
Oct 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/build_win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $ErrorActionPreference = "Stop"

cd "$PSScriptRoot\.."

if ("$Env:FORCE_RELEASE") {
if ("$Env:FORCE_RELEASE" -Or "$Env:CIRCLE_TAG") {
New-Item prerelease.txt -type file
Write-Host "Building release version."
}
Expand Down
114 changes: 109 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ jobs:
steps:
- checkout
- run: *run_build
- persist_to_workspace: *artifacts_build_dir
- persist_to_workspace: *artifacts_executables

t_ubu_codecov:
<<: *test_ubuntu2004
Expand Down Expand Up @@ -592,7 +592,12 @@ jobs:
- run: *run_build
- store_artifacts: *artifacts_solc
- store_artifacts: *artifacts_tools
- persist_to_workspace: *artifacts_build_dir
- persist_to_workspace:
root: .
paths:
- build/solc/solc
- build/test/soltest
- build/test/tools/solfuzzer
Comment on lines +597 to +600
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main workaround. osx moves these files in a subdirectory build, while the rest has one directory level less.


t_osx_soltest:
macos:
Expand All @@ -607,7 +612,7 @@ jobs:
keys:
- dependencies-osx-{{ checksum ".circleci/osx_install_dependencies.sh" }}
- attach_workspace:
at: build
at: .
- run: *run_soltest
- store_test_results: *store_test_results
- store_artifacts: *artifacts_test_results
Expand All @@ -623,7 +628,7 @@ jobs:
keys:
- dependencies-osx-{{ checksum ".circleci/osx_install_dependencies.sh" }}
- attach_workspace:
at: build
at: .
- run: *run_cmdline_tests
- store_artifacts: *artifacts_test_results

Expand Down Expand Up @@ -919,7 +924,11 @@ jobs:
name: "Run solc.exe to make sure build was successful."
command: .\build\solc\Release\solc.exe --version
- store_artifacts: *artifact_solc_windows
- persist_to_workspace: *artifacts_build_dir
- persist_to_workspace:
root: build
paths:
- .\solc\*\solc.exe
- .\test\*\soltest.exe

b_win_release:
<<: *b_win
Expand All @@ -945,6 +954,81 @@ jobs:
t_win_release:
<<: *t_win

b_bytecode_ubu:
docker:
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
steps:
- checkout
- attach_workspace:
at: build
- run: scripts/bytecodecompare/storebytecode.sh && cp -v report.txt bytecode-report-ubuntu.txt
- store_artifacts:
path: report.txt
- persist_to_workspace:
root: .
paths:
- bytecode-report-ubuntu.txt

b_bytecode_osx:
macos:
xcode: "11.0.0"
environment:
TERM: xterm
steps:
- checkout
- attach_workspace:
at: .
- run: scripts/bytecodecompare/storebytecode.sh && cp -v report.txt bytecode-report-osx.txt
- store_artifacts:
path: report.txt
- persist_to_workspace:
root: .
paths:
- bytecode-report-osx.txt

b_bytecode_win:
executor:
name: win/default
shell: cmd.exe
steps:
- checkout
- attach_workspace:
at: build
- run: python scripts\isolate_tests.py test\
- run: python scripts\bytecodecompare\prepare_report.py build\solc\Release\solc.exe
- run: cp report.txt bytecode-report-windows.txt
- store_artifacts:
path: report.txt
- persist_to_workspace:
root: .
paths:
- bytecode-report-windows.txt

b_bytecode_ems:
docker:
- image: circleci/node:10
environment:
SOLC_EMSCRIPTEN: "On"
steps:
- checkout
- attach_workspace:
at: emscripten_build/libsolc
- run: scripts/bytecodecompare/storebytecode.sh && cp -v report.txt bytecode-report-emscripten.txt
- store_artifacts:
path: report.txt
- persist_to_workspace:
root: .
paths:
- bytecode-report-emscripten.txt

t_bytecode_compare:
docker:
- image: << pipeline.parameters.ubuntu-2004-docker-image >>
steps:
- attach_workspace:
at: .
- run: diff --report-identical-files --from-file bytecode-report-emscripten.txt bytecode-report-ubuntu.txt bytecode-report-osx.txt bytecode-report-windows.txt

workflows:
version: 2

Expand Down Expand Up @@ -1002,6 +1086,26 @@ workflows:
- t_win: *workflow_win
- t_win_release: *workflow_win_release

# Bytecode comparison:
- b_bytecode_ubu:
requires:
- b_ubu
- b_bytecode_win:
requires:
- b_win
- b_bytecode_osx:
requires:
- b_osx
- b_bytecode_ems:
requires:
- b_ems
- t_bytecode_compare:
requires:
- b_bytecode_ubu
- b_bytecode_win
- b_bytecode_osx
- b_bytecode_ems

nightly:

triggers:
Expand Down
38 changes: 2 additions & 36 deletions scripts/bytecodecompare/storebytecode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@

set -e

if [[ "${TRAVIS_PULL_REQUEST_BRANCH}" != "" ]]; then
# Variable is set to the branch's name iff current job is a pull request,
# or is set to empty string if it is a push build.
echo "Skipping bytecode comparison."
exit 0
fi

REPO_ROOT="$(dirname "$0")"/../..

if test -z "$1"; then
Expand Down Expand Up @@ -120,34 +113,7 @@ EOF
$REPO_ROOT/scripts/bytecodecompare/prepare_report.py $REPO_ROOT/$BUILD_DIR/solc/solc
fi

if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]
then
openssl aes-256-cbc -K $encrypted_60701c962b9c_key -iv $encrypted_60701c962b9c_iv -in "$REPO_ROOT"/scripts/bytecodecompare/deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key

git clone --depth 2 [email protected]:ethereum/solidity-test-bytecode.git
cd solidity-test-bytecode
git config user.name "travis"
git config user.email "[email protected]"
git clean -f -d -x

DIRNAME=$(cd "$REPO_ROOT" && git show -s --format="%cd-%H" --date="format:%Y-%m-%d-%H-%M")
mkdir -p "$DIRNAME"
REPORT="$DIRNAME/$ZIP_SUFFIX.txt"
cp ../report.txt "$REPORT"
# Only push if adding actually worked, i.e. there were changes.
if git add "$REPORT" && git commit -a -m "Added report $REPORT"
then
git pull --rebase
git push origin
else
echo "Adding report failed, it might already exist in the repository."
fi
else
echo "Not storing bytecode because the keys are not available."
fi
cp report.txt $REPO_ROOT
)
rm -rf "$TMPDIR"
echo "Storebytecode finished."
echo "Storebytecode finished."
2 changes: 1 addition & 1 deletion scripts/ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ROOTDIR="$(dirname "$0")/../.."
cd "${ROOTDIR}"

# shellcheck disable=SC2166
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we make sure that this is called "nightly" for the actual emscripten build?

Copy link
Member Author

@ekpyron ekpyron Oct 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... which just calls back scripts/travis-emscripten/build_emscripten.sh ultimately...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we actually don't :-) - I'll have a look and make sure - in any case, they won't involve this script, so they're unaffected by the change here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we don't - they are called develop... but that needs to be fixed in solc-bin. I'll create a PR there.

if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" -o -n "$FORCE_RELEASE" ]; then echo -n >prerelease.txt; fi
if [ -n "$CIRCLE_SHA1" ]
then
echo -n "$CIRCLE_SHA1" >commit_hash.txt
Expand Down