rename artifacts and avoid conflicts #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Binary High TPS Bench | |
on: | |
workflow_dispatch: | |
push: | |
env: | |
GIT_BRANCH: ${{ github.head_ref || github.ref_name }} | |
GIT_REPO_OWNER: ${{ github.repository_owner }} | |
GIT_REPO: ${{ github.repository }} | |
GIT_REPO_NAME: ${{ github.event.repository.name }} | |
AWS_ROLE_ARN: arn:aws:iam::024848458133:role/github_oidc_FuelLabs_fuel-core | |
AWS_ECR_ORG: fuellabs | |
CARGO_TERM_COLOR: always | |
RUST_VERSION: 1.81.0 | |
RUST_VERSION_FMT: nightly-2023-10-29 | |
RUST_VERSION_COV: nightly-2024-06-05 | |
RUSTFLAGS: -D warnings | |
REGISTRY: ghcr.io | |
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2 | |
jobs: | |
build: | |
runs-on: ${{ matrix.job.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
job: | |
- os: buildjet-4vcpu-ubuntu-2204 | |
platform: linux | |
target: x86_64-unknown-linux-gnu | |
cross_image: x86_64-linux-gnu | |
- os: buildjet-4vcpu-ubuntu-2204 | |
platform: linux-arm | |
target: aarch64-unknown-linux-gnu | |
cross_image: aarch64-linux-gnu | |
- os: macos-latest | |
platform: darwin | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
platform: darwin-arm | |
target: aarch64-apple-darwin | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
if: matrix.job.cross_image | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to the ghcr.io registry | |
if: matrix.job.os == 'buildjet-4vcpu-ubuntu-2204' | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to the docker.io registry | |
if: matrix.job.os == 'buildjet-4vcpu-ubuntu-2204' | |
uses: docker/login-action@v2 | |
with: | |
username: fuellabs | |
password: ${{ secrets.DOCKER_IO_READ_ONLY_TOKEN }} | |
- name: Setup custom cross env ${{ matrix.job.cross_image }} | |
if: matrix.job.cross_image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ci | |
file: ci/Dockerfile.${{ matrix.job.target }}-clang | |
tags: ${{ matrix.job.cross_image }}:latest | |
load: true | |
cache-from: type=registry,ref=ghcr.io/fuellabs/${{ matrix.job.cross_image }}-build-cache:latest | |
cache-to: type=registry,ref=ghcr.io/fuellabs/${{ matrix.job.cross_image }}-build-cache:latest,mode=max | |
- name: Install packages (macOS) | |
if: matrix.job.os == 'macos-latest' | |
run: | | |
ci/macos-install-packages.sh | |
- name: Install toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.RUST_VERSION }} | |
target: ${{ matrix.job.target }},"wasm32-unknown-unknown" | |
- name: Install cross | |
uses: baptiste0928/cargo-install@v1 | |
with: | |
crate: cross | |
cache-key: '${{ matrix.job.target }}' | |
- name: Build bench binary | |
run: | | |
cross build --profile=release --target ${{ matrix.job.target }} -p fuel-core-benches --features parallel-executor --bin high_tps_public_bench | |
- name: Strip release binary linux x86_64 | |
if: matrix.job.platform == 'linux' | |
run: | | |
strip "target/${{ matrix.job.target }}/release/high_tps_public_bench" | |
- name: Strip release binary aarch64-linux-gnu | |
if: matrix.job.target == 'aarch64-unknown-linux-gnu' | |
run: | | |
docker run --rm -v \ | |
"$PWD/target:/target:Z" \ | |
aarch64-linux-gnu:latest \ | |
aarch64-linux-gnu-strip \ | |
/target/aarch64-unknown-linux-gnu/release/high_tps_public_bench | |
- name: Strip release binary mac | |
if: matrix.job.os == 'macos-latest' | |
run: | | |
strip -x "target/${{ matrix.job.target }}/release/high_tps_public_bench" | |
- name: Prepare Binary Artifact | |
env: | |
PLATFORM_NAME: ${{ matrix.job.platform }} | |
TARGET: ${{ matrix.job.target }} | |
run: | | |
# setup artifact filename | |
ARTIFACT="ben-high-tps-${{ matrix.job.target }}" | |
ZIP_FILE_NAME="high_tps_bench-${{ matrix.job.target }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}.tar.gz" | |
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV | |
# create zip file | |
mkdir -pv "$ARTIFACT" | |
cp -r "./bin/fuel-core/chainspec/local-testnet" "$ARTIFACT" | |
cp "target/${{ matrix.job.target }}/release/high_tps_public_bench" "$ARTIFACT" | |
tar -czvf "$ZIP_FILE_NAME" "$ARTIFACT" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ZIP_FILE_NAME }} | |
path: ./${{ env.ZIP_FILE_NAME }} | |