Skip to content
Merged
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
29 changes: 29 additions & 0 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -ex

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

prerelease_source="${1:-ga}"

cd "${ROOTDIR}"

# shellcheck disable=SC2166
if [ -n "$FORCE_RELEASE" -o "$(git tag --points-at HEAD 2>/dev/null)" == tv* ]
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="${prerelease_source}.%cd" >prerelease.txt
fi

mkdir -p build
cd build

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

make
164 changes: 164 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
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: Upload artifact
uses: actions/upload-artifact@v4
with:
name: solc-windows
path: build\solc\Release\solc.exe
compression-level: 0

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

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

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

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: solc-macos
path: build/solc/solc
compression-level: 0

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: Upload artifact
uses: actions/upload-artifact@v4
with:
name: solc-linux
path: build/solc/solc
compression-level: 0

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: Upload artifact
uses: actions/upload-artifact@v4
with:
name: solc-ems
path: upload/soljson.js
compression-level: 0

upload-to-s3:
needs: [ b_windows, b_macos, b_linux, b_ems ]
runs-on: [ self-hosted, Linux ]
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

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

- name: Gather and rename binaries from dependent jobs
run: |
mkdir github/
cp artifacts/solc-linux/solc github/solc-static-linux
cp artifacts/solc-macos/solc github/solc-macos
cp artifacts/solc-windows/solc.exe github/solc-windows.exe
cp artifacts/solc-ems/soljson.js github/soljson.js

cd github
tar --create --file ../github-binaries.tar *

- name: Rename binaries to solc-bin naming convention
run: |
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 *

- name: Upload to S3
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
48 changes: 48 additions & 0 deletions .github/workflows/build_ems.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
set -ev

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

prerelease_source="${1:-ga}"

cd "${ROOTDIR}"

# shellcheck disable=SC2166
if [[ -n "$FORCE_RELEASE" || "$(git tag --points-at HEAD 2>/dev/null)" == tv* ]]
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="${prerelease_source}.%cd" >prerelease.txt
fi

# 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"
15 changes: 15 additions & 0 deletions .github/workflows/build_win.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$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