From e951713dbb53b3f4de13c3539258965ba97e0416 Mon Sep 17 00:00:00 2001 From: Asuka Date: Fri, 7 Nov 2025 15:06:21 +0800 Subject: [PATCH 01/14] Add github actions scripts for building binaries --- .github/workflows/build.sh | 29 ++++++ .github/workflows/build.yml | 164 ++++++++++++++++++++++++++++++++ .github/workflows/build_ems.sh | 48 ++++++++++ .github/workflows/build_win.ps1 | 15 +++ 4 files changed, 256 insertions(+) create mode 100755 .github/workflows/build.sh create mode 100644 .github/workflows/build.yml create mode 100755 .github/workflows/build_ems.sh create mode 100644 .github/workflows/build_win.ps1 diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh new file mode 100755 index 000000000000..f611e488c7f8 --- /dev/null +++ b/.github/workflows/build.sh @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..9b58bf5736a2 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/build_ems.sh b/.github/workflows/build_ems.sh new file mode 100755 index 000000000000..add6541e41d3 --- /dev/null +++ b/.github/workflows/build_ems.sh @@ -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" diff --git a/.github/workflows/build_win.ps1 b/.github/workflows/build_win.ps1 new file mode 100644 index 000000000000..07682b4a0dfc --- /dev/null +++ b/.github/workflows/build_win.ps1 @@ -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." } From dea0590ece635e2067b2017a5d4d80b21e9419d6 Mon Sep 17 00:00:00 2001 From: r0qs <457348+r0qs@users.noreply.github.com> Date: Mon, 8 Sep 2025 18:44:26 +0200 Subject: [PATCH 02/14] Grant pull-requests write permission to enable welcome-external-pr bot commenting --- .github/workflows/welcome-external-pr.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/welcome-external-pr.yml b/.github/workflows/welcome-external-pr.yml index ac8d1362eac3..f29392e2f829 100644 --- a/.github/workflows/welcome-external-pr.yml +++ b/.github/workflows/welcome-external-pr.yml @@ -5,6 +5,10 @@ on: types: - opened +permissions: + pull-requests: write + contents: read + env: DRY_RUN: false From 7e0b80203e8d159487f792ab15864ab6e5c22550 Mon Sep 17 00:00:00 2001 From: Asuka Date: Fri, 7 Nov 2025 16:54:06 +0800 Subject: [PATCH 03/14] Remove unused compression config in build.yml --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b58bf5736a2..b5bb6ab4b2f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,6 @@ jobs: with: name: solc-windows path: build\solc\Release\solc.exe - compression-level: 0 b_macos: runs-on: [ self-hosted, macOS ] @@ -52,7 +51,6 @@ jobs: with: name: solc-macos path: build/solc/solc - compression-level: 0 b_linux: runs-on: [ self-hosted, Linux, for-linux ] @@ -80,7 +78,6 @@ jobs: with: name: solc-linux path: build/solc/solc - compression-level: 0 b_ems: runs-on: [ self-hosted, Linux, for-ems ] @@ -107,7 +104,6 @@ jobs: with: name: solc-ems path: upload/soljson.js - compression-level: 0 upload-to-s3: needs: [ b_windows, b_macos, b_linux, b_ems ] From 0dbb79b72eb0644c71583fb8b46f6dc7656779c6 Mon Sep 17 00:00:00 2001 From: Asuka Date: Fri, 7 Nov 2025 18:09:44 +0800 Subject: [PATCH 04/14] Must use the login shell for the CMake path to take effect --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5bb6ab4b2f4..3c433b667e05 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,7 @@ jobs: uses: actions/checkout@v5 - name: Run build script + shell: bash -el {0} run: .github/workflows/build.sh - name: Upload artifact From f8c2b6af4bd0ec5930d38e771e82033ae981624f Mon Sep 17 00:00:00 2001 From: Asuka Date: Tue, 11 Nov 2025 15:17:04 +0800 Subject: [PATCH 05/14] Only build release version on develop --- .github/workflows/build.sh | 2 +- .github/workflows/build_ems.sh | 2 +- .github/workflows/build_win.ps1 | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh index f611e488c7f8..ad152bcbdca9 100755 --- a/.github/workflows/build.sh +++ b/.github/workflows/build.sh @@ -10,7 +10,7 @@ prerelease_source="${1:-ga}" cd "${ROOTDIR}" # shellcheck disable=SC2166 -if [ -n "$FORCE_RELEASE" -o "$(git tag --points-at HEAD 2>/dev/null)" == tv* ] +if [ "$GITHUB_REF_NAME" == "develop" ] then echo -n >prerelease.txt else diff --git a/.github/workflows/build_ems.sh b/.github/workflows/build_ems.sh index add6541e41d3..5429da5fb016 100755 --- a/.github/workflows/build_ems.sh +++ b/.github/workflows/build_ems.sh @@ -10,7 +10,7 @@ prerelease_source="${1:-ga}" cd "${ROOTDIR}" # shellcheck disable=SC2166 -if [[ -n "$FORCE_RELEASE" || "$(git tag --points-at HEAD 2>/dev/null)" == tv* ]] +if [ "$GITHUB_REF_NAME" == "develop" ] then echo -n >prerelease.txt else diff --git a/.github/workflows/build_win.ps1 b/.github/workflows/build_win.ps1 index 07682b4a0dfc..a3dd01dc3549 100644 --- a/.github/workflows/build_win.ps1 +++ b/.github/workflows/build_win.ps1 @@ -2,8 +2,19 @@ $ErrorActionPreference = "Stop" cd "$PSScriptRoot\..\.." -New-Item prerelease.txt -type file -Write-Host "Building release version." +if ($Env:GITHUB_REF_NAME -eq 'develop') { + New-Item prerelease.txt -type file + Write-Host "Building release version." +} +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. + $last_commit_timestamp = git log -1 --date=unix --format=%cd HEAD + $last_commit_date = (Get-Date -Date "1970-01-01 00:00:00Z").toUniversalTime().addSeconds($last_commit_timestamp).ToString("yyyy.M.d") + -join("ga.", $last_commit_date) | out-file -encoding ascii prerelease.txt +} + mkdir build cd build $boost_dir=(Resolve-Path $PSScriptRoot\..\..\deps\boost\lib\cmake\Boost-*) From 82a2d0fcc7bbe65812bfdfb3c09e091880b11e01 Mon Sep 17 00:00:00 2001 From: Asuka Date: Wed, 12 Nov 2025 11:07:23 +0800 Subject: [PATCH 06/14] Use cache instead of artifact --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c433b667e05..45bdb1eda2b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,15 +30,22 @@ jobs: shell: bash run: powershell.exe .github/workflows/build_win.ps1 - - name: Upload artifact - uses: actions/upload-artifact@v4 + - name: Save artifact to cache + uses: actions/cache/save@v4 with: - name: solc-windows path: build\solc\Release\solc.exe + key: solc-windows-${{ github.run_id }} 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 @@ -47,11 +54,11 @@ jobs: shell: bash -el {0} run: .github/workflows/build.sh - - name: Upload artifact - uses: actions/upload-artifact@v4 + - name: Save artifact to cache + uses: actions/cache/save@v4 with: - name: solc-macos path: build/solc/solc + key: solc-macos-${{ github.run_id }} b_linux: runs-on: [ self-hosted, Linux, for-linux ] @@ -74,11 +81,11 @@ jobs: - name: Run build script run: .github/workflows/build.sh - - name: Upload artifact - uses: actions/upload-artifact@v4 + - name: Save artifact to cache + uses: actions/cache/save@v4 with: - name: solc-linux path: build/solc/solc + key: solc-linux-${{ github.run_id }} b_ems: runs-on: [ self-hosted, Linux, for-ems ] @@ -100,20 +107,39 @@ jobs: - name: Run build script run: .github/workflows/build_ems.sh - - name: Upload artifact - uses: actions/upload-artifact@v4 + - name: Save artifact to cache + uses: actions/cache/save@v4 with: - name: solc-ems path: upload/soljson.js + key: solc-ems-${{ github.run_id }} 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 + - name: Restore solc-windows + uses: actions/cache/restore@v4 + with: + path: artifacts/solc-windows/solc.exe + key: solc-windows-${{ github.run_id }} + + - name: Restore solc-macos + uses: actions/cache/restore@v4 + with: + path: artifacts/solc-macos/solc + key: solc-macos-${{ github.run_id }} + + - name: Restore solc-linux + uses: actions/cache/restore@v4 + with: + path: artifacts/solc-linux/solc + key: solc-linux-${{ github.run_id }} + + - name: Restore solc-ems + uses: actions/cache/restore@v4 with: - path: artifacts + path: artifacts/solc-ems/soljson.js + key: solc-ems-${{ github.run_id }} - name: List all artifacts run: | From 945d0966703c7e36fd52885c024b148a69a528ec Mon Sep 17 00:00:00 2001 From: Asuka Date: Wed, 12 Nov 2025 11:59:00 +0800 Subject: [PATCH 07/14] Directly build release version for all jobs --- .github/workflows/build.sh | 14 ++------------ .github/workflows/build_ems.sh | 14 ++------------ .github/workflows/build_win.ps1 | 14 ++------------ 3 files changed, 6 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh index ad152bcbdca9..fd0a79906b1a 100755 --- a/.github/workflows/build.sh +++ b/.github/workflows/build.sh @@ -5,20 +5,10 @@ ROOTDIR="$(dirname "$0")/../.." # shellcheck source=scripts/common.sh source "${ROOTDIR}/scripts/common.sh" -prerelease_source="${1:-ga}" - cd "${ROOTDIR}" -# shellcheck disable=SC2166 -if [ "$GITHUB_REF_NAME" == "develop" ] -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 +# Build release version +echo -n >prerelease.txt mkdir -p build cd build diff --git a/.github/workflows/build_ems.sh b/.github/workflows/build_ems.sh index 5429da5fb016..d1de130dff1b 100755 --- a/.github/workflows/build_ems.sh +++ b/.github/workflows/build_ems.sh @@ -5,20 +5,10 @@ ROOTDIR="$(dirname "$0")/../.." # shellcheck source=scripts/common.sh source "${ROOTDIR}/scripts/common.sh" -prerelease_source="${1:-ga}" - cd "${ROOTDIR}" -# shellcheck disable=SC2166 -if [ "$GITHUB_REF_NAME" == "develop" ] -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 +# 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. diff --git a/.github/workflows/build_win.ps1 b/.github/workflows/build_win.ps1 index a3dd01dc3549..8b9fcaa5d66c 100644 --- a/.github/workflows/build_win.ps1 +++ b/.github/workflows/build_win.ps1 @@ -2,18 +2,8 @@ $ErrorActionPreference = "Stop" cd "$PSScriptRoot\..\.." -if ($Env:GITHUB_REF_NAME -eq 'develop') { - New-Item prerelease.txt -type file - Write-Host "Building release version." -} -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. - $last_commit_timestamp = git log -1 --date=unix --format=%cd HEAD - $last_commit_date = (Get-Date -Date "1970-01-01 00:00:00Z").toUniversalTime().addSeconds($last_commit_timestamp).ToString("yyyy.M.d") - -join("ga.", $last_commit_date) | out-file -encoding ascii prerelease.txt -} +New-Item prerelease.txt -type file +Write-Host "Building release version." mkdir build cd build From fc5a528e415dee6718c6c98ffd544f17e16235fd Mon Sep 17 00:00:00 2001 From: Asuka Date: Wed, 12 Nov 2025 14:00:58 +0800 Subject: [PATCH 08/14] Add read permission for upload job --- .github/workflows/build.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45bdb1eda2b9..8ae80b11ea27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: with: path: build\solc\Release\solc.exe key: solc-windows-${{ github.run_id }} + enableCrossOsArchive: true b_macos: runs-on: [ self-hosted, macOS ] @@ -59,6 +60,7 @@ jobs: with: path: build/solc/solc key: solc-macos-${{ github.run_id }} + enableCrossOsArchive: true b_linux: runs-on: [ self-hosted, Linux, for-linux ] @@ -115,7 +117,13 @@ jobs: upload-to-s3: needs: [ b_windows, b_macos, b_linux, b_ems ] + runs-on: [ self-hosted, Linux ] + + permissions: + actions: read + contents: read + steps: - name: Restore solc-windows uses: actions/cache/restore@v4 @@ -152,7 +160,7 @@ jobs: 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 * From 0a97fd3df5c43b0f425e5de81c8acfeab431ed0e Mon Sep 17 00:00:00 2001 From: Asuka Date: Wed, 12 Nov 2025 14:10:01 +0800 Subject: [PATCH 09/14] Enable enableCrossOsArchive while restoring cache on windows or macos --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ae80b11ea27..1ef918232ccb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -130,12 +130,14 @@ jobs: with: path: artifacts/solc-windows/solc.exe key: solc-windows-${{ github.run_id }} + enableCrossOsArchive: true - name: Restore solc-macos uses: actions/cache/restore@v4 with: path: artifacts/solc-macos/solc key: solc-macos-${{ github.run_id }} + enableCrossOsArchive: true - name: Restore solc-linux uses: actions/cache/restore@v4 From 543b0122147e563f8e2b80319ce170ad1bd29b36 Mon Sep 17 00:00:00 2001 From: Asuka Date: Wed, 12 Nov 2025 15:42:11 +0800 Subject: [PATCH 10/14] Use the same path for saving and restoring --- .github/workflows/build.yml | 64 +++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ef918232ccb..81c21ba9b950 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,10 +30,16 @@ jobs: 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: build\solc\Release\solc.exe + path: github/solc-windows.exe key: solc-windows-${{ github.run_id }} enableCrossOsArchive: true @@ -55,10 +61,16 @@ jobs: shell: bash -el {0} run: .github/workflows/build.sh + - name: Prepare artifact for caching + shell: bash + run: | + mkdir github/ + cp build/solc/solc github/solc-macos + - name: Save artifact to cache uses: actions/cache/save@v4 with: - path: build/solc/solc + path: github/solc-macos key: solc-macos-${{ github.run_id }} enableCrossOsArchive: true @@ -83,10 +95,16 @@ jobs: - name: Run build script run: .github/workflows/build.sh + - name: Prepare artifact for caching + shell: bash + run: | + mkdir github/ + cp build/solc/solc github/solc-static-linux + - name: Save artifact to cache uses: actions/cache/save@v4 with: - path: build/solc/solc + path: github/solc-static-linux key: solc-linux-${{ github.run_id }} b_ems: @@ -109,10 +127,16 @@ jobs: - name: Run build script run: .github/workflows/build_ems.sh + - name: Prepare artifact for caching + shell: bash + run: | + mkdir github/ + cp upload/soljson.js github/soljson.js + - name: Save artifact to cache uses: actions/cache/save@v4 with: - path: upload/soljson.js + path: github/soljson.js key: solc-ems-${{ github.run_id }} upload-to-s3: @@ -128,41 +152,35 @@ jobs: - name: Restore solc-windows uses: actions/cache/restore@v4 with: - path: artifacts/solc-windows/solc.exe + path: github/solc-windows.exe key: solc-windows-${{ github.run_id }} enableCrossOsArchive: true - name: Restore solc-macos uses: actions/cache/restore@v4 with: - path: artifacts/solc-macos/solc + path: github/solc-macos key: solc-macos-${{ github.run_id }} enableCrossOsArchive: true - name: Restore solc-linux uses: actions/cache/restore@v4 with: - path: artifacts/solc-linux/solc + path: github/solc-static-linux key: solc-linux-${{ github.run_id }} - name: Restore solc-ems uses: actions/cache/restore@v4 with: - path: artifacts/solc-ems/soljson.js + path: github/soljson.js key: solc-ems-${{ github.run_id }} - name: List all artifacts run: | - ls -R artifacts/ + ls -R github/ - - name: Gather and rename binaries from dependent jobs + - name: Create tarball for use on github 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 * @@ -175,10 +193,10 @@ jobs: 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" + 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 * @@ -195,3 +213,9 @@ jobs: 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 From 56692e35549aaabbc45ee5dbaa38cf35a057c4db Mon Sep 17 00:00:00 2001 From: Asuka Date: Wed, 12 Nov 2025 18:04:10 +0800 Subject: [PATCH 11/14] Change upload job runs-on to macOS and cleanup workspace after uploaded --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81c21ba9b950..3be6bff4a7f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,7 +142,7 @@ jobs: upload-to-s3: needs: [ b_windows, b_macos, b_linux, b_ems ] - runs-on: [ self-hosted, Linux ] + runs-on: [ self-hosted, macOS ] permissions: actions: read @@ -219,3 +219,5 @@ jobs: 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 \ No newline at end of file From c7c5ba3987a65d2c2d0dc4bfd7dabbe084848571 Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 12 Nov 2025 18:33:18 +0800 Subject: [PATCH 12/14] Change upload job runs-on to macOS and cleanup workspace after uploaded --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3be6bff4a7f8..65bd7aba4b6c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -202,6 +202,7 @@ jobs: tar --create --file ../solc-bin-binaries.tar * - name: Upload to S3 + shell: bash -el {0} env: S3_BUCKET_PROD: ${{ secrets.S3_BUCKET_PROD }} S3_BUCKET_TEST: ${{ secrets.S3_BUCKET_TEST }} @@ -220,4 +221,4 @@ jobs: 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 \ No newline at end of file + cd .. && rm -rf github solc-bin *.tar From 48439fdb10cd0498eb4713ef4e683bcf65fca0c2 Mon Sep 17 00:00:00 2001 From: Asuka Date: Wed, 12 Nov 2025 19:24:09 +0800 Subject: [PATCH 13/14] Switch to zsh for uploading job --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 65bd7aba4b6c..8f8f1707a4f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,6 @@ jobs: run: .github/workflows/build.sh - name: Prepare artifact for caching - shell: bash run: | mkdir github/ cp build/solc/solc github/solc-macos @@ -96,7 +95,6 @@ jobs: run: .github/workflows/build.sh - name: Prepare artifact for caching - shell: bash run: | mkdir github/ cp build/solc/solc github/solc-static-linux @@ -128,7 +126,6 @@ jobs: run: .github/workflows/build_ems.sh - name: Prepare artifact for caching - shell: bash run: | mkdir github/ cp upload/soljson.js github/soljson.js @@ -202,7 +199,7 @@ jobs: tar --create --file ../solc-bin-binaries.tar * - name: Upload to S3 - shell: bash -el {0} + shell: zsh -el {0} env: S3_BUCKET_PROD: ${{ secrets.S3_BUCKET_PROD }} S3_BUCKET_TEST: ${{ secrets.S3_BUCKET_TEST }} From 927d654abc2c1e9f1a3862e1698ea3c12ba84167 Mon Sep 17 00:00:00 2001 From: Asuka Date: Thu, 13 Nov 2025 16:04:47 +0800 Subject: [PATCH 14/14] Use solc-macos to get full version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f8f1707a4f0..6ff8baa72b22 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,7 +184,7 @@ jobs: - name: Rename binaries to solc-bin naming convention run: | full_version=$( - github/solc-static-linux --version | + github/solc-macos --version | sed -En 's/^Version: ([0-9.]+.*\+commit\.[0-9a-f]+(\.mod)?).*$/\1/p' )