From 03363fa4128968ec9c21d2f1e832b6b18ed71eed Mon Sep 17 00:00:00 2001 From: Camila Macedo Date: Sat, 23 Sep 2023 17:38:13 +0100 Subject: [PATCH] (chore): add GitHub action to test build and if binaries are functional for supported platforms Signed-off-by: Camila Macedo Signed-off-by: Camila Macedo --- .github/workflows/binaries.yml | 75 ++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/binaries.yml diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml new file mode 100644 index 00000000..00a24c26 --- /dev/null +++ b/.github/workflows/binaries.yml @@ -0,0 +1,75 @@ +name: Binaries Build + +on: + push: + pull_request: + +jobs: + build-binaries: + name: Build Binaries + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '~1.19' + + - name: Build All Binaries + run: make + + - name: Archive Binaries + uses: actions/upload-artifact@v2 + with: + name: binaries + path: bin/ + + test: + needs: build-binaries + name: Check ${{ matrix.binary }} + strategy: + matrix: + include: + - os: ubuntu-latest + binary: fioctl-linux-amd64 + - os: ubuntu-latest + binary: fioctl-linux-arm64 + qemu: true + qemu-platform: aarch64 + - os: windows-latest + binary: fioctl-windows-amd64.exe + - os: macos-latest + binary: fioctl-darwin-amd64 + runs-on: ${{ matrix.os }} + steps: + - name: Set up QEMU + if: matrix.qemu + uses: docker/setup-qemu-action@v3 + with: + platforms: ${{ matrix.qemu-platform }} + + - name: Download Binaries + uses: actions/download-artifact@v2 + with: + name: binaries + path: bin/ + + - name: Set Execute Permission + if: runner.os != 'Windows' + run: chmod +x ./bin/${{ matrix.binary }} + + - name: Install QEMU user static + if: matrix.qemu + run: sudo apt-get update && sudo apt-get install -y qemu-user-static + shell: bash + + - name: Verify binary + run: | + if ("${{ matrix.qemu }}" -eq "true") { + qemu-${{ matrix.qemu-platform }}-static ./bin/${{ matrix.binary }} logout + } else { + ./bin/${{ matrix.binary }} logout + } + shell: pwsh