Skip to content

CircleCI slimming [WIP] #16125

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
112 changes: 101 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,71 @@ commands:
# --------------------------------------------------------------------------
# Build Commands

setup_ccache:
parameters:
os:
type: string
default: "undefined"
steps:
- run:
name: Create CMake files checksum
command: |
find . -name "CMakeLists.txt" -exec cat {} \; > /tmp/all-cmake-files.txt
- restore_cache:
keys:
- ccache-v1-<<parameters.os>>-{{ arch }}-{{ .Branch }}-{{ checksum "/tmp/all-cmake-files.txt" }}
- ccache-v1-<<parameters.os>>-{{ arch }}-{{ .Branch }}-
- ccache-v1-<<parameters.os>>-{{ arch }}-
- run:
name: Install and configure ccache
command: |
# Install ccache if not present (cmake will use it, via EthCcache)
if ! command -v ccache &> /dev/null; then
if command -v brew &> /dev/null; then
brew install ccache
elif command -v apt &> /dev/null; then
sudo apt update
sudo apt install -y ccache
elif command -v pacman &> /dev/null; then
# ArchLinux
sudo pacman --noconfirm -S ccache
else
echo "Warning: Unknown package manager, ccache may not be available"
fi
fi

# Configure ccache settings (only if ccache is available)
if command -v ccache &> /dev/null; then
ccache --set-config max_size=2G
ccache --set-config cache_dir=$HOME/.ccache
ccache --zero-stats

# Show initial stats
echo "ccache initial stats:"
ccache --show-stats
else
echo "ccache not available, skipping configuration"
fi

finalize_ccache:
parameters:
os:
type: string
steps:
- run:
name: Show ccache stats
command: |
if command -v ccache &> /dev/null; then
echo "ccache final stats:"
ccache --show-stats
else
echo "ccache not available"
fi
- save_cache:
key: ccache-v1-<<parameters.os>>-{{ arch }}-{{ .Branch }}-{{ checksum "/tmp/all-cmake-files.txt" }}
paths:
- ~/.ccache

setup_prerelease_commit_hash:
steps:
- run:
Expand All @@ -199,10 +264,18 @@ commands:
echo -n "$CIRCLE_SHA1" > commit_hash.txt

run_build:
parameters:
os:
type: string
default: "undefined"
steps:
- setup_ccache:
os: <<parameters.os>>
- run:
name: Build
command: scripts/ci/build.sh
- finalize_ccache:
os: <<parameters.os>>

run_build_ossfuzz:
steps:
Expand Down Expand Up @@ -341,9 +414,14 @@ commands:
- matrix_notify_failure_unless_pr

build:
parameters:
os:
type: string
default: "undefined"
steps:
- checkout
- run_build
- run_build:
os: << parameters.os >>
- store_artifacts_solc
- store_artifacts_yul_phaser
- persist_executables_to_workspace
Expand Down Expand Up @@ -1034,7 +1112,8 @@ jobs:
# Enough other jobs depend on it that it's worth it though.
<<: *base_ubuntu2404_xlarge
steps:
- build
- build:
os: ubu

# x64 ASAN build, for testing for memory related bugs
b_ubu_asan: &b_ubu_asan
Expand All @@ -1051,15 +1130,17 @@ jobs:
# Set the number of jobs to two instead of the default three, so that we do not run out of memory
MAKEFLAGS: -j 2
steps:
- build
- build:
os: ubu_asan

b_ubu_clang: &b_ubu_clang
<<: *base_ubuntu2404_clang_large
environment:
<<: *base_ubuntu2404_clang_large_env
MAKEFLAGS: -j 10
steps:
- build
- build:
os: ubu_clang

b_ubu_san_clang:
# This runs a bit faster on large and xlarge but on nightly efficiency matters more.
Expand All @@ -1072,7 +1153,8 @@ jobs:
# NOTE: Disabled pedantic builds to avoid false positives, see b_ubu_asan for a more detailed explanation.
CMAKE_OPTIONS: -DPEDANTIC=OFF << parameters.cmake_options >>
steps:
- build
- build:
os: ubu_san_clang

b_ubu_force_release: &b_ubu_force_release
<<: *b_ubu
Expand All @@ -1091,7 +1173,8 @@ jobs:
CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DSOLC_LINK_STATIC=ON
steps:
- checkout
- run_build
- run_build:
os: ubu
- run:
name: strip binary
command: strip build/solc/solc
Expand All @@ -1109,7 +1192,8 @@ jobs:
<<: *base_ubuntu2204_large
steps:
- checkout
- run_build
- run_build:
os: ubu_2204
- matrix_notify_failure_unless_pr

b_ubu_2204_clang:
Expand All @@ -1119,7 +1203,8 @@ jobs:
MAKEFLAGS: -j 10
steps:
- checkout
- run_build
- run_build:
os: ubu_2204_clang
- matrix_notify_failure_unless_pr

b_ubu_ossfuzz: &b_ubu_ossfuzz
Expand Down Expand Up @@ -1157,7 +1242,8 @@ jobs:
command: |
pacman --noconfirm -Syu --noprogressbar --needed base-devel boost cmake git openssh tar
- checkout
- run_build
- run_build:
os: archlinux
- store_artifacts_solc
- persist_executables_to_workspace
- matrix_notify_failure_unless_pr
Expand All @@ -1172,7 +1258,8 @@ jobs:
steps:
- checkout
- install_dependencies_osx
- run_build
- run_build:
os: mac
- store_artifacts_solc
- store_artifacts_yul_phaser
- persist_executables_to_workspace_osx
Expand Down Expand Up @@ -1215,10 +1302,14 @@ jobs:
MAKEFLAGS: -j 10
steps:
- checkout
- setup_ccache:
os: ems
- run:
name: Build
command: |
scripts/ci/build_emscripten.sh
- finalize_ccache:
os: ems
- store_artifacts:
path: upload/soljson.js
destination: soljson.js
Expand Down Expand Up @@ -1889,7 +1980,6 @@ workflows:

# build-only
- b_docs: *requires_nothing
- b_ubu_ossfuzz: *requires_nothing
- b_ubu_2204: *requires_nothing
- b_ubu_2204_clang: *requires_nothing

Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/build_emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ function build() {
-DBoost_USE_STATIC_LIBS=1 \
-DBoost_USE_STATIC_RUNTIME=1 \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DTESTS=0 \
..
make soljson
Expand Down