From 9f742cf5ac8cd9db308b94d235cbe4d16979c74b Mon Sep 17 00:00:00 2001 From: Mario Apra Date: Thu, 5 Sep 2024 10:26:47 +0100 Subject: [PATCH] Improve build binaries pipeline 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 --- .github/workflows/build-binaries.yml | 33 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index ae2bc83eac..26ca44084e 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -5,6 +5,11 @@ on: tags: - 'v*' workflow_dispatch: + pull_request: + branches: + - main + paths: + - .github/workflows/build-binaries.yml jobs: build: @@ -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: @@ -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 @@ -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