From 17f0b25d1c5cb8610ba0b22ccac047fb482b9ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Thu, 21 Oct 2021 17:37:05 +0200 Subject: [PATCH] CI: Define a base_ dict for every image and set default values for some env variables there --- .circleci/config.yml | 264 ++++++++++++++++++++++--------------------- 1 file changed, 134 insertions(+), 130 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ff099df01..2b93c4f09 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -168,14 +168,93 @@ defaults: - base_ubuntu1604_clang: &base_ubuntu1604_clang docker: - image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >> + environment: + TERM: xterm - base_ubuntu2004_clang: &base_ubuntu2004_clang docker: - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> + environment: + TERM: xterm + CC: clang + CXX: clang++ + MAKEFLAGS: -j 3 + + - base_ubuntu2004_clang_xlarge: &base_ubuntu2004_clang_xlarge + <<: *base_ubuntu2004_clang + resource_class: xlarge + environment: + TERM: xterm + CC: clang + CXX: clang++ + MAKEFLAGS: -j 10 - base_ubuntu2004: &base_ubuntu2004 docker: - image: << pipeline.parameters.ubuntu-2004-docker-image >> + environment: + TERM: xterm + + - base_ubuntu2004_xlarge: &base_ubuntu2004_xlarge + <<: *base_ubuntu2004 + resource_class: xlarge + environment: + TERM: xterm + MAKEFLAGS: -j 10 + + - base_buildpack_focal: &base_buildpack_focal + docker: + - image: buildpack-deps:focal + environment: + TERM: xterm + + - base_buildpack_latest: &base_buildpack_latest + docker: + - image: buildpack-deps:latest + environment: + TERM: xterm + + - base_archlinux: &base_archlinux + docker: + - image: archlinux:base + environment: + TERM: xterm + + - base_win_powershell: &base_win + executor: + name: win/default + shell: powershell.exe + + - base_win_cmd: &base_win + executor: + name: win/default + shell: powershell.exe + + - base_osx: &base_osx + macos: + xcode: "11.0.0" + environment: + TERM: xterm + + - base_ems_xlarge: &base_ems_xlarge + docker: + - image: << pipeline.parameters.emscripten-docker-image >> + resource_class: xlarge + environment: + TERM: xterm + MAKEFLAGS: -j 10 + + - base_python: &base_python + docker: + - image: circleci/python:3.6 + environment: + TERM: xterm + + - base_node_latest: &base_node_latest + docker: + - image: circleci/node + environment: + TERM: xterm # -------------------------------------------------------------------------- # Workflow Templates @@ -281,10 +360,7 @@ defaults: jobs: chk_spelling: - docker: - - image: circleci/python:3.6 - environment: - TERM: xterm + <<: *base_python steps: - checkout - attach_workspace: @@ -298,10 +374,7 @@ jobs: command: ~/.local/bin/codespell -S "*.enc,.git,Dockerfile*" -I ./scripts/codespell_whitelist.txt chk_docs_examples: - docker: - - image: circleci/node - environment: - TERM: xterm + <<: *base_node_latest steps: - checkout - attach_workspace: @@ -314,8 +387,7 @@ jobs: command: ./test/docsCodeStyle.sh chk_coding_style: - docker: - - image: buildpack-deps:focal + <<: *base_buildpack_focal steps: - checkout - run: @@ -332,8 +404,7 @@ jobs: command: ./scripts/check_symlinks.sh chk_errorcodes: - docker: - - image: circleci/python:3.6 + <<: *base_python steps: - checkout - run: @@ -341,8 +412,7 @@ jobs: command: ./scripts/error_codes.py --check chk_pylint: - docker: - - image: buildpack-deps:focal + <<: *base_buildpack_focal steps: - checkout - run: @@ -357,8 +427,7 @@ jobs: command: ./scripts/pylint_all.py chk_antlr_grammar: - docker: - - image: buildpack-deps:focal + <<: *base_buildpack_focal steps: - checkout - run: @@ -369,10 +438,7 @@ jobs: command: ./scripts/test_antlr_grammar.sh chk_buglist: - docker: - - image: circleci/node - environment: - TERM: xterm + <<: *base_node_latest steps: - checkout - run: @@ -386,10 +452,7 @@ jobs: command: ./test/buglistTests.js chk_proofs: - docker: - - image: buildpack-deps:latest - environment: - TERM: xterm + <<: *base_buildpack_latest steps: - checkout - run: @@ -401,17 +464,13 @@ jobs: - run: *run_proofs chk_docs_pragma_min_version: - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> - environment: - TERM: xterm + <<: *base_ubuntu2004 steps: - checkout - run: *run_docs_pragma_min_version t_pyscripts_ubu: - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> + <<: *base_ubuntu2004 steps: - checkout - run: @@ -419,9 +478,7 @@ jobs: command: python3 test/pyscriptTests.py t_pyscripts_win: - executor: - name: win/default - shell: powershell.exe + <<: *base_win_powershell steps: - run: git config --global core.autocrlf false - checkout @@ -430,11 +487,7 @@ jobs: command: python.exe test/pyscriptTests.py b_ubu: &b_ubu - resource_class: xlarge - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> - environment: - MAKEFLAGS: -j 10 + <<: *base_ubuntu2004_xlarge steps: - checkout - run: *run_build @@ -444,7 +497,7 @@ jobs: # x64 ASAN build, for testing for memory related bugs b_ubu_asan: &b_ubu_asan - <<: *b_ubu + <<: *base_ubuntu2004_xlarge environment: CMAKE_OPTIONS: -DSANITIZE=address MAKEFLAGS: -j 10 @@ -456,13 +509,7 @@ jobs: - persist_to_workspace: *artifacts_executables b_ubu_clang: &b_ubu_clang - resource_class: xlarge - docker: - - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> - environment: - CC: clang - CXX: clang++ - MAKEFLAGS: -j 10 + <<: *base_ubuntu2004_clang_xlarge steps: - checkout - run: *run_build @@ -470,8 +517,7 @@ jobs: - persist_to_workspace: *artifacts_executables b_ubu_asan_clang: &b_ubu_asan_clang - docker: - - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> + <<: *base_ubuntu2004_clang environment: CC: clang CXX: clang++ @@ -484,8 +530,7 @@ jobs: - persist_to_workspace: *artifacts_executables b_ubu_ubsan_clang: &b_ubu_ubsan_clang - docker: - - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> + <<: *base_ubuntu2004_clang environment: CC: clang CXX: clang++ @@ -505,7 +550,7 @@ jobs: MAKEFLAGS: -j 10 b_ubu_static: - <<: *b_ubu + <<: *base_ubuntu2004_xlarge environment: MAKEFLAGS: -j 10 CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DUSE_Z3_DLOPEN=ON -DUSE_CVC4=OFF -DSOLC_STATIC_STDLIBS=ON @@ -518,7 +563,7 @@ jobs: - store_artifacts: *artifacts_solc b_ubu_codecov: - <<: *b_ubu + <<: *base_ubuntu2004_xlarge environment: COVERAGE: ON CMAKE_BUILD_TYPE: Debug @@ -553,7 +598,7 @@ jobs: # 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: - <<: *b_ubu + <<: *base_ubuntu2004_xlarge environment: CMAKE_BUILD_TYPE: Debug CMAKE_OPTIONS: -DCMAKE_CXX_STANDARD=20 -DUSE_CVC4=OFF @@ -563,13 +608,7 @@ jobs: - run: *run_build b_ubu_ossfuzz: &b_ubu_ossfuzz - docker: - - image: << pipeline.parameters.ubuntu-1604-clang-ossfuzz-docker-image >> - environment: - CC: clang - CXX: clang++ - TERM: xterm - MAKEFLAGS: -j 3 + <<: *base_ubuntu1604_clang steps: - checkout - run: *setup_prerelease_commit_hash @@ -594,8 +633,7 @@ jobs: - store_artifacts: *artifacts_test_results b_archlinux: - docker: - - image: archlinux:base + <<: *base_archlinux environment: TERM: xterm MAKEFLAGS: -j 3 @@ -610,8 +648,7 @@ jobs: - persist_to_workspace: *artifacts_executables b_osx: - macos: - xcode: "11.0.0" + <<: *base_osx environment: TERM: xterm CMAKE_BUILD_TYPE: Release @@ -646,8 +683,7 @@ jobs: - build/test/tools/solfuzzer t_osx_soltest: - macos: - xcode: "11.0.0" + <<: *base_osx environment: EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 @@ -664,10 +700,7 @@ jobs: - store_artifacts: *artifacts_test_results t_osx_cli: - macos: - xcode: "11.0.0" - environment: - TERM: xterm + <<: *base_osx steps: - checkout - restore_cache: @@ -679,12 +712,7 @@ jobs: - store_artifacts: *artifacts_test_results b_ems: - resource_class: xlarge - docker: - - image: << pipeline.parameters.emscripten-docker-image >> - environment: - MAKEFLAGS: -j 10 - TERM: xterm + <<: *base_ems_xlarge steps: - checkout - run: @@ -704,8 +732,7 @@ jobs: - version.txt b_docs: - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> + <<: *base_ubuntu2004 steps: - checkout - run: *setup_prerelease_commit_hash @@ -722,27 +749,25 @@ jobs: <<: *steps_soltest_all t_archlinux_soltest: &t_archlinux_soltest - docker: - - image: archlinux:base - 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 - 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 + <<: *base_archlinux + 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 + 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_soltest_enforce_yul: &t_ubu_soltest_enforce_yul - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> + <<: *base_ubuntu2004 environment: EVM: << pipeline.parameters.evm-version >> SOLTEST_FLAGS: --enforce-via-yul @@ -750,7 +775,6 @@ jobs: TERM: xterm <<: *steps_soltest - t_ubu_clang_soltest: &t_ubu_clang_soltest <<: *base_ubuntu2004_clang environment: @@ -764,17 +788,14 @@ jobs: <<: *t_ubu_soltest_all t_ubu_cli: &t_ubu_cli - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> - environment: - TERM: xterm + <<: *base_ubuntu2004 <<: *steps_cmdline_tests t_ubu_release_cli: &t_ubu_release_cli <<: *t_ubu_cli t_ubu_asan_cli: - <<: *t_ubu_cli + <<: *base_ubuntu2004 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 @@ -800,10 +821,9 @@ jobs: <<: *steps_soltest t_ubu_ubsan_clang: + <<: *base_ubuntu2004_clang environment: EVM: << pipeline.parameters.evm-version >> - docker: - - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> steps: - when: condition: true @@ -811,8 +831,7 @@ jobs: - run: *gitter_notify_failure t_ubu_ubsan_clang_cli: - docker: - - image: << pipeline.parameters.ubuntu-2004-clang-docker-image >> + <<: *base_ubuntu2004_clang steps: - when: condition: true @@ -820,10 +839,7 @@ jobs: - run: *gitter_notify_failure t_ems_solcjs: - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> - environment: - TERM: xterm + <<: *base_ubuntu2004 steps: - checkout - attach_workspace: @@ -879,9 +895,7 @@ jobs: - run: *gitter_notify_success b_win: &b_win - executor: - name: win/default - shell: powershell.exe + <<: *base_win_powershell steps: # NOTE: Not disabling git's core.autocrlf here because we want to build using the typical Windows config. - checkout @@ -916,9 +930,7 @@ jobs: FORCE_RELEASE: ON t_win: &t_win - executor: - name: win/default - shell: powershell.exe + <<: *base_win_powershell steps: # NOTE: Git's default core.autocrlf is fine for running soltest. We get additional coverage # for files using CRLF that way. @@ -938,8 +950,7 @@ jobs: <<: *t_win b_bytecode_ubu: - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> + <<: *base_ubuntu2004 steps: - checkout - attach_workspace: @@ -959,10 +970,7 @@ jobs: - bytecode-report-ubuntu-cli.txt b_bytecode_osx: - macos: - xcode: "11.0.0" - environment: - TERM: xterm + <<: *base_osx steps: - checkout - attach_workspace: @@ -982,9 +990,7 @@ jobs: - bytecode-report-osx-cli.txt b_bytecode_win: - executor: - name: win/default - shell: cmd.exe + <<: *base_win_cmd 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. @@ -1007,8 +1013,7 @@ jobs: - bytecode-report-windows-cli.txt b_bytecode_ems: - docker: - - image: circleci/node:16 + <<: *base_node_latest environment: SOLC_EMSCRIPTEN: "On" steps: @@ -1024,8 +1029,7 @@ jobs: - bytecode-report-emscripten.txt t_bytecode_compare: - docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> + <<: *base_ubuntu2004 environment: REPORT_FILES: | bytecode-report-emscripten.txt