Use typed comparation #7
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: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [ opened, synchronize, reopened, labeled, unlabeled ] | |
release: | |
types: [ published ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
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 }} | |
CARGO_TERM_COLOR: always | |
RUST_VERSION: 1.79.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: | |
publish-binary: | |
name: Release binaries | |
# Only do this job if publishing a release | |
if: github.event_name == 'release' && github.event.action == 'published' | |
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: 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 | |
- name: Build binaries | |
run: | | |
cross build --profile=release --target ${{ matrix.job.target }} --manifest-path network-upgrader/Cargo.toml | |
- name: Prepare Binary Artifact | |
env: | |
PLATFORM_NAME: ${{ matrix.job.platform }} | |
TARGET: ${{ matrix.job.target }} | |
run: | | |
# trim refs/tags/ prefix | |
BINARIES_VERSION="${GITHUB_REF#refs/tags/}" | |
# optionally trim v from tag prefix | |
BINARIES_VERSION="${BINARIES_VERSION#v}" | |
echo "version is: $BINARIES_VERSION" | |
# setup artifact filename | |
ARTIFACT="utils-$BINARIES_VERSION-${{ env.TARGET }}" | |
ZIP_FILE_NAME="$ARTIFACT.tar.gz" | |
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV | |
# create zip file | |
mkdir -pv "$ARTIFACT" | |
cp "network-upgrader/target/${{ matrix.job.target }}/release/fuel-core-network-upgrader" "$ARTIFACT" | |
tar -czvf "$ZIP_FILE_NAME" "$ARTIFACT" | |
- name: Upload Binary Artifact | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./${{ env.ZIP_FILE_NAME }} | |
asset_name: ${{ env.ZIP_FILE_NAME }} | |
asset_content_type: application/gzip |