Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbaliasnikov committed Jan 17, 2025
1 parent 18e0352 commit da93b4a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.3"
".": "0.2.4"
}
121 changes: 60 additions & 61 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ on:
inputs:
tag:
type: string
description: 'The tag to use for the Docker image'
description: 'The tag to use for the Docker image.'
required: true
workflow_dispatch:
inputs:
prerelease_name:
description: "Suffix to use for manual pre-release."
required: false
type: string
default: ""
pull_request:


jobs:
Expand All @@ -30,93 +38,84 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
ref: ${{ inputs.tag || '' }}

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
rustflags: ""

- name: Install target
run: rustup target add ${{ matrix.arch }}

- name: Run cargo clean
run: cargo clean

# ==============================
# Builds
# ==============================

- name: Install cross v0.2.4 from source
env:
RUSTFLAGS: ""
run: |
cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.4
- name: Install cross v0.2.5 from source
run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.5

- name: Build anvil-zksync for ${{ matrix.arch }}
run: |
if [[ "${{ matrix.arch }}" == *"linux"* ]]; then
make build-static-${{ matrix.arch }}
else
make build-${{ matrix.arch }}
fi
[[ "${{ matrix.arch }}" == *"linux"* ]] && make build-static-${{ matrix.arch }} || make build-${{ matrix.arch }}
- name: Rename and move binary
- name: Pack anvil-zksync
run: |
mkdir artifacts
strip target/${{ matrix.arch }}/release/anvil-zksync
mv target/${{ matrix.arch }}/release/anvil-zksync ./artifacts
tar -czf anvil-zksync-${{ inputs.tag || 'v0.0.0' }}-${{ matrix.arch }}.tar.gz \
./target/${{ matrix.arch }}/release/anvil-zksync
- name: Create artifacts
run: |
cd artifacts
tar -czf anvil-zksync-${{ inputs.tag }}-${{ matrix.arch }}.tar.gz anvil-zksync*
mv *tar.gz* ..
# =======================================================================
# Upload artifacts
# This is required to share artifacts between different jobs
# =======================================================================
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: anvil-zksync-${{ matrix.arch }}
path: anvil-zksync-${{ inputs.tag }}-${{ matrix.arch }}.tar.gz

- name: Binaries attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: ./artifacts/anvil-zksync

draft-release:
name: draft release
path: |
anvil-zksync-${{ inputs.tag || 'v0.0.0' }}-${{ matrix.arch }}.tar.gz
./target/${{ matrix.arch }}/release/anvil-zksync
upload-binaries:
name: Upload binaries
permissions:
contents: write
pull-requests: write
id-token: write
attestations: write
needs: build
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.extract-version.outputs.VERSION }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
ref: ${{ inputs.tag || '' }}

- name: Define release name
id: release_tag
shell: 'bash -ex {0}'
run: |
[ ! -z "${{ inputs.tag }}" ] && TAG="${{ inputs.tag }}" \
|| TAG="$(git rev-parse --short HEAD)"
echo "tag=${TAG}" >> "${GITHUB_OUTPUT}"
# ==============================
# Download artifacts
# ==============================
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: "anvil-zksync-*"
merge-multiple: 'false'

# - name: Create release draft
# env:
# GITHUB_USER: ${{ github.repository_owner }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# assets=()
# for asset in ./anvil-zksync-*.tar.gz*; do
# assets+=("$asset/$asset")
# done
# tag_name="${{ env.VERSION }}"
# gh release create "$tag_name" "${assets[@]}" --draft -F "-" -t "Release: $tag_name"
path: artifacts

- name: Binaries attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: 'artifacts/**/anvil-zksync'

- name: Update release-please release artifacts
if: ${{ inputs.tag != '' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag }}
files: 'artifacts/**/anvil-zksync*.tar.gz'

- name: Create release
if: ${{ inputs.tag == '' }}
uses: softprops/action-gh-release@v2
with:
name: 'anvil-zksync ${{ inputs.prerelease_name}} ${{ steps.release_tag.outputs.tag }}'
tag_name: ${{ steps.release_tag.outputs.tag }}
prerelease: true
files: 'artifacts/**/anvil-zksync*.tar.gz'
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ resolver = "2"
[profile.dev]
debug = 0

[profile.release]
strip = "debuginfo" # Automatically strip symbols from the binary.
lto = "thin" # Enable link-time optimization.

[workspace.package]
version = "0.2.4" # x-release-please-version
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN cargo chef prepare --recipe-path recipe.json

FROM chef AS builder
COPY --from=planner /anvil-zksync/recipe.json recipe.json
# Build dependencies - this is the caching Docker layer!
# Build dependencies - this is the caching Docker layer
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
COPY . .
Expand Down

0 comments on commit da93b4a

Please sign in to comment.