Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e951713
Add github actions scripts for building binaries
yanghang8612 Nov 7, 2025
dea0590
Grant pull-requests write permission to enable welcome-external-pr bo…
r0qs Sep 8, 2025
dd1d0f3
Merge pull request #95 from yanghang8612/add_building_scripts
CodeNinjaEvan Nov 7, 2025
7e0b802
Remove unused compression config in build.yml
yanghang8612 Nov 7, 2025
e255fe8
Merge pull request #96 from yanghang8612/remove_unused_compression
CodeNinjaEvan Nov 7, 2025
0dbb79b
Must use the login shell for the CMake path to take effect
yanghang8612 Nov 7, 2025
e873411
Merge pull request #97 from yanghang8612/fix_cmake_path_issue
CodeNinjaEvan Nov 7, 2025
f8c2b6a
Only build release version on develop
yanghang8612 Nov 11, 2025
82a2d0f
Use cache instead of artifact
yanghang8612 Nov 12, 2025
1d19e75
Merge pull request #98 from yanghang8612/optimize_ga_workflow
CodeNinjaEvan Nov 12, 2025
945d096
Directly build release version for all jobs
yanghang8612 Nov 12, 2025
a4a86c5
Merge pull request #99 from yanghang8612/build_release_version
CodeNinjaEvan Nov 12, 2025
fc5a528
Add read permission for upload job
yanghang8612 Nov 12, 2025
0a97fd3
Enable enableCrossOsArchive while restoring cache on windows or macos
yanghang8612 Nov 12, 2025
c159384
Merge pull request #100 from yanghang8612/fix_cache_restore_issue
CodeNinjaEvan Nov 12, 2025
543b012
Use the same path for saving and restoring
yanghang8612 Nov 12, 2025
b4e33fe
Merge pull request #101 from yanghang8612/solve_missing_key
CodeNinjaEvan Nov 12, 2025
56692e3
Change upload job runs-on to macOS and cleanup workspace after uploaded
yanghang8612 Nov 12, 2025
d42d10b
Merge pull request #102 from yanghang8612/change_platform_for_upload
CodeNinjaEvan Nov 12, 2025
c7c5ba3
Change upload job runs-on to macOS and cleanup workspace after uploaded
CodeNinjaEvan Nov 12, 2025
48439fd
Switch to zsh for uploading job
yanghang8612 Nov 12, 2025
2babca7
Merge pull request #103 from yanghang8612/switch_sh_for_upload
CodeNinjaEvan Nov 12, 2025
927d654
Use solc-macos to get full version
yanghang8612 Nov 13, 2025
17922ad
Merge pull request #104 from yanghang8612/fix_full_version
CodeNinjaEvan Nov 13, 2025
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
19 changes: 19 additions & 0 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -ex

ROOTDIR="$(dirname "$0")/../.."
# shellcheck source=scripts/common.sh
source "${ROOTDIR}/scripts/common.sh"

cd "${ROOTDIR}"

# Build release version
echo -n >prerelease.txt

mkdir -p build
cd build

# shellcheck disable=SC2086
cmake .. -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}" $CMAKE_OPTIONS -G "Unix Makefiles"

make
221 changes: 221 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
name: Build binaries on multi platform
on:
push:
branches:
- develop
- "release_*"

jobs:
b_windows:
runs-on: [ self-hosted, Windows ]

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: .\deps
key: dependencies-win-${{ runner.arch }}-${{ hashFiles('scripts/install_deps.ps1') }}
restore-keys: dependencies-win-${{ runner.arch }}-

- name: Installing dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
shell: powershell
run: .\scripts\install_deps.ps1

- name: Run build script
shell: bash
run: powershell.exe .github/workflows/build_win.ps1

- name: Prepare artifact for caching
shell: bash
run: |
mkdir github/
cp build/solc/Release/solc.exe github/solc-windows.exe

- name: Save artifact to cache
uses: actions/cache/save@v4
with:
path: github/solc-windows.exe
key: solc-windows-${{ github.run_id }}
enableCrossOsArchive: true

b_macos:
runs-on: [ self-hosted, macOS ]

env:
CMAKE_BUILD_TYPE: Release
CMAKE_OPTIONS: -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64;arm64
TERM: xterm
MAKEFLAGS: -j5
CPUs: 5

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Run build script
shell: bash -el {0}
run: .github/workflows/build.sh

- name: Prepare artifact for caching
run: |
mkdir github/
cp build/solc/solc github/solc-macos

- name: Save artifact to cache
uses: actions/cache/save@v4
with:
path: github/solc-macos
key: solc-macos-${{ github.run_id }}
enableCrossOsArchive: true

b_linux:
runs-on: [ self-hosted, Linux, for-linux ]

env:
CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DUSE_Z3_DLOPEN=ON -DUSE_CVC4=OFF -DSOLC_STATIC_STDLIBS=ON
MAKEFLAGS: -j 10
CPUs: 10

container:
image: solbuildpackpusher/solidity-buildpack-deps@sha256:84a1fb8771236e8d9aa5c615a425b8929e56a6e4f150a60078c8d74a1ceaa6c2

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Fix git safe directory
run: git config --global --add safe.directory '*'

- name: Run build script
run: .github/workflows/build.sh

- name: Prepare artifact for caching
run: |
mkdir github/
cp build/solc/solc github/solc-static-linux

- name: Save artifact to cache
uses: actions/cache/save@v4
with:
path: github/solc-static-linux
key: solc-linux-${{ github.run_id }}

b_ems:
runs-on: [ self-hosted, Linux, for-ems ]

env:
MAKEFLAGS: -j 10
CPUs: 5

container:
image: solbuildpackpusher/solidity-buildpack-deps@sha256:c57f2bfb8c15d70fe290629358dd1c73dc126e3760f443b54764797556b887d4

steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Fix git safe directory
run: git config --global --add safe.directory '*'

- name: Run build script
run: .github/workflows/build_ems.sh

- name: Prepare artifact for caching
run: |
mkdir github/
cp upload/soljson.js github/soljson.js

- name: Save artifact to cache
uses: actions/cache/save@v4
with:
path: github/soljson.js
key: solc-ems-${{ github.run_id }}

upload-to-s3:
needs: [ b_windows, b_macos, b_linux, b_ems ]

runs-on: [ self-hosted, macOS ]

permissions:
actions: read
contents: read

steps:
- name: Restore solc-windows
uses: actions/cache/restore@v4
with:
path: github/solc-windows.exe
key: solc-windows-${{ github.run_id }}
enableCrossOsArchive: true

- name: Restore solc-macos
uses: actions/cache/restore@v4
with:
path: github/solc-macos
key: solc-macos-${{ github.run_id }}
enableCrossOsArchive: true

- name: Restore solc-linux
uses: actions/cache/restore@v4
with:
path: github/solc-static-linux
key: solc-linux-${{ github.run_id }}

- name: Restore solc-ems
uses: actions/cache/restore@v4
with:
path: github/soljson.js
key: solc-ems-${{ github.run_id }}

- name: List all artifacts
run: |
ls -R github/

- name: Create tarball for use on github
run: |
cd github
tar --create --file ../github-binaries.tar *

- name: Rename binaries to solc-bin naming convention
run: |
full_version=$(
github/solc-macos --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}

cp github/solc-static-linux "solc-bin/linux-amd64/solc-linux-amd64-v${full_version}"
cp github/solc-macos "solc-bin/macosx-amd64/solc-macosx-amd64-v${full_version}"
cp github/solc-windows.exe "solc-bin/windows-amd64/solc-windows-amd64-v${full_version}.exe"
cp github/soljson.js "solc-bin/bin/soljson-v${full_version}.js"

cd solc-bin/
tar --create --file ../solc-bin-binaries.tar *

- name: Upload to S3
shell: zsh -el {0}
env:
S3_BUCKET_PROD: ${{ secrets.S3_BUCKET_PROD }}
S3_BUCKET_TEST: ${{ secrets.S3_BUCKET_TEST }}
run: |
case "${GITHUB_REF_NAME}" in
develop) bucket="${S3_BUCKET_PROD}" ;;
release_*) bucket="${S3_BUCKET_TEST}" ;;
esac

aws s3 cp github-binaries.tar "s3://${bucket}/${{ github.sha }}/" --only-show-errors
aws s3 cp solc-bin-binaries.tar "s3://${bucket}/${{ github.sha }}/" --only-show-errors

cd github
aws s3 cp solc-windows.exe "s3://${bucket}/${{ github.sha }}/" --only-show-errors
aws s3 cp solc-macos "s3://${bucket}/${{ github.sha }}/" --only-show-errors
aws s3 cp solc-static-linux "s3://${bucket}/${{ github.sha }}/" --only-show-errors
aws s3 cp soljson.js "s3://${bucket}/${{ github.sha }}/" --only-show-errors

cd .. && rm -rf github solc-bin *.tar
38 changes: 38 additions & 0 deletions .github/workflows/build_ems.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -ev

ROOTDIR="$(dirname "$0")/../.."
# shellcheck source=scripts/common.sh
source "${ROOTDIR}/scripts/common.sh"

cd "${ROOTDIR}"

# Build release version
echo -n >prerelease.txt

# Disable warnings for unqualified `move()` calls, introduced and enabled by
# default in clang-16 which is what the emscripten docker image uses.
# Additionally, disable the warning for unknown warnings here, as this script is
# also used with earlier clang versions.
# TODO: This can be removed if and when all usages of `move()` in our codebase use the `std::` qualifier.
CMAKE_CXX_FLAGS="-Wno-unqualified-std-cast-call"

mkdir -p build
cd build
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBoost_USE_STATIC_LIBS=1 \
-DBoost_USE_STATIC_RUNTIME=1 \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
-DTESTS=0 \
..
make soljson

cd ..
mkdir -p upload
scripts/ci/pack_soljson.sh "build/libsolc/soljson.js" "build/libsolc/soljson.wasm" upload/soljson.js
cp upload/soljson.js ./

OUTPUT_SIZE=$(ls -la soljson.js)

echo "Emscripten output size: $OUTPUT_SIZE"
16 changes: 16 additions & 0 deletions .github/workflows/build_win.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
$ErrorActionPreference = "Stop"

cd "$PSScriptRoot\..\.."

New-Item prerelease.txt -type file
Write-Host "Building release version."

mkdir build
cd build
$boost_dir=(Resolve-Path $PSScriptRoot\..\..\deps\boost\lib\cmake\Boost-*)
..\deps\cmake\bin\cmake -G "Visual Studio 17 2022" -DBoost_DIR="$boost_dir\" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_INSTALL_PREFIX="$PSScriptRoot\..\..\upload" -DUSE_Z3=OFF ..
if ( -not $? ) { throw "CMake configure failed." }
msbuild solidity.sln /p:Configuration=Release /m:10 /v:minimal
if ( -not $? ) { throw "Build failed." }
..\deps\cmake\bin\cmake --build . -j 10 --target install --config Release
if ( -not $? ) { throw "Install target failed." }
4 changes: 4 additions & 0 deletions .github/workflows/welcome-external-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
types:
- opened

permissions:
pull-requests: write
contents: read

env:
DRY_RUN: false

Expand Down
Loading