From f761ee0ae2c514ab06a889688b357ce30828b988 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 14 Oct 2020 18:26:18 +0200 Subject: [PATCH] Perform bytecode comparison on CircleCI. --- .circleci/config.yml | 95 ++++++++++++++++++++++++ scripts/bytecodecompare/compare.sh | 4 + scripts/bytecodecompare/storebytecode.sh | 38 +--------- 3 files changed, 101 insertions(+), 36 deletions(-) create mode 100644 scripts/bytecodecompare/compare.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index daefe4472439..2b7f2645d83e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -943,6 +943,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: build + - 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 @@ -1000,6 +1075,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: diff --git a/scripts/bytecodecompare/compare.sh b/scripts/bytecodecompare/compare.sh new file mode 100644 index 000000000000..8718c9c5ceb9 --- /dev/null +++ b/scripts/bytecodecompare/compare.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# STUB +ls build/bytecode*.txt -l diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh index 02530db03749..13e320960c69 100755 --- a/scripts/bytecodecompare/storebytecode.sh +++ b/scripts/bytecodecompare/storebytecode.sh @@ -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 @@ -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 git@github.com:ethereum/solidity-test-bytecode.git - cd solidity-test-bytecode - git config user.name "travis" - git config user.email "chris@ethereum.org" - 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." \ No newline at end of file +echo "Storebytecode finished."