# vim:ts=2:sw=2:et # -------------------------------------------------------------------------- # Prefixes used in order to keep CircleCI workflow overview more readable: # - b: build # - t: test # - ubu: ubuntu # - ems: Emscripten version: 2.1 parameters: ubuntu-2004-docker-image: type: string # solbuildpackpusher/solidity-buildpack-deps:ubuntu2004-18 default: "solbuildpackpusher/solidity-buildpack-deps@sha256:db35d88a16f19adfac6dfd88bda4b32a85a82430f28830aad97bcd10fa4f846c" ubuntu-2204-docker-image: type: string # solbuildpackpusher/solidity-buildpack-deps:ubuntu2204-3 default: "solbuildpackpusher/solidity-buildpack-deps@sha256:73e4e80128a0596c3ddb36e36e8039514a9f33ca8799bec82060a49b0cdae461" ubuntu-2204-clang-docker-image: type: string # solbuildpackpusher/solidity-buildpack-deps:ubuntu2204.clang-2 default: "solbuildpackpusher/solidity-buildpack-deps@sha256:0d4fa1da806f9b3daabd2d1dc0842899af794a838e475c14045c3fb289cc8103" ubuntu-clang-ossfuzz-docker-image: type: string # solbuildpackpusher/solidity-buildpack-deps:ubuntu.clang.ossfuzz-23 default: "solbuildpackpusher/solidity-buildpack-deps@sha256:7a84f67829ec2fdcfc8a61ebf22f9dc27b04a9edeb1531565ab3e0ebb1cbc4a0" emscripten-docker-image: type: string # solbuildpackpusher/solidity-buildpack-deps:emscripten-15 default: "solbuildpackpusher/solidity-buildpack-deps@sha256:e2729bd6c0734bb49d04e2688fec3dcf880394f351f69358dd2bd92c0f6fd309" evm-version: type: string default: london orbs: win: circleci/windows@2.2.0 commands: matrix_notify_unless_pr: description: "Posts a notification to the solidity-dev room on Matrix (if not running on a PR)." parameters: event: type: enum enum: ["failure", "success", "release"] condition: type: string steps: - run: name: "Matrix notification" when: << parameters.condition >> command: scripts/ci/notification/matrix_notification.sh << parameters.event >> matrix_notify_failure_unless_pr: description: "Posts a failure notification to the main room on Matrix (if not running on a PR)." steps: - matrix_notify_unless_pr: event: failure condition: on_fail matrix_notify_success_unless_pr: description: "Posts a success notification to the main room on Matrix (if not running on a PR)." steps: - matrix_notify_unless_pr: event: success condition: on_success matrix_notify_release_unless_pr: description: "Posts a release notification to the main room on Matrix (if not running on a PR)." steps: - matrix_notify_unless_pr: event: release condition: on_success prepare_bytecode_report: description: "Generate bytecode report and upload it as an artifact." parameters: label: type: string binary_path: type: string steps: - run: mkdir test-cases/ - run: cd test-cases && python3 ../scripts/isolate_tests.py ../test/ - run: cd test-cases && python3 ../scripts/bytecodecompare/prepare_report.py << parameters.binary_path >> --interface standard-json --report-file "../bytecode-report-<< parameters.label >>-json.txt" - run: cd test-cases && python3 ../scripts/bytecodecompare/prepare_report.py << parameters.binary_path >> --interface cli --report-file "../bytecode-report-<< parameters.label >>-cli.txt" - store_artifacts: path: bytecode-report-<< parameters.label >>-json.txt - store_artifacts: path: bytecode-report-<< parameters.label >>-cli.txt - persist_to_workspace: root: . paths: - bytecode-report-<< parameters.label >>-json.txt - bytecode-report-<< parameters.label >>-cli.txt - matrix_notify_failure_unless_pr defaults: # -------------------------------------------------------------------------- # Build Templates - setup_prerelease_commit_hash: &setup_prerelease_commit_hash name: Store commit hash and prerelease command: | if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" ]; then echo -n > prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; fi echo -n "$CIRCLE_SHA1" > commit_hash.txt - run_build: &run_build name: Build command: scripts/ci/build.sh - run_build_ossfuzz: &run_build_ossfuzz name: Build_ossfuzz command: scripts/ci/build_ossfuzz.sh - run_proofs: &run_proofs name: Correctness proofs for optimization rules command: scripts/run_proofs.sh - run_soltest: &run_soltest name: soltest no_output_timeout: 30m command: ./.circleci/soltest.sh - run_soltest_all: &run_soltest_all name: soltest_all no_output_timeout: 30m command: ./.circleci/soltest_all.sh - run_cmdline_tests: &run_cmdline_tests name: command line tests no_output_timeout: 30m command: ./test/cmdlineTests.sh - run_docs_pragma_min_version: &run_docs_pragma_min_version name: docs pragma version check command: ./scripts/docs_version_pragma_check.sh # -------------------------------------------------------------------------- # Artifacts Templates # compiled solc executable target - artifacts_solc: &artifacts_solc path: build/solc/solc destination: solc # windows artifacts - artifact_solc_windows: &artifact_solc_windows path: upload/ - artifact_yul_phaser: &artifact_yul_phaser path: build/tools/yul-phaser destination: yul-phaser # compiled executable targets - artifacts_executables: &artifacts_executables root: build paths: - solc/solc - test/soltest - test/tools/solfuzzer # compiled OSSFUZZ targets - artifacts_executables_ossfuzz: &artifacts_executables_ossfuzz root: build paths: - test/tools/ossfuzz/abiv2_proto_ossfuzz - test/tools/ossfuzz/abiv2_isabelle_ossfuzz - test/tools/ossfuzz/const_opt_ossfuzz - test/tools/ossfuzz/solc_mutator_ossfuzz - test/tools/ossfuzz/solc_ossfuzz - test/tools/ossfuzz/stack_reuse_codegen_ossfuzz - test/tools/ossfuzz/strictasm_assembly_ossfuzz - test/tools/ossfuzz/strictasm_diff_ossfuzz - test/tools/ossfuzz/strictasm_opt_ossfuzz - test/tools/ossfuzz/yul_proto_diff_ossfuzz - test/tools/ossfuzz/yul_proto_diff_custom_mutate_ossfuzz - test/tools/ossfuzz/yul_proto_ossfuzz - test/tools/ossfuzz/sol_proto_ossfuzz # test result output directory - artifacts_test_results: &artifacts_test_results path: test_results/ destination: test_results/ # -------------------------------------------------------------------------- # Step Templates # store_test_results helper - store_test_results: &store_test_results path: test_results/ - steps_soltest: &steps_soltest steps: - checkout - attach_workspace: at: build # NOTE: Different build jobs produce different soltest executables (release/debug, # clang/gcc, windows/linux/macos, etc.). The executable used by these steps comes from the # attached workspace and we only see the items added to the workspace by jobs we depend on. - run: *run_soltest - store_test_results: *store_test_results - store_artifacts: *artifacts_test_results - matrix_notify_failure_unless_pr - steps_test_lsp: &steps_test_lsp steps: - checkout - attach_workspace: at: build - run: name: Install dependencies command: pip install --user deepdiff colorama - run: name: Executing solc LSP test suite command: ./test/lsp.py ./build/solc/solc --non-interactive - matrix_notify_failure_unless_pr - steps_build: &steps_build steps: - checkout - run: *run_build - store_artifacts: *artifacts_solc - store_artifacts: *artifact_yul_phaser - persist_to_workspace: *artifacts_executables - matrix_notify_failure_unless_pr - steps_soltest_all: &steps_soltest_all steps: - checkout - attach_workspace: at: build - run: *run_soltest_all - store_test_results: *store_test_results - store_artifacts: *artifacts_test_results - matrix_notify_failure_unless_pr - steps_cmdline_tests: &steps_cmdline_tests steps: - checkout - attach_workspace: at: build - run: *run_cmdline_tests - store_test_results: *store_test_results - store_artifacts: *artifacts_test_results - matrix_notify_failure_unless_pr - steps_install_dependencies_osx: &steps_install_dependencies_osx steps: # FIXME: We used to cache dependencies on macOS but now it takes longer than just installing # them each time. See https://github.com/ethereum/solidity/issues/12925. - run: name: Install build dependencies command: ./.circleci/osx_install_dependencies.sh # -------------------------------------------------------------------------- # Base Image Templates - base_archlinux: &base_archlinux docker: - image: archlinux:base environment: TERM: xterm MAKEFLAGS: -j 3 - base_archlinux_large: &base_archlinux_large docker: - image: archlinux:base resource_class: large environment: TERM: xterm MAKEFLAGS: -j 5 - base_cimg_small: &base_cimg_small docker: - image: cimg/base:current resource_class: small environment: TERM: xterm MAKEFLAGS: -j 2 - base_ems_large: &base_ems_large docker: - image: << pipeline.parameters.emscripten-docker-image >> resource_class: large environment: TERM: xterm MAKEFLAGS: -j 5 - base_node_small: &base_node_small docker: - image: cimg/node:current resource_class: small environment: TERM: xterm MAKEFLAGS: -j 2 - base_osx: &base_osx macos: xcode: "13.2.0" environment: TERM: xterm MAKEFLAGS: -j5 - base_osx_large: &base_osx_large macos: xcode: "13.2.0" resource_class: large environment: TERM: xterm MAKEFLAGS: -j10 - base_python_small: &base_python_small docker: - image: cimg/python:3.6 resource_class: small environment: TERM: xterm MAKEFLAGS: -j 2 - base_ubuntu_clang: &base_ubuntu_clang docker: - image: << pipeline.parameters.ubuntu-clang-ossfuzz-docker-image >> environment: TERM: xterm MAKEFLAGS: -j 3 - base_ubuntu_clang_small: &base_ubuntu_clang_small <<: *base_ubuntu_clang resource_class: small environment: TERM: xterm MAKEFLAGS: -j 2 - base_ubuntu2004: &base_ubuntu2004 docker: - image: << pipeline.parameters.ubuntu-2004-docker-image >> environment: TERM: xterm MAKEFLAGS: -j 3 - base_ubuntu2004_small: &base_ubuntu2004_small <<: *base_ubuntu2004 resource_class: small environment: TERM: xterm MAKEFLAGS: -j 2 - base_ubuntu2004_xlarge: &base_ubuntu2004_xlarge <<: *base_ubuntu2004 resource_class: xlarge environment: TERM: xterm MAKEFLAGS: -j 10 - base_ubuntu2204: &base_ubuntu2204 docker: - image: << pipeline.parameters.ubuntu-2204-docker-image >> environment: TERM: xterm MAKEFLAGS: -j 3 - base_ubuntu2204_clang: &base_ubuntu2204_clang docker: - image: << pipeline.parameters.ubuntu-2204-clang-docker-image >> environment: TERM: xterm CC: clang CXX: clang++ MAKEFLAGS: -j 3 - base_ubuntu2204_clang_large: &base_ubuntu2204_clang_large <<: *base_ubuntu2204_clang resource_class: large environment: TERM: xterm CC: clang CXX: clang++ MAKEFLAGS: -j 5 - base_ubuntu2204_small: &base_ubuntu2204_small <<: *base_ubuntu2204 resource_class: small environment: TERM: xterm MAKEFLAGS: -j 2 - base_ubuntu2204_large: &base_ubuntu2204_large <<: *base_ubuntu2204 resource_class: large environment: TERM: xterm MAKEFLAGS: -j 5 - base_ubuntu2204_xlarge: &base_ubuntu2204_xlarge <<: *base_ubuntu2204 resource_class: xlarge environment: TERM: xterm MAKEFLAGS: -j 10 - base_win: &base_win executor: name: win/default shell: bash.exe - base_win_large: &base_win_large executor: name: win/default size: large shell: bash.exe # -------------------------------------------------------------------------- # Workflow Templates - on_all_tags_and_branches: &on_all_tags_and_branches filters: tags: only: /.*/ - on_version_tags: &on_version_tags filters: tags: only: /^v.*/ branches: ignore: /.*/ - on_develop: &on_develop filters: branches: only: - develop - requires_nothing: &requires_nothing <<: *on_all_tags_and_branches - requires_b_ubu: &requires_b_ubu <<: *on_all_tags_and_branches requires: - b_ubu - requires_b_ubu_clang: &requires_b_ubu_clang <<: *on_all_tags_and_branches requires: - b_ubu_clang - requires_b_ubu_force_release: &requires_b_ubu_force_release <<: *on_all_tags_and_branches requires: - b_ubu_force_release - requires_b_ubu_static: &requires_b_ubu_static <<: *on_all_tags_and_branches requires: - b_ubu_static - requires_b_archlinux: &requires_b_archlinux <<: *on_all_tags_and_branches requires: - b_archlinux - requires_b_ubu_codecov: &requires_b_ubu_codecov <<: *on_all_tags_and_branches requires: - b_ubu_codecov - requires_b_osx: &requires_b_osx <<: *on_all_tags_and_branches requires: - b_osx - requires_b_ubu_asan: &requires_b_ubu_asan <<: *on_all_tags_and_branches requires: - b_ubu_asan - requires_b_ubu_asan_clang: &requires_b_ubu_asan_clang <<: *on_all_tags_and_branches requires: - b_ubu_asan_clang - requires_b_ubu_ubsan_clang: &requires_b_ubu_ubsan_clang <<: *on_all_tags_and_branches requires: - b_ubu_ubsan_clang - requires_b_ems: &requires_b_ems <<: *on_all_tags_and_branches requires: - b_ems - requires_b_ubu_ossfuzz: &requires_b_ubu_ossfuzz <<: *on_all_tags_and_branches requires: - b_ubu_ossfuzz - requires_b_win: &requires_b_win <<: *on_all_tags_and_branches requires: - b_win # -------------------------------------------------------------------------- # Parameterized Job Templates # Separate compile-only runs of those external tests where a full run takes much longer. - job_ems_compile_ext_colony: &job_ems_compile_ext_colony <<: *requires_b_ems name: t_ems_compile_ext_colony project: colony binary_type: solcjs compile_only: 1 image: cimg/node:14.20 python2: true - job_native_test_ext_gnosis: &job_native_test_ext_gnosis <<: *requires_b_ubu_static name: t_native_test_ext_gnosis project: gnosis binary_type: native image: cimg/node:16.18 - job_native_test_ext_zeppelin: &job_native_test_ext_zeppelin <<: *requires_b_ubu_static name: t_native_test_ext_zeppelin project: zeppelin binary_type: native resource_class: large - job_native_test_ext_ens: &job_native_test_ext_ens <<: *requires_b_ubu_static name: t_native_test_ext_ens project: ens binary_type: native image: cimg/node:18.11 - job_native_test_ext_trident: &job_native_test_ext_trident <<: *requires_b_ubu_static name: t_native_test_ext_trident project: trident binary_type: native image: cimg/node:16.18 - job_native_test_ext_euler: &job_native_test_ext_euler <<: *requires_b_ubu_static name: t_native_test_ext_euler project: euler binary_type: native resource_class: medium - job_native_test_ext_yield_liquidator: &job_native_test_ext_yield_liquidator <<: *requires_b_ubu_static name: t_native_test_ext_yield_liquidator project: yield-liquidator binary_type: native - job_native_test_ext_bleeps: &job_native_test_ext_bleeps <<: *requires_b_ubu_static name: t_native_test_ext_bleeps project: bleeps binary_type: native resource_class: medium - job_native_test_ext_pool_together: &job_native_test_ext_pool_together <<: *requires_b_ubu_static name: t_native_test_ext_pool_together project: pool-together binary_type: native image: cimg/node:16.18 - job_native_test_ext_perpetual_pools: &job_native_test_ext_perpetual_pools <<: *requires_b_ubu_static name: t_native_test_ext_perpetual_pools project: perpetual-pools binary_type: native image: cimg/node:18.11 - job_native_test_ext_uniswap: &job_native_test_ext_uniswap <<: *requires_b_ubu_static name: t_native_test_ext_uniswap project: uniswap binary_type: native image: cimg/node:16.18 - job_native_test_ext_prb_math: &job_native_test_ext_prb_math <<: *requires_b_ubu_static name: t_native_test_ext_prb_math project: prb-math binary_type: native image: cimg/node:18.11 - job_native_test_ext_elementfi: &job_native_test_ext_elementfi <<: *requires_b_ubu_static name: t_native_test_ext_elementfi project: elementfi binary_type: native resource_class: medium - job_native_test_ext_brink: &job_native_test_ext_brink <<: *requires_b_ubu_static name: t_native_test_ext_brink project: brink binary_type: native image: cimg/node:18.11 - job_native_test_ext_chainlink: &job_native_test_ext_chainlink <<: *requires_b_ubu_static name: t_native_test_ext_chainlink project: chainlink binary_type: native image: cimg/node:16.18 resource_class: large # Tests run out of memory on a smaller machine - job_native_test_ext_gp2: &job_native_test_ext_gp2 <<: *requires_b_ubu_static name: t_native_test_ext_gp2 project: gp2 binary_type: native image: cimg/node:18.11 - job_ems_test_ext_colony: &job_ems_test_ext_colony <<: *requires_b_ems name: t_ems_test_ext_colony project: colony binary_type: solcjs image: cimg/node:14.20 resource_class: medium python2: true - job_b_ubu_asan_clang: &job_b_ubu_asan_clang <<: *on_all_tags_and_branches name: b_ubu_asan_clang cmake_options: -DSANITIZE=address - job_b_ubu_ubsan_clang: &job_b_ubu_ubsan_clang <<: *on_all_tags_and_branches name: b_ubu_ubsan_clang cmake_options: -DSANITIZE=undefined # ----------------------------------------------------------------------------------------------- jobs: chk_spelling: <<: *base_python_small steps: - checkout - attach_workspace: at: build - run: name: Install dependencies command: | pip install --user codespell - run: name: Check spelling command: ~/.local/bin/codespell --skip "*.enc,.git,Dockerfile*,LICENSE,codespell_whitelist.txt,codespell_ignored_lines.txt" --ignore-words ./scripts/codespell_whitelist.txt --exclude-file ./scripts/codespell_ignored_lines.txt - matrix_notify_failure_unless_pr chk_docs_examples: <<: *base_node_small steps: - checkout - attach_workspace: at: build - run: name: JS deps command: sudo npm install -g solhint - run: name: Test Docs examples command: ./test/docsCodeStyle.sh - matrix_notify_failure_unless_pr chk_coding_style: <<: *base_cimg_small steps: - checkout - run: name: Install shellcheck command: | sudo apt -q update sudo apt install -y shellcheck - run: name: Check for C++ coding style command: ./scripts/check_style.sh - run: name: checking shell scripts command: ./scripts/chk_shellscripts/chk_shellscripts.sh - run: name: Check for broken symlinks command: ./scripts/check_symlinks.sh - matrix_notify_failure_unless_pr chk_errorcodes: <<: *base_python_small steps: - checkout - run: name: Check for error codes command: ./scripts/error_codes.py --check - matrix_notify_failure_unless_pr chk_pylint: <<: *base_cimg_small steps: - checkout - run: name: Install pip command: | sudo apt -q update sudo apt install -y python3-pip - run: name: Install pylint and dependencies of the scripts that will be linted command: python3 -m pip install pylint z3-solver pygments-lexer-solidity parsec tabulate deepdiff colorama requests - run: pylint --version - run: name: Linting Python Scripts command: ./scripts/pylint_all.py - matrix_notify_failure_unless_pr chk_antlr_grammar: <<: *base_cimg_small steps: - checkout - run: name: Install Java command: | sudo apt -q update sudo apt install -y openjdk-17-jdk - run: name: Run tests command: ./scripts/test_antlr_grammar.sh - matrix_notify_failure_unless_pr chk_buglist: <<: *base_node_small steps: - checkout - run: name: JS deps command: | npm install download npm install JSONPath npm install mktemp - run: name: Test buglist command: ./test/buglistTests.js - matrix_notify_failure_unless_pr chk_proofs: <<: *base_cimg_small steps: - checkout - run: name: Z3 python deps command: | sudo apt-get -qq update sudo apt-get -qy install python3-pip pip3 install --user z3-solver - run: *run_proofs - matrix_notify_failure_unless_pr chk_docs_pragma_min_version: <<: *base_ubuntu2204_small steps: - checkout - run: *run_docs_pragma_min_version - matrix_notify_failure_unless_pr t_ubu_pyscripts: <<: *base_ubuntu2204_small steps: - checkout - run: name: Python unit tests command: python3 test/pyscriptTests.py - matrix_notify_failure_unless_pr t_win_pyscripts: <<: *base_win steps: - run: git config --global core.autocrlf false - checkout - run: name: Python unit tests command: python.exe test/pyscriptTests.py - matrix_notify_failure_unless_pr b_ubu: &b_ubu # this runs 2x faster on xlarge but takes 4x more resources (compared to medium). # Enough other jobs depend on it that it's worth it though. <<: *base_ubuntu2204_xlarge <<: *steps_build # x64 ASAN build, for testing for memory related bugs b_ubu_asan: &b_ubu_asan # Runs slightly faster on large and xlarge but we only run it nightly so efficiency matters more. <<: *base_ubuntu2204 environment: CMAKE_OPTIONS: -DSANITIZE=address MAKEFLAGS: -j 3 CMAKE_BUILD_TYPE: Release <<: *steps_build b_ubu_clang: &b_ubu_clang <<: *base_ubuntu2204_clang_large environment: TERM: xterm CC: clang CXX: clang++ MAKEFLAGS: -j 10 <<: *steps_build b_ubu_san_clang: # This runs a bit faster on large and xlarge but on nightly efficiency matters more. parameters: cmake_options: type: string <<: *base_ubuntu2204_clang environment: TERM: xterm CC: clang CXX: clang++ MAKEFLAGS: -j 3 CMAKE_OPTIONS: << parameters.cmake_options >> <<: *steps_build b_ubu_force_release: &b_ubu_force_release <<: *b_ubu environment: FORCE_RELEASE: ON MAKEFLAGS: -j 10 b_ubu_static: # We temporarily keep building static release binaries on ubuntu 20.04 # to avoid glibc incompatibilities. # See: https://github.com/ethereum/solidity/issues/13954 # On large runs 2x faster than on medium. 3x on xlarge. <<: *base_ubuntu2004_xlarge environment: TERM: xterm MAKEFLAGS: -j 10 CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DUSE_Z3_DLOPEN=ON -DUSE_CVC4=OFF -DSOLC_STATIC_STDLIBS=ON steps: - checkout - run: *run_build - run: name: strip binary command: strip build/solc/solc - store_artifacts: path: build/solc/solc destination: solc-static-linux - run: mv build/solc/solc build/solc/solc-static-linux - persist_to_workspace: root: build paths: - solc/solc-static-linux - matrix_notify_failure_unless_pr b_ubu_codecov: # Runs ~30% faster on large but we only run it nightly so efficiency matters more. <<: *base_ubuntu2204 environment: COVERAGE: ON CMAKE_BUILD_TYPE: Debug MAKEFLAGS: -j 3 steps: - checkout - run: *run_build - persist_to_workspace: *artifacts_executables - matrix_notify_failure_unless_pr t_ubu_codecov: <<: *base_ubuntu2204_large environment: EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 1 steps: - checkout - attach_workspace: at: build - run: name: "soltest: Syntax Tests" command: build/test/soltest -t 'syntaxTest*' -- --testpath test - run: name: "Code Coverage: Syntax Tests" command: codecov --flags syntax --gcov-root build - run: *run_soltest - run: name: "Coverage: All" command: codecov --flags all --gcov-root build - store_artifacts: *artifacts_test_results - matrix_notify_failure_unless_pr # Builds in C++20 mode and uses debug build in order to speed up. # Do *NOT* store any artifacts or workspace as we don't run tests on this build. b_ubu_cxx20: <<: *base_ubuntu2204_large environment: CMAKE_BUILD_TYPE: Debug CMAKE_OPTIONS: -DCMAKE_CXX_STANDARD=20 -DUSE_CVC4=OFF MAKEFLAGS: -j 10 steps: - checkout - run: *run_build - matrix_notify_failure_unless_pr b_ubu_ossfuzz: &b_ubu_ossfuzz <<: *base_ubuntu_clang steps: - checkout - run: *setup_prerelease_commit_hash - run: *run_build_ossfuzz - persist_to_workspace: *artifacts_executables_ossfuzz - matrix_notify_failure_unless_pr t_ubu_ossfuzz: &t_ubu_ossfuzz <<: *base_ubuntu_clang_small steps: - checkout - attach_workspace: at: build - run: name: Regression tests command: | git clone https://github.com/ethereum/solidity-fuzzing-corpus /tmp/solidity-fuzzing-corpus mkdir -p test_results scripts/regressions.py -o test_results - store_test_results: *store_test_results - store_artifacts: *artifacts_test_results b_archlinux: <<: *base_archlinux_large environment: TERM: xterm MAKEFLAGS: -j 5 # This can be switched off if we run out of sync with Arch. USE_Z3: ON steps: - run: name: Install build dependencies command: | pacman --noconfirm -Syu --noprogressbar --needed base-devel boost cmake cvc4 git openssh tar - checkout - run: *run_build - store_artifacts: *artifacts_solc - persist_to_workspace: *artifacts_executables - matrix_notify_failure_unless_pr b_osx: <<: *base_osx_large environment: TERM: xterm CMAKE_BUILD_TYPE: Release MAKEFLAGS: -j10 steps: - checkout - when: condition: true <<: *steps_install_dependencies_osx - run: *run_build - store_artifacts: *artifacts_solc - store_artifacts: *artifact_yul_phaser - persist_to_workspace: root: . paths: - build/solc/solc - build/test/soltest - build/test/tools/solfuzzer - matrix_notify_failure_unless_pr t_osx_soltest: &t_osx_soltest <<: *base_osx environment: EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 TERM: xterm steps: - checkout - when: condition: true <<: *steps_install_dependencies_osx - attach_workspace: at: . - run: *run_soltest - store_test_results: *store_test_results - store_artifacts: *artifacts_test_results - matrix_notify_failure_unless_pr t_osx_cli: <<: *base_osx steps: - checkout - when: condition: true <<: *steps_install_dependencies_osx - attach_workspace: at: . - run: *run_cmdline_tests - store_artifacts: *artifacts_test_results - matrix_notify_failure_unless_pr b_ems: <<: *base_ems_large environment: TERM: xterm MAKEFLAGS: -j 10 steps: - checkout - run: name: Build command: | scripts/ci/build_emscripten.sh - store_artifacts: path: upload/soljson.js destination: soljson.js - run: mkdir -p workspace - run: cp upload/soljson.js workspace/soljson.js - run: scripts/get_version.sh > workspace/version.txt - persist_to_workspace: root: workspace paths: - soljson.js - version.txt - matrix_notify_failure_unless_pr b_docs: <<: *base_ubuntu2204_small steps: - checkout - run: *setup_prerelease_commit_hash - run: name: Build documentation command: ./docs/docs.sh - store_artifacts: path: docs/_build/html/ destination: docs-html - matrix_notify_failure_unless_pr t_ubu_soltest_all: &t_ubu_soltest_all <<: *base_ubuntu2204_large parallelism: 50 <<: *steps_soltest_all t_ubu_lsp: &t_ubu_lsp <<: *base_ubuntu2204_small <<: *steps_test_lsp t_archlinux_soltest: &t_archlinux_soltest <<: *base_archlinux parallelism: 20 environment: EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 TERM: xterm # For Archlinux we do not have prebuilt docker images and we would need to build evmone from source, # thus we forgo semantics tests to speed things up. SOLTEST_FLAGS: --no-semantic-tests --no-smt steps: - run: name: Install runtime dependencies command: | pacman --noconfirm -Syu --noprogressbar --needed base-devel boost cmake z3 cvc4 git openssh tar - when: condition: true <<: *steps_soltest t_ubu_clang_soltest: &t_ubu_clang_soltest <<: *base_ubuntu2204_clang parallelism: 20 environment: EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 # The high parallelism in this job is causing the SMT tests to run out of memory, # so disabling for now. SOLTEST_FLAGS: --no-smt <<: *steps_soltest t_ubu_force_release_soltest_all: &t_ubu_force_release_soltest_all # NOTE: This definition is identical to t_ubu_soltest_all but in the workflow we make it depend on # a different job (b_ubu_force_release) so the workspace it attaches contains a different executable. <<: *t_ubu_soltest_all t_ubu_cli: &t_ubu_cli <<: *base_ubuntu2204_small <<: *steps_cmdline_tests t_ubu_force_release_cli: &t_ubu_force_release_cli <<: *t_ubu_cli t_ubu_locale: <<: *base_ubuntu2204_small steps: - checkout - attach_workspace: at: build - run: test/localeTest.sh build/solc/solc - matrix_notify_failure_unless_pr t_ubu_asan_cli: # Runs slightly faster on medium but we only run it nightly so efficiency matters more. <<: *base_ubuntu2204 environment: TERM: xterm ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2 # Suppress CLN memory leak. # See: https://github.com/ethereum/solidity/issues/13891 for details. LSAN_OPTIONS: suppressions=/root/project/.circleci/cln-asan.supp:print_suppressions=0 <<: *steps_cmdline_tests t_ubu_asan_soltest: <<: *base_ubuntu2204 parallelism: 20 environment: EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 SOLTEST_FLAGS: --no-smt ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2 # Suppress CLN memory leak. # See: https://github.com/ethereum/solidity/issues/13891 for details. LSAN_OPTIONS: suppressions=/root/project/.circleci/cln-asan.supp <<: *steps_soltest t_ubu_asan_clang_soltest: <<: *base_ubuntu2204_clang parallelism: 20 environment: EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 SOLTEST_FLAGS: --no-smt ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2 <<: *steps_soltest t_ubu_ubsan_clang_soltest: <<: *base_ubuntu2204_clang parallelism: 20 environment: EVM: << pipeline.parameters.evm-version >> SOLTEST_FLAGS: --no-smt <<: *steps_soltest t_ubu_ubsan_clang_cli: <<: *base_ubuntu2204_clang <<: *steps_cmdline_tests t_ems_solcjs: # Unlike other t_ems jobs this one actually runs 2x faster on medium (compared to small). <<: *base_ubuntu2204 steps: - checkout - attach_workspace: at: /tmp/workspace - run: name: Install test dependencies command: | apt-get update apt-get install -qqy --no-install-recommends nodejs npm - run: name: Test solcjs no_output_timeout: 30m command: | node --version npm --version test/externalTests/solc-js/solc-js.sh /tmp/workspace/soljson.js $(cat /tmp/workspace/version.txt) - matrix_notify_failure_unless_pr t_ems_ext_hardhat: <<: *base_node_small docker: - image: cimg/node:18.11 environment: TERM: xterm HARDHAT_TESTS_SOLC_PATH: /tmp/workspace/soljson.js steps: - checkout - attach_workspace: at: /tmp/workspace - run: git clone --depth 1 https://github.com/nomiclabs/hardhat.git - run: name: Install dependencies command: | cd hardhat yarn - run: name: Run hardhat-core test suite command: | HARDHAT_TESTS_SOLC_VERSION=$(scripts/get_version.sh) export HARDHAT_TESTS_SOLC_VERSION # NOTE: This is expected to work without running `yarn build` first. cd hardhat/packages/hardhat-core yarn test - matrix_notify_failure_unless_pr t_ext: parameters: project: type: string binary_type: type: enum enum: - solcjs - native compile_only: type: integer default: 0 image: type: string default: cimg/node:current resource_class: type: string default: small python2: type: boolean default: false docker: - image: << parameters.image >> resource_class: << parameters.resource_class >> # NOTE: Each external test runs up to 6 independent settings presets. If parallelism is higher than # actual preset count, some runs will exit immediately. If it's lower, some runs will get more than one preset. parallelism: 6 environment: TERM: xterm COMPILE_ONLY: << parameters.compile_only >> steps: - checkout - attach_workspace: at: /tmp/workspace - run: name: Install lsof command: | # lsof is used by Colony in its stop-blockchain-client.sh script sudo apt update sudo apt-get --quiet --assume-yes --no-install-recommends install lsof - when: condition: << parameters.python2 >> steps: - run: name: Install Python 2 and make it the default command: | # python is used by node-gyp to build native modules (needed for Colony). # In the 14.x image node-gyp still requires Python 2. sudo apt install python2 --assume-yes --no-install-recommends sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1 - when: condition: equal: [<< parameters.binary_type >>, "solcjs"] steps: - run: name: External << parameters.project >> tests (solcjs) command: | test/externalTests/<< parameters.project >>.sh solcjs /tmp/workspace/soljson.js - when: condition: equal: [<< parameters.binary_type >>, "native"] steps: - run: name: External << parameters.project >> tests (native) command: | test/externalTests/<< parameters.project >>.sh native /tmp/workspace/solc/solc-static-linux - store_artifacts: path: reports/externalTests/ # persist_to_workspace fails if the directory does not exist and the test script will create # it only if it actually has benchmark results. - run: mkdir -p reports/externalTests/ - persist_to_workspace: root: . paths: - reports/externalTests/ - matrix_notify_failure_unless_pr c_ext_benchmarks: <<: *base_node_small steps: - checkout - attach_workspace: at: . - run: name: Install dependencies of helper scripts command: | sudo apt update sudo apt install python3-pip --assume-yes --no-install-recommends python3 -m pip install requests --user - run: name: Combine benchmark reports command: cat reports/externalTests/benchmark-*.json | scripts/externalTests/merge_benchmarks.sh > reports/externalTests/all-benchmarks.json - run: name: Summarize reports command: cat reports/externalTests/all-benchmarks.json | scripts/externalTests/summarize_benchmarks.sh > reports/externalTests/summarized-benchmarks.json - run: name: Download reports from base branch command: | if [[ $CIRCLE_PULL_REQUEST != "" ]]; then mkdir reports/externalTests/base-branch/ cd reports/externalTests/base-branch/ pr_id=$(echo "$CIRCLE_PULL_REQUEST" | sed 's|\(.*\)\/||') scripts_dir=../../../scripts # Our main goal here is to provide new benchmarks, the diff is optional. When benchmarks from # the previous run are not available for whatever reason, we still succeed and just skip the diff. # download_benchmarks.py exits with status 2 in that case. if "${scripts_dir}/externalTests/download_benchmarks.py" --base-of-pr "$pr_id" || [[ $? == 2 ]]; then echo 'export SKIP_BENCHMARK_DIFF=true' >> $BASH_ENV fi fi - run: name: Diff benchmarks command: | if [[ $CIRCLE_PULL_REQUEST != "" && $SKIP_BENCHMARK_DIFF != "true" ]]; then cd reports/externalTests/ mkdir diff/ scripts_dir=../../scripts "${scripts_dir}/externalTests/benchmark_diff.py" table \ --output-format markdown \ --style humanized \ base-branch/summarized-benchmarks-*.json \ summarized-benchmarks.json > diff/benchmark-diff-summarized-table-markdown-humanized.md "${scripts_dir}/externalTests/benchmark_diff.py" table \ --output-format markdown \ --style absolute \ base-branch/summarized-benchmarks-*.json \ summarized-benchmarks.json > diff/benchmark-diff-summarized-table-markdown-absolute.md "${scripts_dir}/externalTests/benchmark_diff.py" inplace \ --style absolute \ base-branch/summarized-benchmarks-*.json \ summarized-benchmarks.json > diff/benchmark-diff-summarized-inplace-absolute.md "${scripts_dir}/externalTests/benchmark_diff.py" inplace \ --style absolute \ base-branch/all-benchmarks-*.json \ all-benchmarks.json > diff/benchmark-diff-all-table-inplace-absolute.md fi - store_artifacts: path: reports/externalTests/all-benchmarks.json - store_artifacts: path: reports/externalTests/summarized-benchmarks.json - store_artifacts: path: reports/externalTests/diff/ - store_artifacts: path: reports/externalTests/base-branch/ b_win: &b_win <<: *base_win_large steps: # NOTE: Not disabling git's core.autocrlf here because we want to build using the typical Windows config. - checkout - restore_cache: keys: - dependencies-win-{{ arch }}-{{ checksum "scripts/install_deps.ps1" }} # DO NOT EDIT between here and save_cache, but rather edit .\scripts\install_deps.ps1 # WARNING! If you do edit anything here instead, remember to invalidate the cache manually. - run: name: "Installing dependencies" command: .\scripts\install_deps.ps1 shell: powershell.exe - save_cache: key: dependencies-win-{{ arch }}-{{ checksum "scripts/install_deps.ps1" }} paths: - .\deps - run: name: "Building solidity" command: .circleci/build_win.ps1 shell: powershell.exe - run: name: "Run solc.exe to make sure build was successful." command: .\build\solc\Release\solc.exe --version shell: powershell.exe - store_artifacts: *artifact_solc_windows - persist_to_workspace: root: build paths: - .\solc\*\solc.exe - .\test\*\soltest.exe - matrix_notify_failure_unless_pr t_win_soltest: &t_win_soltest <<: *base_win steps: # NOTE: Git's default core.autocrlf is fine for running soltest. We get additional coverage # for files using CRLF that way. - checkout - attach_workspace: at: build - run: name: "Install evmone" command: scripts/install_evmone.ps1 shell: powershell.exe - run: name: "Run soltest" command: .circleci/soltest.ps1 shell: powershell.exe - run: name: Install LSP test dependencies command: python -m pip install --user deepdiff colorama - run: name: Executing solc LSP test suite command: python ./test/lsp.py .\build\solc\Release\solc.exe --non-interactive shell: powershell.exe - store_test_results: *store_test_results - store_artifacts: *artifacts_test_results - matrix_notify_failure_unless_pr # Note: b_bytecode_ubu_static is required because b_ubu_static and b_ubu # are currently built on different Ubuntu base images. # It can be safely removed once we move both to the same Ubuntu version. b_bytecode_ubu_static: <<: *base_ubuntu2004_small environment: TERM: xterm MAKEFLAGS: -j 2 LC_ALL: C steps: - checkout - attach_workspace: at: build - prepare_bytecode_report: label: "ubuntu2004-static" binary_path: "../build/solc/solc-static-linux" b_bytecode_ubu: <<: *base_ubuntu2204_small environment: TERM: xterm MAKEFLAGS: -j 2 LC_ALL: C steps: - checkout - attach_workspace: at: build - prepare_bytecode_report: label: "ubuntu" binary_path: "../build/solc/solc" b_bytecode_osx: <<: *base_osx environment: TERM: xterm MAKEFLAGS: -j 5 LC_ALL: C steps: - checkout - attach_workspace: at: . - prepare_bytecode_report: label: "osx" binary_path: "../build/solc/solc" b_bytecode_win: <<: *base_win environment: LC_ALL: C steps: # NOTE: For bytecode generation we need the input files to be byte-for-byte identical on all # platforms so line ending conversions must absolutely be disabled. - run: git config --global core.autocrlf false - checkout # Ensure windows has python3 alias required by prepare_bytecode_report - run: ln -s /c/tools/miniconda3/python /c/tools/miniconda3/python3 - attach_workspace: at: build - prepare_bytecode_report: label: "windows" binary_path: "../build/solc/Release/solc.exe" b_bytecode_ems: <<: *base_node_small environment: SOLC_EMSCRIPTEN: "On" LC_ALL: C steps: - checkout - attach_workspace: at: emscripten_build/libsolc - run: scripts/bytecodecompare/storebytecode.sh && mv -v report.txt bytecode-report-emscripten.txt - store_artifacts: path: bytecode-report-emscripten.txt - persist_to_workspace: root: . paths: - bytecode-report-emscripten.txt - matrix_notify_failure_unless_pr t_bytecode_compare: <<: *base_ubuntu2204_small environment: REPORT_FILES: | bytecode-report-emscripten.txt bytecode-report-ubuntu2004-static-json.txt bytecode-report-ubuntu2004-static-cli.txt bytecode-report-ubuntu-json.txt bytecode-report-ubuntu-cli.txt bytecode-report-osx-json.txt bytecode-report-osx-cli.txt bytecode-report-windows-json.txt bytecode-report-windows-cli.txt steps: - attach_workspace: at: . - run: name: Compare reports command: diff --brief --report-identical-files --from-file $REPORT_FILES - run: name: Print diff when: on_fail command: diff --unified=0 --report-identical-files --from-file $REPORT_FILES | head --lines 50 - run: name: Bundle reports into a single package when: on_fail command: zip all-bytecode-reports.zip $REPORT_FILES - store_artifacts: # NOTE: store_artifacts does not support the 'when' attribute. # Fortunately when the artifact does not exist it just says "No artifact files found" and ignores it. path: all-bytecode-reports.zip - matrix_notify_failure_unless_pr c_release_binaries: <<: *base_ubuntu2204 steps: - checkout - attach_workspace: at: workspace - run: name: Gather and rename binaries from dependent jobs command: | mkdir github/ cp workspace/solc/solc-static-linux github/solc-static-linux cp workspace/build/solc/solc github/solc-macos cp workspace/solc/Release/solc.exe github/solc-windows.exe cp workspace/soljson.js github/soljson.js cd github/ tar --create --file ../github-binaries.tar * - store_artifacts: path: github-binaries.tar - run: name: Rename binaries to solc-bin naming convention command: | full_version=$( github/solc-static-linux --version | sed -En 's/^Version: ([0-9.]+.*\+commit\.[0-9a-f]+(\.mod)?).*$/\1/p' ) mkdir -p solc-bin/{linux-amd64,macosx-amd64,windows-amd64,bin} mv github/solc-static-linux "solc-bin/linux-amd64/solc-linux-amd64-v${full_version}" mv github/solc-macos "solc-bin/macosx-amd64/solc-macosx-amd64-v${full_version}" mv github/solc-windows.exe "solc-bin/windows-amd64/solc-windows-amd64-v${full_version}.exe" mv github/soljson.js "solc-bin/bin/soljson-v${full_version}.js" cd solc-bin/ tar --create --file ../solc-bin-binaries.tar * - store_artifacts: path: solc-bin-binaries.tar - matrix_notify_failure_unless_pr - matrix_notify_release_unless_pr workflows: version: 2 main: jobs: # basic checks - chk_spelling: *requires_nothing - chk_coding_style: *requires_nothing # DISABLED FOR 0.6.0 - chk_docs_examples: *requires_nothing - chk_buglist: *requires_nothing - chk_proofs: *requires_nothing - chk_pylint: *requires_nothing - chk_errorcodes: *requires_nothing - chk_antlr_grammar: *requires_nothing - chk_docs_pragma_min_version: *requires_nothing - t_ubu_pyscripts: *requires_nothing - t_win_pyscripts: *requires_nothing # build-only - b_docs: *requires_nothing # DISABLED FOR 0.8.18 - b_ubu_cxx20: *requires_nothing # Issue: https://github.com/ethereum/solidity/issues/13868 - b_ubu_ossfuzz: *requires_nothing # OS/X build and tests - b_osx: *requires_nothing - t_osx_cli: *requires_b_osx - t_osx_soltest: *requires_b_osx # ArchLinux build and tests - b_archlinux: *requires_nothing - t_archlinux_soltest: *requires_b_archlinux # Static build - b_ubu_static: *requires_nothing # Ubuntu build and tests - b_ubu: *requires_nothing - t_ubu_cli: *requires_b_ubu - t_ubu_locale: *requires_b_ubu - t_ubu_soltest_all: *requires_b_ubu - b_ubu_clang: *requires_nothing - t_ubu_clang_soltest: *requires_b_ubu_clang - t_ubu_lsp: *requires_b_ubu # Ubuntu fake release build and tests - b_ubu_force_release: *requires_nothing - t_ubu_force_release_cli: *requires_b_ubu_force_release - t_ubu_force_release_soltest_all: *requires_b_ubu_force_release # Emscripten build and tests that take 15 minutes or less - b_ems: *requires_nothing - t_ems_solcjs: *requires_b_ems - t_ems_ext_hardhat: *requires_b_ems - t_ext: *job_ems_compile_ext_colony - t_ext: *job_native_test_ext_gnosis - t_ext: *job_native_test_ext_zeppelin - t_ext: *job_native_test_ext_ens - t_ext: *job_native_test_ext_trident - t_ext: *job_native_test_ext_euler - t_ext: *job_native_test_ext_yield_liquidator - t_ext: *job_native_test_ext_bleeps - t_ext: *job_native_test_ext_pool_together - t_ext: *job_native_test_ext_perpetual_pools - t_ext: *job_native_test_ext_uniswap - t_ext: *job_native_test_ext_prb_math - t_ext: *job_native_test_ext_elementfi - t_ext: *job_native_test_ext_brink - t_ext: *job_native_test_ext_chainlink - t_ext: *job_native_test_ext_gp2 - c_ext_benchmarks: <<: *requires_nothing requires: - t_ems_compile_ext_colony - t_native_test_ext_gnosis - t_native_test_ext_zeppelin - t_native_test_ext_ens - t_native_test_ext_trident - t_native_test_ext_euler - t_native_test_ext_yield_liquidator - t_native_test_ext_bleeps - t_native_test_ext_pool_together - t_native_test_ext_perpetual_pools - t_native_test_ext_uniswap - t_native_test_ext_prb_math - t_native_test_ext_elementfi - t_native_test_ext_brink - t_native_test_ext_chainlink - t_native_test_ext_gp2 # Windows build and tests - b_win: *requires_nothing - t_win_soltest: *requires_b_win # Bytecode comparison: - b_bytecode_ubu_static: <<: *requires_nothing requires: - b_ubu_static - b_bytecode_ubu: <<: *requires_nothing requires: - b_ubu - b_bytecode_win: <<: *requires_nothing requires: - b_win - b_bytecode_osx: <<: *requires_nothing requires: - b_osx - b_bytecode_ems: <<: *requires_nothing requires: - b_ems - t_bytecode_compare: <<: *requires_nothing requires: - b_bytecode_ubu_static - b_bytecode_ubu - b_bytecode_win - b_bytecode_osx - b_bytecode_ems # Final artifacts - c_release_binaries: <<: *on_version_tags requires: - b_ubu_static - b_osx - b_win - b_ems nightly: triggers: - schedule: cron: "0 0 * * *" <<: *on_develop jobs: # OSSFUZZ builds and (regression) tests - b_ubu_ossfuzz: *requires_nothing - t_ubu_ossfuzz: *requires_b_ubu_ossfuzz # Code Coverage enabled build and tests - b_ubu_codecov: *requires_nothing - t_ubu_codecov: *requires_b_ubu_codecov # ASan build and tests - b_ubu_asan: *requires_nothing - b_ubu_san_clang: *job_b_ubu_asan_clang - t_ubu_asan_soltest: *requires_b_ubu_asan - t_ubu_asan_clang_soltest: *requires_b_ubu_asan_clang - t_ubu_asan_cli: *requires_b_ubu_asan # UBSan build and tests - b_ubu_san_clang: *job_b_ubu_ubsan_clang - t_ubu_ubsan_clang_soltest: *requires_b_ubu_ubsan_clang - t_ubu_ubsan_clang_cli: *requires_b_ubu_ubsan_clang # Emscripten build and tests that take more than 15 minutes to execute - b_ems: *requires_nothing - t_ext: *job_ems_test_ext_colony