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.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: | 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-*)