Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Go binaries and upload release | |
| on: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| basic-checks: | |
| name: Basic Checks | |
| runs-on: ubuntu-latest | |
| env: | |
| GOLANGCI_LINT_VERSION: v1.61.0 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.22 | |
| - run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} | |
| - name: Run golangci-lint | |
| run: make lint | |
| - name: Run unit tests | |
| run: go test -v ./... | |
| integration-tests: | |
| name: Run Integration Tests | |
| needs: basic-checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.22 | |
| - name: Run Integration Tests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: go test -v ./... -tags=integration | |
| build-and-upload: | |
| name: Build Go binaries and upload release | |
| needs: integration-tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goos: [linux, darwin] | |
| goarch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.22 | |
| - name: Build binary | |
| run: | | |
| mkdir -p build/${{ matrix.goos }}_${{ matrix.goarch }} | |
| GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-X github.com/initia-labs/weave/cmd.Version=${{ github.ref_name }}" -o build/${{ matrix.goos }}_${{ matrix.goarch }}/weave | |
| - name: Create tar.gz | |
| run: | | |
| tar -czvf weave_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz -C build/${{ matrix.goos }}_${{ matrix.goarch }} weave | |
| - name: Upload binary to release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| name: ${{ github.ref_name }} | |
| draft: false | |
| prerelease: true | |
| token: ${{ secrets.GH_RELEASE_TOKEN }} | |
| files: | | |
| weave_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz |