Skip to content

Auto-shallow fallback in wonk_show on budget overflow, bump to 4.9.0 #24

Auto-shallow fallback in wonk_show on budget overflow, bump to 4.9.0

Auto-shallow fallback in wonk_show on budget overflow, bump to 4.9.0 #24

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
BINARY_NAME: wonk
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
runner: macos-latest
use_cross: false
strip: true
ext: ""
- target: x86_64-apple-darwin
runner: macos-latest
use_cross: false
strip: true
ext: ""
- target: x86_64-unknown-linux-musl
runner: ubuntu-latest
use_cross: true
strip: false
ext: ""
- target: aarch64-unknown-linux-musl
runner: ubuntu-latest
use_cross: true
strip: false
ext: ""
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build with cross
if: matrix.use_cross
run: cross build --release --target ${{ matrix.target }}
- name: Build with cargo
if: "!matrix.use_cross"
run: cargo build --release --target ${{ matrix.target }}
- name: Strip binary (unix)
if: matrix.strip
run: |
strip "target/${{ matrix.target }}/release/${BINARY_NAME}${{ matrix.ext }}"
- name: Rename binary
shell: bash
run: |
version="${GITHUB_REF_NAME#v}"
src="target/${{ matrix.target }}/release/${BINARY_NAME}${{ matrix.ext }}"
dst="${BINARY_NAME}-${version}-${{ matrix.target }}${{ matrix.ext }}"
cp "$src" "$dst"
echo "ARTIFACT_PATH=$dst" >> "$GITHUB_ENV"
- name: Assert binary size under 35 MB
shell: bash
run: |
size=$(wc -c < "${{ env.ARTIFACT_PATH }}" | tr -d ' ')
max=$((35 * 1024 * 1024))
echo "Binary size: ${size} bytes"
if [ "$size" -gt "$max" ]; then
echo "ERROR: Binary size ${size} exceeds 35 MB limit (${max} bytes)"
exit 1
fi
echo "OK: Binary size ${size} is under 35 MB limit"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_PATH }}
path: ${{ env.ARTIFACT_PATH }}
retention-days: 7
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Collect binaries
run: |
mkdir -p release
find artifacts -type f -exec cp {} release/ \;
ls -lh release/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}