From a62b588ace48a3d55bd553aedc3f7ad4608bacec Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sat, 17 Oct 2020 15:13:06 -0600 Subject: [PATCH] Add matrix to build-test.yml --- .github/workflows/build-test.yml | 38 +++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7d7d4ea..d5c726f 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -9,30 +9,48 @@ on: jobs: build: - runs-on: ubuntu-20.04 + strategy: + # Default is true, cancels jobs for other platforms in the matrix if one fails + fail-fast: false + + matrix: + os: [ ubuntu-20.04 ] + go: [ 1.15 ] + goos: [ linux ] + goarch: [ amd64, arm, arm64 ] + + runs-on: ${{ matrix.os }} + steps: - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 with: - go-version: '1.15.2' + go-version: ${{ matrix.go }} + - name: Build + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} run: | - GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_linux_amd64 -v wings.go - GOOS=linux GOARCH=arm64 go build -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_linux_arm64 -v wings.go + go build -v -ldflags="-s -w -X github.com/pterodactyl/wings/system.Version=dev-${GIT_COMMIT:0:7}" -o build/wings_${{ matrix.goos }}_${{ matrix.goarch }} wings.go + - name: Test run: go test ./... + - name: Compress binary and make it executable if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} run: | - upx build/wings_linux_amd64 && chmod +x build/wings_linux_amd64 - upx build/wings_linux_arm64 && chmod +x build/wings_linux_arm64 + upx build/wings_${{ matrix.goos }}_${{ matrix.goarch }} && chmod +x build/wings_${{ matrix.goos }}_${{ matrix.goarch }} + - uses: actions/upload-artifact@v2 if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} with: - name: wings_linux_amd64 - path: build/wings_linux_amd64 + name: wings_${{ matrix.goos }}_${{ matrix.goarch }} + path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }} + - uses: actions/upload-artifact@v2 if: ${{ github.ref == 'refs/heads/develop' || github.event_name == 'pull_request' }} with: - name: wings_linux_arm64 - path: build/wings_linux_arm64 \ No newline at end of file + name: wings_${{ matrix.goos }}_${{ matrix.goarch }} + path: build/wings_${{ matrix.goos }}_${{ matrix.goarch }}