diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4d705c5..bd078c5 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -10,7 +10,7 @@ on: jobs: - build: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -23,26 +23,59 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v9 + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Set up Go + uses: actions/setup-go@v7 + with: + go-version-file: 'go.mod' + + - name: Test + run: go test -v ./... + + build: + needs: + - lint + - test + runs-on: ubuntu-latest + strategy: + matrix: + goarch: [amd64, arm64, ppc64le, s390x] + steps: + - uses: actions/checkout@v7 + + - name: Set up Go + uses: actions/setup-go@v7 + with: + go-version-file: 'go.mod' + - name: Build - run: CGO_ENABLED=0 go build -a -tags netgo -ldflags '-s -w' -v -o . ./... + env: + GOOS: linux + GOARCH: ${{ matrix.goarch }} + CGO_ENABLED: 0 + run: | + mkdir -p dist + go build -a -tags netgo -ldflags '-s -w' -v -o "dist/junit2jira-linux-${GOARCH}" ./cmd/junit2jira + go build -a -tags netgo -ldflags '-s -w' -v -o "dist/flakechecker-linux-${GOARCH}" ./cmd/flakechecker - name: Compress binaries + if: ${{ matrix.goarch != 's390x' }} uses: svenstaro/upx-action@v3 with: + strip: false files: | - junit2jira - flakechecker - - - name: Test - run: go test -v ./... + dist/junit2jira-linux-${{ matrix.goarch }} + dist/flakechecker-linux-${{ matrix.goarch }} - - name: Upload binary + - name: Upload binaries uses: actions/upload-artifact@v7 with: - name: junit2jira - path: | - junit2jira - flakechecker + name: junit2jira-linux-${{ matrix.goarch }} + path: dist/* release: if: startsWith(github.ref, 'refs/tags/') @@ -52,11 +85,11 @@ jobs: - name: Download executables uses: actions/download-artifact@v8 with: - name: junit2jira + pattern: junit2jira-linux-* + path: dist + merge-multiple: true - name: Release uses: softprops/action-gh-release@v3 if: startsWith(github.ref, 'refs/tags/') with: - files: | - junit2jira - flakechecker + files: dist/*