diff --git a/.circleci/config.yml b/.circleci/config.yml index 1b50f7583..6ac7365b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,6 +96,10 @@ defaults: name: Build command: scripts/ci/build.sh + - run_build_ninja: &run_build_ninja + name: Build (Ninja) + command: scripts/ci/build_ninja.sh + - run_build_ossfuzz: &run_build_ossfuzz name: Build_ossfuzz command: scripts/ci/build_ossfuzz.sh @@ -214,6 +218,11 @@ defaults: command: ./test/lsp.py ./build/solc/solc - gitter_notify_failure_unless_pr + - steps_build_ninja: &steps_build_ninja + steps: + - checkout + - run: *run_build_ninja + - steps_build: &steps_build steps: - checkout @@ -760,6 +769,12 @@ jobs: <<: *base_ubuntu2004_xlarge <<: *steps_build + b_ubu_ninja: &b_ubu_ninja + # 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_ubuntu2004 + <<: *steps_build_ninja + # 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. @@ -1448,6 +1463,7 @@ workflows: # Ubuntu build and tests - b_ubu: *workflow_trigger_on_tags + - b_ubu_ninja: *workflow_trigger_on_tags - t_ubu_cli: *workflow_ubuntu2004 - t_ubu_soltest_all: *workflow_ubuntu2004 - t_ubu_soltest_enforce_yul: *workflow_ubuntu2004 diff --git a/scripts/ci/build_ninja.sh b/scripts/ci/build_ninja.sh new file mode 100755 index 000000000..fcd3992e7 --- /dev/null +++ b/scripts/ci/build_ninja.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -ex + +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 + # Use last commit date rather than build date to avoid ending up with builds for + # different platforms having different version strings (and therefore producing different bytecode) + # if the CI is triggered just before midnight. + TZ=UTC git show --quiet --date="format-local:%Y.%-m.%-d" --format="ci.%cd" >prerelease.txt +fi + +if [ -n "$CIRCLE_SHA1" ] +then + echo -n "$CIRCLE_SHA1" >commit_hash.txt +fi + +mkdir -p build +cd build + +# shellcheck disable=SC2086 +cmake --version +cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" $CMAKE_OPTIONS -G "Ninja" +ninja -j 4