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 540c534
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 46 deletions.
67 changes: 22 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
type: string
description: 'The tag to use for the Docker image'
required: true
pull_request:


jobs:
Expand All @@ -30,7 +31,7 @@ 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
Expand All @@ -40,74 +41,50 @@ jobs:
- 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
run: cargo install cross --git https://github.com/cross-rs/cross --tag v0.2.4

- 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
path: anvil-zksync-${{ inputs.tag || 'v0.0.0' }}-${{ matrix.arch }}.tar.gz

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

draft-release:
name: draft release
upload-binaries:
name: Upload binaries
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 || '' }}

# ==============================
# Download artifacts
# ==============================
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: "anvil-zksync-*"
merge-multiple: 'false'
path: artifacts

- name: Unpack artifacts
shell: 'bash -ex {0}'
run: |
find ./artifacts
# - name: Binaries attestation
# uses: actions/attest-build-provenance@v2
# with:
# subject-path: ./artifacts/anvil-zksync

# - name: Create release draft
# env:
Expand Down
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 = true # Automatically strip symbols from the binary.
lto = true # 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 540c534

Please sign in to comment.