From 8bf0d5ea982ab3f9c6e59a5f116130b90f82968f Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 18:53:58 +0100 Subject: [PATCH 01/12] trim tag name to obtain version --- .github/workflows/release-please.yaml | 9 +- .github/workflows/release.yml | 321 +++++++++++++------------- 2 files changed, 169 insertions(+), 161 deletions(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index a5dccaf60e..78f6765ec7 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -10,6 +10,9 @@ permissions: # Run the workflow on push to the main branch and manually on: + pull_request: + branches: + - main push: branches: - main @@ -33,10 +36,10 @@ jobs: # Trigger workflow to generate artifacts release: - if: ${{ needs.release-please.outputs.releases_created == 'true' }} + # if: ${{ needs.release-please.outputs.releases_created == 'true' }} needs: release-please uses: ./.github/workflows/release.yml with: - tag: ${{ needs.release-please.outputs.tag_name }} - version: ${{ (needs.release-please.outputs.tag_name && format('{0}.{1}.{2}', needs.release-please.outputs.major, needs.release-please.outputs.minor, needs.release-please.outputs.patch)) || ''}} + tag: "foundry-zksync-v0.0.6" + # tag: ${{ needs.release-please.outputs.tag_name }} secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf3da5be67..349775ee87 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,11 +12,6 @@ on: type: string required: true default: "" - version: - description: "Version for the release." - type: string - required: true - default: "" env: CARGO_TERM_COLOR: always @@ -43,17 +38,27 @@ jobs: id: release_info run: | echo "nightly: $IS_NIGHTLY" - if [ $IS_NIGHTLY == "true" ]; then - TAG="${{ inputs.tag || format('nightly-{0}', github.sha) }}" - VERSION="${{ inputs.version || 'nightly' }}" + if [ $IS_NIGHTLY == "true" ]; then + if [ "${{inputs.tag}}" ]; then + TAG="${{ inputs.tag }}" + VERSION="${${{inputs.tag}}#foundry-zksync-v}" + else + TAG="${{ format('nightly-{0}', github.sha) }}" + VERSION=nightly + fi echo "tag_name=${TAG}" >> $GITHUB_OUTPUT echo "version_name=${VERSION}" >> $GITHUB_OUTPUT echo "release_name=foundry-zksync Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT echo "prerelease=true" >> $GITHUB_OUTPUT else - TAG="${{ inputs.tag || format('stable-{0}', github.sha) }}" - VERSION="${{ inputs.version || 'stable' }}" + if [ "${{inputs.tag}}" ]; then + TAG="${{ inputs.tag }}" + VERSION="${${{inputs.tag}}#foundry-zksync-v}" + else + TAG="${{ format('stable-{0}', github.sha) }}" + VERSION=stable + fi echo "tag_name=${TAG}" >> $GITHUB_OUTPUT echo "version_name=v${VERSION}" >> $GITHUB_OUTPUT @@ -93,168 +98,168 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - release: - permissions: - id-token: write - contents: write - attestations: write - name: ${{ matrix.target }} (${{ matrix.runner }}) - runs-on: ${{ matrix.runner }} - timeout-minutes: 240 - needs: prepare - strategy: - fail-fast: false - matrix: - include: - # `runner`: GHA runner label - # `target`: Rust build target triple - # `platform` and `arch`: Used in tarball names - # `svm`: target platform to use for the Solc binary: https://github.com/roynalnaruto/svm-rs/blob/84cbe0ac705becabdc13168bae28a45ad2299749/svm-builds/build.rs#L4-L24 - - runner: ubuntu-24.04-github-hosted-16core - target: x86_64-unknown-linux-gnu - svm_target_platform: linux-amd64 - platform: linux - arch: amd64 - - runner: ubuntu-24.04-github-hosted-16core - target: aarch64-unknown-linux-gnu - svm_target_platform: linux-aarch64 - platform: linux - arch: arm64 - - runner: macos-latest - target: x86_64-apple-darwin - svm_target_platform: macosx-amd64 - platform: darwin - arch: amd64 - - runner: macos-latest - target: aarch64-apple-darwin - svm_target_platform: macosx-aarch64 - platform: darwin - arch: arm64 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.tag || '' }} + # release: + # permissions: + # id-token: write + # contents: write + # attestations: write + # name: ${{ matrix.target }} (${{ matrix.runner }}) + # runs-on: ${{ matrix.runner }} + # timeout-minutes: 240 + # needs: prepare + # strategy: + # fail-fast: false + # matrix: + # include: + # # `runner`: GHA runner label + # # `target`: Rust build target triple + # # `platform` and `arch`: Used in tarball names + # # `svm`: target platform to use for the Solc binary: https://github.com/roynalnaruto/svm-rs/blob/84cbe0ac705becabdc13168bae28a45ad2299749/svm-builds/build.rs#L4-L24 + # - runner: ubuntu-24.04-github-hosted-16core + # target: x86_64-unknown-linux-gnu + # svm_target_platform: linux-amd64 + # platform: linux + # arch: amd64 + # - runner: ubuntu-24.04-github-hosted-16core + # target: aarch64-unknown-linux-gnu + # svm_target_platform: linux-aarch64 + # platform: linux + # arch: arm64 + # - runner: macos-latest + # target: x86_64-apple-darwin + # svm_target_platform: macosx-amd64 + # platform: darwin + # arch: amd64 + # - runner: macos-latest + # target: aarch64-apple-darwin + # svm_target_platform: macosx-aarch64 + # platform: darwin + # arch: arm64 + # steps: + # - uses: actions/checkout@v4 + # with: + # ref: ${{ inputs.tag || '' }} - - uses: Swatinem/rust-cache@v2 - with: - key: ${{ matrix.target }} - cache-on-failure: true + # - uses: Swatinem/rust-cache@v2 + # with: + # key: ${{ matrix.target }} + # cache-on-failure: true - - name: Install required Rust targets - run: rustup target add ${{ matrix.target }} + # - name: Install required Rust targets + # run: rustup target add ${{ matrix.target }} - - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.target }} + # - uses: dtolnay/rust-toolchain@stable + # with: + # targets: ${{ matrix.target }} - - name: Install cross v0.2.5 from source - run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5 + # - name: Install cross v0.2.5 from source + # run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5 - # We diverge from upstream and build with cross as we're building static binaries - - name: Build binaries - env: - SVM_TARGET_PLATFORM: ${{ matrix.svm_target_platform }} - shell: bash - run: | - set -eo pipefail - target="${{ matrix.target }}" - flags=() + # # We diverge from upstream and build with cross as we're building static binaries + # - name: Build binaries + # env: + # SVM_TARGET_PLATFORM: ${{ matrix.svm_target_platform }} + # shell: bash + # run: | + # set -eo pipefail + # target="${{ matrix.target }}" + # flags=() - # Disable asm-keccak, see https://github.com/alloy-rs/core/issues/711 - # # Remove jemalloc, only keep `asm-keccak` if applicable - # if [[ "$target" != *msvc* && "$target" != "aarch64-unknown-linux-gnu" ]]; then - # flags+=(--features asm-keccak) - # fi + # # Disable asm-keccak, see https://github.com/alloy-rs/core/issues/711 + # # # Remove jemalloc, only keep `asm-keccak` if applicable + # # if [[ "$target" != *msvc* && "$target" != "aarch64-unknown-linux-gnu" ]]; then + # # flags+=(--features asm-keccak) + # # fi - RUSTFLAGS='-C target-feature=+crt-static' OPENSSL_STATIC=1 cross build --release --bin forge --bin cast --target "$target" "${flags[@]}" + # RUSTFLAGS='-C target-feature=+crt-static' OPENSSL_STATIC=1 cross build --release --bin forge --bin cast --target "$target" "${flags[@]}" - bins=(cast forge) - for name in "${bins[@]}"; do - bin=./target/$target/release/$name - file "$bin" || true - ldd "$bin" || true - $bin --version || true - echo "${name}_bin_path=${bin}" >> $GITHUB_ENV - done + # bins=(cast forge) + # for name in "${bins[@]}"; do + # bin=./target/$target/release/$name + # file "$bin" || true + # ldd "$bin" || true + # $bin --version || true + # echo "${name}_bin_path=${bin}" >> $GITHUB_ENV + # done - - name: Archive binaries - id: artifacts - env: - PLATFORM_NAME: ${{ matrix.platform }} - TARGET: ${{ matrix.target }} - ARCH: ${{ matrix.arch }} - VERSION_NAME: ${{ needs.prepare.outputs.version_name }} - shell: bash - run: | - if [ "$PLATFORM_NAME" == "linux" ]; then - tar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast - echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT - elif [ "$PLATFORM_NAME" == "darwin" ]; then - # We need to use gtar here otherwise the archive is corrupt. - # See: https://github.com/actions/virtual-environments/issues/2619 - gtar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast - echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT - fi + # - name: Archive binaries + # id: artifacts + # env: + # PLATFORM_NAME: ${{ matrix.platform }} + # TARGET: ${{ matrix.target }} + # ARCH: ${{ matrix.arch }} + # VERSION_NAME: ${{ needs.prepare.outputs.version_name }} + # shell: bash + # run: | + # if [ "$PLATFORM_NAME" == "linux" ]; then + # tar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast + # echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT + # elif [ "$PLATFORM_NAME" == "darwin" ]; then + # # We need to use gtar here otherwise the archive is corrupt. + # # See: https://github.com/actions/virtual-environments/issues/2619 + # gtar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast + # echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT + # fi - - name: Build man page - id: man - if: matrix.target == 'x86_64-unknown-linux-gnu' - env: - PLATFORM_NAME: ${{ matrix.platform }} - TARGET: ${{ matrix.target }} - VERSION_NAME: ${{ needs.prepare.outputs.version_name }} - shell: bash - run: | - sudo apt-get -y install help2man - help2man -N ./target/${TARGET}/release/forge > forge.1 - help2man -N ./target/${TARGET}/release/cast > cast.1 - gzip forge.1 - gzip cast.1 - tar -czvf "foundry_man_${VERSION_NAME}.tar.gz" forge.1.gz cast.1.gz - echo "foundry_man=foundry_man_${VERSION_NAME}.tar.gz" >> $GITHUB_OUTPUT + # - name: Build man page + # id: man + # if: matrix.target == 'x86_64-unknown-linux-gnu' + # env: + # PLATFORM_NAME: ${{ matrix.platform }} + # TARGET: ${{ matrix.target }} + # VERSION_NAME: ${{ needs.prepare.outputs.version_name }} + # shell: bash + # run: | + # sudo apt-get -y install help2man + # help2man -N ./target/${TARGET}/release/forge > forge.1 + # help2man -N ./target/${TARGET}/release/cast > cast.1 + # gzip forge.1 + # gzip cast.1 + # tar -czvf "foundry_man_${VERSION_NAME}.tar.gz" forge.1.gz cast.1.gz + # echo "foundry_man=foundry_man_${VERSION_NAME}.tar.gz" >> $GITHUB_OUTPUT - # Creates the release for this specific version - - name: Create release - if: ${{ inputs.tag == '' }} - uses: softprops/action-gh-release@v2 - with: - name: ${{ needs.prepare.outputs.release_name }} - tag_name: ${{ needs.prepare.outputs.tag_name }} - prerelease: ${{ needs.prepare.outputs.prerelease }} - body: ${{ needs.prepare.outputs.changelog }} - files: | - ${{ steps.artifacts.outputs.file_name }} - ${{ steps.man.outputs.foundry_man }} + # # Creates the release for this specific version + # - name: Create release + # if: ${{ inputs.tag == '' }} + # uses: softprops/action-gh-release@v2 + # with: + # name: ${{ needs.prepare.outputs.release_name }} + # tag_name: ${{ needs.prepare.outputs.tag_name }} + # prerelease: ${{ needs.prepare.outputs.prerelease }} + # body: ${{ needs.prepare.outputs.changelog }} + # files: | + # ${{ steps.artifacts.outputs.file_name }} + # ${{ steps.man.outputs.foundry_man }} - - name: Update release-please release artifacts - if: ${{ inputs.tag != '' }} - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ inputs.tag }} - files: | - ${{ steps.artifacts.outputs.file_name }} - ${{ steps.man.outputs.foundry_man }} + # - name: Update release-please release artifacts + # if: ${{ inputs.tag != '' }} + # uses: softprops/action-gh-release@v2 + # with: + # tag_name: ${{ inputs.tag }} + # files: | + # ${{ steps.artifacts.outputs.file_name }} + # ${{ steps.man.outputs.foundry_man }} - - name: Binaries attestation - uses: actions/attest-build-provenance@v2 - with: - subject-path: | - ${{ env.cast_bin_path }} - ${{ env.forge_bin_path }} + # - name: Binaries attestation + # uses: actions/attest-build-provenance@v2 + # with: + # subject-path: | + # ${{ env.cast_bin_path }} + # ${{ env.forge_bin_path }} - # If this is a nightly release, it also updates the release - # tagged `nightly` for compatibility with `foundryup` - - name: Update nightly release - if: ${{ env.IS_NIGHTLY == 'true' }} - uses: softprops/action-gh-release@v2 - with: - name: "Nightly foundry-zksync" - tag_name: "nightly" - prerelease: true - body: ${{ needs.prepare.outputs.changelog }} - files: | - ${{ steps.artifacts.outputs.file_name }} - ${{ steps.man.outputs.foundry_man }} + # # If this is a nightly release, it also updates the release + # # tagged `nightly` for compatibility with `foundryup` + # - name: Update nightly release + # if: ${{ env.IS_NIGHTLY == 'true' }} + # uses: softprops/action-gh-release@v2 + # with: + # name: "Nightly foundry-zksync" + # tag_name: "nightly" + # prerelease: true + # body: ${{ needs.prepare.outputs.changelog }} + # files: | + # ${{ steps.artifacts.outputs.file_name }} + # ${{ steps.man.outputs.foundry_man }} retry-on-failure: if: failure() && fromJSON(github.run_attempt) < 3 From 58b7c4649bd8392c59854fe16da74c469097c7dd Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 18:58:44 +0100 Subject: [PATCH 02/12] comment steps --- .github/workflows/release.yml | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 349775ee87..dd5b08afa1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -261,37 +261,37 @@ jobs: # ${{ steps.artifacts.outputs.file_name }} # ${{ steps.man.outputs.foundry_man }} - retry-on-failure: - if: failure() && fromJSON(github.run_attempt) < 3 - needs: [release] - runs-on: ubuntu-latest - steps: - - env: - GH_REPO: ${{ github.repository }} - GH_TOKEN: ${{ github.token }} - run: gh workflow run retry.yml -F run_id=${{ github.run_id }} + # retry-on-failure: + # if: failure() && fromJSON(github.run_attempt) < 3 + # needs: [release] + # runs-on: ubuntu-latest + # steps: + # - env: + # GH_REPO: ${{ github.repository }} + # GH_TOKEN: ${{ github.token }} + # run: gh workflow run retry.yml -F run_id=${{ github.run_id }} - cleanup: - name: Release cleanup - runs-on: ubuntu-latest - timeout-minutes: 30 - needs: release - if: always() - steps: - - uses: actions/checkout@v4 + # cleanup: + # name: Release cleanup + # runs-on: ubuntu-latest + # timeout-minutes: 30 + # needs: release + # if: always() + # steps: + # - uses: actions/checkout@v4 - # Moves the `nightly` tag to `HEAD` - - name: Move nightly tag - if: ${{ env.IS_NIGHTLY == 'true' }} - uses: actions/github-script@v7 - with: - script: | - const moveTag = require('./.github/scripts/move-tag.js') - await moveTag({ github, context }, 'nightly') + # # Moves the `nightly` tag to `HEAD` + # - name: Move nightly tag + # if: ${{ env.IS_NIGHTLY == 'true' }} + # uses: actions/github-script@v7 + # with: + # script: | + # const moveTag = require('./.github/scripts/move-tag.js') + # await moveTag({ github, context }, 'nightly') - - name: Delete old nightlies - uses: actions/github-script@v7 - with: - script: | - const prunePrereleases = require('./.github/scripts/prune-prereleases.js') - await prunePrereleases({github, context}) + # - name: Delete old nightlies + # uses: actions/github-script@v7 + # with: + # script: | + # const prunePrereleases = require('./.github/scripts/prune-prereleases.js') + # await prunePrereleases({github, context}) From 634921a12a46bd7e5b0e93ec7086ac885750929a Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:00:09 +0100 Subject: [PATCH 03/12] test run --- .github/workflows/release-please.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 78f6765ec7..ffe3d15a92 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -40,6 +40,6 @@ jobs: needs: release-please uses: ./.github/workflows/release.yml with: - tag: "foundry-zksync-v0.0.6" + tag: "foundry-zksync-v0.0.5" # tag: ${{ needs.release-please.outputs.tag_name }} secrets: inherit From 318d46c1413a2085fd044360881032c89bf48c07 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:01:46 +0100 Subject: [PATCH 04/12] test run --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd5b08afa1..f665af26a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: if [ $IS_NIGHTLY == "true" ]; then if [ "${{inputs.tag}}" ]; then TAG="${{ inputs.tag }}" - VERSION="${${{inputs.tag}}#foundry-zksync-v}" + VERSION="${TAG#foundry-zksync-v}" else TAG="${{ format('nightly-{0}', github.sha) }}" VERSION=nightly @@ -54,7 +54,7 @@ jobs: else if [ "${{inputs.tag}}" ]; then TAG="${{ inputs.tag }}" - VERSION="${${{inputs.tag}}#foundry-zksync-v}" + VERSION="${TAG#foundry-zksync-v}" else TAG="${{ format('stable-{0}', github.sha) }}" VERSION=stable From 43099491709b948d44c4c28fd9a12859ec749cf6 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:03:49 +0100 Subject: [PATCH 05/12] final test run --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f665af26a3..7a56ab55dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: if [ $IS_NIGHTLY == "true" ]; then if [ "${{inputs.tag}}" ]; then TAG="${{ inputs.tag }}" - VERSION="${TAG#foundry-zksync-v}" + VERSION="${TAG#foundry-zksync-}" else TAG="${{ format('nightly-{0}', github.sha) }}" VERSION=nightly @@ -54,14 +54,14 @@ jobs: else if [ "${{inputs.tag}}" ]; then TAG="${{ inputs.tag }}" - VERSION="${TAG#foundry-zksync-v}" + VERSION="${TAG#foundry-zksync-}" else TAG="${{ format('stable-{0}', github.sha) }}" VERSION=stable fi echo "tag_name=${TAG}" >> $GITHUB_OUTPUT - echo "version_name=v${VERSION}" >> $GITHUB_OUTPUT + echo "version_name=${VERSION}" >> $GITHUB_OUTPUT echo "release_name=foundry-zksync v${VERSION}" >> $GITHUB_OUTPUT echo "prerelease=false" >> $GITHUB_OUTPUT fi From 2c68c87b76a06d9482f4d0ddebf1df90407d239a Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:05:44 +0100 Subject: [PATCH 06/12] final test run --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a56ab55dd..f665af26a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: if [ $IS_NIGHTLY == "true" ]; then if [ "${{inputs.tag}}" ]; then TAG="${{ inputs.tag }}" - VERSION="${TAG#foundry-zksync-}" + VERSION="${TAG#foundry-zksync-v}" else TAG="${{ format('nightly-{0}', github.sha) }}" VERSION=nightly @@ -54,14 +54,14 @@ jobs: else if [ "${{inputs.tag}}" ]; then TAG="${{ inputs.tag }}" - VERSION="${TAG#foundry-zksync-}" + VERSION="${TAG#foundry-zksync-v}" else TAG="${{ format('stable-{0}', github.sha) }}" VERSION=stable fi echo "tag_name=${TAG}" >> $GITHUB_OUTPUT - echo "version_name=${VERSION}" >> $GITHUB_OUTPUT + echo "version_name=v${VERSION}" >> $GITHUB_OUTPUT echo "release_name=foundry-zksync v${VERSION}" >> $GITHUB_OUTPUT echo "prerelease=false" >> $GITHUB_OUTPUT fi From 2f19a3e218b297b4143ceed6e4656dcdccd93e4d Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:08:00 +0100 Subject: [PATCH 07/12] revert test code --- .github/workflows/release-please.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index ffe3d15a92..c496f4ba6b 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -10,9 +10,6 @@ permissions: # Run the workflow on push to the main branch and manually on: - pull_request: - branches: - - main push: branches: - main From 844a579e6ce048d04797919897efcda03eb54033 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:08:12 +0100 Subject: [PATCH 08/12] revert test code --- .github/workflows/release-please.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index c496f4ba6b..b5f582dd23 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -37,6 +37,5 @@ jobs: needs: release-please uses: ./.github/workflows/release.yml with: - tag: "foundry-zksync-v0.0.5" - # tag: ${{ needs.release-please.outputs.tag_name }} + tag: ${{ needs.release-please.outputs.tag_name }} secrets: inherit From 8d45e89a1ebf6c8e3e21e70527a91143cba6a853 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:08:27 +0100 Subject: [PATCH 09/12] revert test code --- .github/workflows/release-please.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index b5f582dd23..4d740a84ea 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -33,7 +33,7 @@ jobs: # Trigger workflow to generate artifacts release: - # if: ${{ needs.release-please.outputs.releases_created == 'true' }} + if: ${{ needs.release-please.outputs.releases_created == 'true' }} needs: release-please uses: ./.github/workflows/release.yml with: From 0c7746e9839fee2c3bb9647c137bc2d8477b3fb1 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:08:58 +0100 Subject: [PATCH 10/12] revert test code --- .github/workflows/release.yml | 358 +++++++++++++++++----------------- 1 file changed, 179 insertions(+), 179 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f665af26a3..2f9c0e001f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -98,200 +98,200 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # release: - # permissions: - # id-token: write - # contents: write - # attestations: write - # name: ${{ matrix.target }} (${{ matrix.runner }}) - # runs-on: ${{ matrix.runner }} - # timeout-minutes: 240 - # needs: prepare - # strategy: - # fail-fast: false - # matrix: - # include: - # # `runner`: GHA runner label - # # `target`: Rust build target triple - # # `platform` and `arch`: Used in tarball names - # # `svm`: target platform to use for the Solc binary: https://github.com/roynalnaruto/svm-rs/blob/84cbe0ac705becabdc13168bae28a45ad2299749/svm-builds/build.rs#L4-L24 - # - runner: ubuntu-24.04-github-hosted-16core - # target: x86_64-unknown-linux-gnu - # svm_target_platform: linux-amd64 - # platform: linux - # arch: amd64 - # - runner: ubuntu-24.04-github-hosted-16core - # target: aarch64-unknown-linux-gnu - # svm_target_platform: linux-aarch64 - # platform: linux - # arch: arm64 - # - runner: macos-latest - # target: x86_64-apple-darwin - # svm_target_platform: macosx-amd64 - # platform: darwin - # arch: amd64 - # - runner: macos-latest - # target: aarch64-apple-darwin - # svm_target_platform: macosx-aarch64 - # platform: darwin - # arch: arm64 - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: ${{ inputs.tag || '' }} + release: + permissions: + id-token: write + contents: write + attestations: write + name: ${{ matrix.target }} (${{ matrix.runner }}) + runs-on: ${{ matrix.runner }} + timeout-minutes: 240 + needs: prepare + strategy: + fail-fast: false + matrix: + include: + # `runner`: GHA runner label + # `target`: Rust build target triple + # `platform` and `arch`: Used in tarball names + # `svm`: target platform to use for the Solc binary: https://github.com/roynalnaruto/svm-rs/blob/84cbe0ac705becabdc13168bae28a45ad2299749/svm-builds/build.rs#L4-L24 + - runner: ubuntu-24.04-github-hosted-16core + target: x86_64-unknown-linux-gnu + svm_target_platform: linux-amd64 + platform: linux + arch: amd64 + - runner: ubuntu-24.04-github-hosted-16core + target: aarch64-unknown-linux-gnu + svm_target_platform: linux-aarch64 + platform: linux + arch: arm64 + - runner: macos-latest + target: x86_64-apple-darwin + svm_target_platform: macosx-amd64 + platform: darwin + arch: amd64 + - runner: macos-latest + target: aarch64-apple-darwin + svm_target_platform: macosx-aarch64 + platform: darwin + arch: arm64 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || '' }} - # - uses: Swatinem/rust-cache@v2 - # with: - # key: ${{ matrix.target }} - # cache-on-failure: true + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + cache-on-failure: true - # - name: Install required Rust targets - # run: rustup target add ${{ matrix.target }} + - name: Install required Rust targets + run: rustup target add ${{ matrix.target }} - # - uses: dtolnay/rust-toolchain@stable - # with: - # targets: ${{ matrix.target }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} - # - name: Install cross v0.2.5 from source - # run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5 + - name: Install cross v0.2.5 from source + run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5 - # # We diverge from upstream and build with cross as we're building static binaries - # - name: Build binaries - # env: - # SVM_TARGET_PLATFORM: ${{ matrix.svm_target_platform }} - # shell: bash - # run: | - # set -eo pipefail - # target="${{ matrix.target }}" - # flags=() + # We diverge from upstream and build with cross as we're building static binaries + - name: Build binaries + env: + SVM_TARGET_PLATFORM: ${{ matrix.svm_target_platform }} + shell: bash + run: | + set -eo pipefail + target="${{ matrix.target }}" + flags=() - # # Disable asm-keccak, see https://github.com/alloy-rs/core/issues/711 - # # # Remove jemalloc, only keep `asm-keccak` if applicable - # # if [[ "$target" != *msvc* && "$target" != "aarch64-unknown-linux-gnu" ]]; then - # # flags+=(--features asm-keccak) - # # fi + # Disable asm-keccak, see https://github.com/alloy-rs/core/issues/711 + # # Remove jemalloc, only keep `asm-keccak` if applicable + # if [[ "$target" != *msvc* && "$target" != "aarch64-unknown-linux-gnu" ]]; then + # flags+=(--features asm-keccak) + # fi - # RUSTFLAGS='-C target-feature=+crt-static' OPENSSL_STATIC=1 cross build --release --bin forge --bin cast --target "$target" "${flags[@]}" + RUSTFLAGS='-C target-feature=+crt-static' OPENSSL_STATIC=1 cross build --release --bin forge --bin cast --target "$target" "${flags[@]}" - # bins=(cast forge) - # for name in "${bins[@]}"; do - # bin=./target/$target/release/$name - # file "$bin" || true - # ldd "$bin" || true - # $bin --version || true - # echo "${name}_bin_path=${bin}" >> $GITHUB_ENV - # done + bins=(cast forge) + for name in "${bins[@]}"; do + bin=./target/$target/release/$name + file "$bin" || true + ldd "$bin" || true + $bin --version || true + echo "${name}_bin_path=${bin}" >> $GITHUB_ENV + done - # - name: Archive binaries - # id: artifacts - # env: - # PLATFORM_NAME: ${{ matrix.platform }} - # TARGET: ${{ matrix.target }} - # ARCH: ${{ matrix.arch }} - # VERSION_NAME: ${{ needs.prepare.outputs.version_name }} - # shell: bash - # run: | - # if [ "$PLATFORM_NAME" == "linux" ]; then - # tar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast - # echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT - # elif [ "$PLATFORM_NAME" == "darwin" ]; then - # # We need to use gtar here otherwise the archive is corrupt. - # # See: https://github.com/actions/virtual-environments/issues/2619 - # gtar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast - # echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT - # fi + - name: Archive binaries + id: artifacts + env: + PLATFORM_NAME: ${{ matrix.platform }} + TARGET: ${{ matrix.target }} + ARCH: ${{ matrix.arch }} + VERSION_NAME: ${{ needs.prepare.outputs.version_name }} + shell: bash + run: | + if [ "$PLATFORM_NAME" == "linux" ]; then + tar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast + echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT + elif [ "$PLATFORM_NAME" == "darwin" ]; then + # We need to use gtar here otherwise the archive is corrupt. + # See: https://github.com/actions/virtual-environments/issues/2619 + gtar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast + echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT + fi - # - name: Build man page - # id: man - # if: matrix.target == 'x86_64-unknown-linux-gnu' - # env: - # PLATFORM_NAME: ${{ matrix.platform }} - # TARGET: ${{ matrix.target }} - # VERSION_NAME: ${{ needs.prepare.outputs.version_name }} - # shell: bash - # run: | - # sudo apt-get -y install help2man - # help2man -N ./target/${TARGET}/release/forge > forge.1 - # help2man -N ./target/${TARGET}/release/cast > cast.1 - # gzip forge.1 - # gzip cast.1 - # tar -czvf "foundry_man_${VERSION_NAME}.tar.gz" forge.1.gz cast.1.gz - # echo "foundry_man=foundry_man_${VERSION_NAME}.tar.gz" >> $GITHUB_OUTPUT + - name: Build man page + id: man + if: matrix.target == 'x86_64-unknown-linux-gnu' + env: + PLATFORM_NAME: ${{ matrix.platform }} + TARGET: ${{ matrix.target }} + VERSION_NAME: ${{ needs.prepare.outputs.version_name }} + shell: bash + run: | + sudo apt-get -y install help2man + help2man -N ./target/${TARGET}/release/forge > forge.1 + help2man -N ./target/${TARGET}/release/cast > cast.1 + gzip forge.1 + gzip cast.1 + tar -czvf "foundry_man_${VERSION_NAME}.tar.gz" forge.1.gz cast.1.gz + echo "foundry_man=foundry_man_${VERSION_NAME}.tar.gz" >> $GITHUB_OUTPUT - # # Creates the release for this specific version - # - name: Create release - # if: ${{ inputs.tag == '' }} - # uses: softprops/action-gh-release@v2 - # with: - # name: ${{ needs.prepare.outputs.release_name }} - # tag_name: ${{ needs.prepare.outputs.tag_name }} - # prerelease: ${{ needs.prepare.outputs.prerelease }} - # body: ${{ needs.prepare.outputs.changelog }} - # files: | - # ${{ steps.artifacts.outputs.file_name }} - # ${{ steps.man.outputs.foundry_man }} + # Creates the release for this specific version + - name: Create release + if: ${{ inputs.tag == '' }} + uses: softprops/action-gh-release@v2 + with: + name: ${{ needs.prepare.outputs.release_name }} + tag_name: ${{ needs.prepare.outputs.tag_name }} + prerelease: ${{ needs.prepare.outputs.prerelease }} + body: ${{ needs.prepare.outputs.changelog }} + files: | + ${{ steps.artifacts.outputs.file_name }} + ${{ steps.man.outputs.foundry_man }} - # - name: Update release-please release artifacts - # if: ${{ inputs.tag != '' }} - # uses: softprops/action-gh-release@v2 - # with: - # tag_name: ${{ inputs.tag }} - # files: | - # ${{ steps.artifacts.outputs.file_name }} - # ${{ steps.man.outputs.foundry_man }} + - name: Update release-please release artifacts + if: ${{ inputs.tag != '' }} + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ inputs.tag }} + files: | + ${{ steps.artifacts.outputs.file_name }} + ${{ steps.man.outputs.foundry_man }} - # - name: Binaries attestation - # uses: actions/attest-build-provenance@v2 - # with: - # subject-path: | - # ${{ env.cast_bin_path }} - # ${{ env.forge_bin_path }} + - name: Binaries attestation + uses: actions/attest-build-provenance@v2 + with: + subject-path: | + ${{ env.cast_bin_path }} + ${{ env.forge_bin_path }} - # # If this is a nightly release, it also updates the release - # # tagged `nightly` for compatibility with `foundryup` - # - name: Update nightly release - # if: ${{ env.IS_NIGHTLY == 'true' }} - # uses: softprops/action-gh-release@v2 - # with: - # name: "Nightly foundry-zksync" - # tag_name: "nightly" - # prerelease: true - # body: ${{ needs.prepare.outputs.changelog }} - # files: | - # ${{ steps.artifacts.outputs.file_name }} - # ${{ steps.man.outputs.foundry_man }} + # If this is a nightly release, it also updates the release + # tagged `nightly` for compatibility with `foundryup` + - name: Update nightly release + if: ${{ env.IS_NIGHTLY == 'true' }} + uses: softprops/action-gh-release@v2 + with: + name: "Nightly foundry-zksync" + tag_name: "nightly" + prerelease: true + body: ${{ needs.prepare.outputs.changelog }} + files: | + ${{ steps.artifacts.outputs.file_name }} + ${{ steps.man.outputs.foundry_man }} - # retry-on-failure: - # if: failure() && fromJSON(github.run_attempt) < 3 - # needs: [release] - # runs-on: ubuntu-latest - # steps: - # - env: - # GH_REPO: ${{ github.repository }} - # GH_TOKEN: ${{ github.token }} - # run: gh workflow run retry.yml -F run_id=${{ github.run_id }} + retry-on-failure: + if: failure() && fromJSON(github.run_attempt) < 3 + needs: [release] + runs-on: ubuntu-latest + steps: + - env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ github.token }} + run: gh workflow run retry.yml -F run_id=${{ github.run_id }} - # cleanup: - # name: Release cleanup - # runs-on: ubuntu-latest - # timeout-minutes: 30 - # needs: release - # if: always() - # steps: - # - uses: actions/checkout@v4 + cleanup: + name: Release cleanup + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: release + if: always() + steps: + - uses: actions/checkout@v4 - # # Moves the `nightly` tag to `HEAD` - # - name: Move nightly tag - # if: ${{ env.IS_NIGHTLY == 'true' }} - # uses: actions/github-script@v7 - # with: - # script: | - # const moveTag = require('./.github/scripts/move-tag.js') - # await moveTag({ github, context }, 'nightly') + # Moves the `nightly` tag to `HEAD` + - name: Move nightly tag + if: ${{ env.IS_NIGHTLY == 'true' }} + uses: actions/github-script@v7 + with: + script: | + const moveTag = require('./.github/scripts/move-tag.js') + await moveTag({ github, context }, 'nightly') - # - name: Delete old nightlies - # uses: actions/github-script@v7 - # with: - # script: | - # const prunePrereleases = require('./.github/scripts/prune-prereleases.js') - # await prunePrereleases({github, context}) + - name: Delete old nightlies + uses: actions/github-script@v7 + with: + script: | + const prunePrereleases = require('./.github/scripts/prune-prereleases.js') + await prunePrereleases({github, context}) From b332d4b739a77bf8a767f793239fcfc62ed3457c Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:10:59 +0100 Subject: [PATCH 11/12] fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2f9c0e001f..d71983b530 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: fi echo "tag_name=${TAG}" >> $GITHUB_OUTPUT - echo "version_name=${VERSION}" >> $GITHUB_OUTPUT + echo "version_name=v${VERSION}" >> $GITHUB_OUTPUT echo "release_name=foundry-zksync Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT echo "prerelease=true" >> $GITHUB_OUTPUT else From 6833de0cd5eaea326b95e92e5c7819d0886d27b0 Mon Sep 17 00:00:00 2001 From: Nisheeth Barthwal Date: Fri, 31 Jan 2025 19:12:49 +0100 Subject: [PATCH 12/12] include "v" in semantic versions --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d71983b530..43963c1da0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,28 +41,28 @@ jobs: if [ $IS_NIGHTLY == "true" ]; then if [ "${{inputs.tag}}" ]; then TAG="${{ inputs.tag }}" - VERSION="${TAG#foundry-zksync-v}" + VERSION="${TAG#foundry-zksync-}" else TAG="${{ format('nightly-{0}', github.sha) }}" VERSION=nightly fi echo "tag_name=${TAG}" >> $GITHUB_OUTPUT - echo "version_name=v${VERSION}" >> $GITHUB_OUTPUT + echo "version_name=${VERSION}" >> $GITHUB_OUTPUT echo "release_name=foundry-zksync Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT echo "prerelease=true" >> $GITHUB_OUTPUT else if [ "${{inputs.tag}}" ]; then TAG="${{ inputs.tag }}" - VERSION="${TAG#foundry-zksync-v}" + VERSION="${TAG#foundry-zksync-}" else TAG="${{ format('stable-{0}', github.sha) }}" VERSION=stable fi echo "tag_name=${TAG}" >> $GITHUB_OUTPUT - echo "version_name=v${VERSION}" >> $GITHUB_OUTPUT - echo "release_name=foundry-zksync v${VERSION}" >> $GITHUB_OUTPUT + echo "version_name=${VERSION}" >> $GITHUB_OUTPUT + echo "release_name=foundry-zksync ${VERSION}" >> $GITHUB_OUTPUT echo "prerelease=false" >> $GITHUB_OUTPUT fi