From 0a8dfdf15d6fdbb02db8279cef98e4febe828a72 Mon Sep 17 00:00:00 2001 From: Sasha Zezulinsky Date: Thu, 24 Oct 2024 19:41:35 +0200 Subject: [PATCH] Build x86_64 on ubuntu-latest and arm64 on raspbian-private runners (#479) --- .github/workflows/build.yml | 80 ++++++++----------------------------- 1 file changed, 17 insertions(+), 63 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc63bfc47..77ccba2fc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,16 @@ name: go-core build on: push jobs: - build-windows: - runs-on: windows-latest + build: + runs-on: ${{ matrix.config.platform }} + strategy: + matrix: + config: + - {platform: windows-latest, os: windows, arch: amd64, path: windows-x86_64} + - {platform: macos-13, os: darwin, arch: amd64, path: darwin-x86_64} + - {platform: macos-latest, os: darwin, arch: arm64, path: darwin-arm64} + - {platform: ubuntu-latest, os: linux, arch: amd64, path: linux-x86_64} + - {platform: raspbian-private, os: linux, arch: arm64, path: linux-arm64} steps: - name: Checkout uses: actions/checkout@v4 @@ -11,6 +19,7 @@ jobs: with: go-version: 1.23 - name: Setup MSYS + if: ${{ matrix.config.platform == 'windows-latest' }} uses: msys2/setup-msys2@v2 with: msystem: mingw64 @@ -24,33 +33,12 @@ jobs: libtool mingw-w64-x86_64-toolchain mingw-w64-x86_64-go - - name: Build Windows - run: | - make gocore - make test - - name: Upload Gocore - if: startsWith(github.ref, 'refs/tags/v') - uses: actions/upload-artifact@v4 - with: - name: gocore-windows-x86_64 - path: ./build/bin/gocore* - - build-mac: - runs-on: ${{ matrix.config.os }} - strategy: - matrix: - config: - - {os: macos-13, path: darwin-x86_64} - - {os: macos-latest, path: darwin-arm64} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: 1.23 - name: Build & Test + shell: bash run: | + uname -m + export GOOS=${{ matrix.config.os }} + export GOARCH=${{ matrix.config.arch }} make gocore make test - name: Upload Gocore @@ -60,42 +48,9 @@ jobs: name: gocore-${{ matrix.config.path }} path: ./build/bin/gocore* - build-alpine: - strategy: - matrix: - config: - - {arch: x86_64, branch: latest-stable} - - {arch: aarch64, branch: latest-stable} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Alpine Linux - uses: jirutka/setup-alpine@v1 - with: - arch: ${{ matrix.config.arch }} - branch: ${{ matrix.config.branch }} - - name: Install deps - shell: alpine.sh --root {0} - run: apk add git cmake gcc g++ make go - - name: Safelist - shell: alpine.sh --root {0} - run: git config --global --add safe.directory ${{ github.workspace }} - - name: Build & Test - shell: alpine.sh --root {0} - run: | - make gocore - make test - - name: Upload Gocore - if: startsWith(github.ref, 'refs/tags/v') - uses: actions/upload-artifact@v4 - with: - name: gocore-linux-${{ matrix.config.arch }} - path: ./build/bin/gocore* - release: if: startsWith(github.ref, 'refs/tags/v') - needs: [build-windows, build-mac, build-alpine] + needs: build runs-on: ubuntu-latest outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} @@ -124,8 +79,7 @@ jobs: platform: [ {path: linux-x86_64, file_ext: ""}, {path: windows-x86_64, file_ext: ".exe"}, - {path: linux-aarch64, file_ext: ""}, - {path: linux-riscv64, file_ext: ""}, + {path: linux-arm64, file_ext: ""}, {path: darwin-x86_64, file_ext: ""}, {path: darwin-arm64, file_ext: ""}, ]