Skip to content

Commit

Permalink
Improve build binaries pipeline
Browse files Browse the repository at this point in the history
Changes made:
- build macOS arm and x86
- rename architecture from amd64 to x86_64, which is much easier to distinct from arm
- remove unnecessary step for self-hosted which is not being used anymore
- create ARTIFACT_NAME env var, so it's much easier to read the code
- remove unnecessary id
- add trigger on PR that change the build binaries files
- get architecture during runtime
  • Loading branch information
derrix060 committed Sep 5, 2024
1 parent c0008d7 commit 9f742cf
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
tags:
- 'v*'
workflow_dispatch:
pull_request:
branches:
- main
paths:
- .github/workflows/build-binaries.yml

jobs:
build:
Expand All @@ -13,11 +18,9 @@ jobs:
matrix:
include:
- os: ubuntu-latest
architecture: amd64
- os: macOS-latest
architecture: amd64
- os: macos-13
- os: ubuntu-arm64-4-core
architecture: arm64
- os: macos-latest
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -27,9 +30,11 @@ jobs:
fetch-depth: 0

- name: Get latest tag
id: tag
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV

- name: Get artifact name
run: echo "ARTIFACT_NAME=juno-${{ env.TAG }}-${{ runner.os }}-$(uname -m)" >> $GITHUB_ENV

- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update -qq && sudo apt-get install -y upx-ucl build-essential cargo git golang libjemalloc-dev libjemalloc2 -y
Expand All @@ -47,27 +52,21 @@ jobs:
run: |
make juno
upx build/juno
mv build/juno juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}
mv build/juno ${{ env.ARTIFACT_NAME }}
- name: Generate Checksum
id: checksum
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
shasum -a 256 juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }} > juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}.sha256
shasum -a 256 ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256
else
sha256sum juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }} > juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}.sha256
sha256sum ${{ env.ARTIFACT_NAME }} > ${{ env.ARTIFACT_NAME }}.sha256
fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}
name: ${{ env.ARTIFACT_NAME }}
path: |
juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}
juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}.sha256
- name: Cleanup
if: matrix.os == 'self-hosted'
run: |
rm juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}
rm juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}.sha256
${{ env.ARTIFACT_NAME }}
${{ env.ARTIFACT_NAME }}.sha256

0 comments on commit 9f742cf

Please sign in to comment.