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 to weave-binaries 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: | |
| name: Build Go binaries | |
| 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: List files in build directory (optional for debugging) | |
| run: ls -R build/ | |
| - 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 binaries as artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: weave_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }} | |
| path: weave_${{ github.ref_name }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz | |
| if-no-files-found: error | |
| upload-to-weave-binaries: | |
| name: Upload to weave-binaries release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| path: artifacts | |
| - name: Create a release in weave-binaries | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| repository: initia-labs/weave-binaries | |
| name: ${{ github.ref_name }} | |
| draft: false | |
| prerelease: true | |
| token: ${{ secrets.GH_RELEASE_TOKEN }} | |
| files: | | |
| artifacts/weave_${{ github.ref_name }}_linux_amd64/weave_${{ github.ref_name }}_linux_amd64.tar.gz | |
| artifacts/weave_${{ github.ref_name }}_linux_arm64/weave_${{ github.ref_name }}_linux_arm64.tar.gz | |
| artifacts/weave_${{ github.ref_name }}_darwin_amd64/weave_${{ github.ref_name }}_darwin_amd64.tar.gz | |
| artifacts/weave_${{ github.ref_name }}_darwin_arm64/weave_${{ github.ref_name }}_darwin_arm64.tar.gz |