feat: Add container health checks and all-in-one checks #173
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: commit | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| linter: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25.2" | |
| - run: go mod download | |
| - run: go mod verify | |
| - run: go install tool | |
| - uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: v2.5.0 | |
| tests: | |
| name: tests-${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| # Check on all supported GitHub Actions OS | |
| # https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories | |
| # https://github.com/actions/runner-images | |
| # https://github.com/actions/partner-runner-images | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-22.04 | |
| - ubuntu-24.04 | |
| - ubuntu-22.04-arm | |
| - ubuntu-24.04-arm | |
| - windows-2022 | |
| - windows-2025 | |
| - macos-13 | |
| - macos-14 | |
| - macos-15 | |
| - macos-26 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25.2" | |
| - run: go mod download | |
| - run: go test -v ./... -coverprofile=./coverage.txt -covermode=atomic -coverpkg=./... | |
| - name: Archive code coverage results | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: code-coverage | |
| path: coverage.txt | |
| code_coverage: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| needs: tests | |
| permissions: | |
| contents: read | |
| actions: read | |
| pull-requests: write # write permission needed to comment on PR | |
| steps: | |
| - uses: fgrosse/go-coverage-report@v1.2.0 | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 # Required for goreleaser to get git history | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.25.2" | |
| - name: Set up QEMU for cross-compilation of Docker images | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Fix Segmentation fault or QEMU - https://github.com/docker/buildx/issues/1170 | |
| run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes | |
| - run: go mod download | |
| - run: go install tool | |
| - run: go generate ./... | |
| - name: Check for modified files | |
| run: | | |
| if ! git diff --quiet; then | |
| echo "Error: Running 'go generate' modified files. Please commit these changes:" | |
| git diff | |
| exit 1 | |
| fi | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| id: goreleaser | |
| with: | |
| distribution: goreleaser | |
| version: "~> v2" | |
| args: release --skip=publish --clean --snapshot | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Test build Docker image (stage-bin) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| platforms: | | |
| linux/arm64 | |
| linux/amd64 | |
| target: stage-bin | |
| tags: test-build-bin | |
| build-args: | | |
| VERSION=${{ fromJSON(steps.goreleaser.outputs.metadata).version }} | |
| COMMIT=${{ fromJSON(steps.goreleaser.outputs.metadata).commit }} | |
| COMMIT_DATE=${{ fromJSON(steps.goreleaser.outputs.metadata).date }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Test build Docker image (stage-release) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| platforms: | | |
| linux/arm64 | |
| linux/amd64 | |
| target: stage-release | |
| tags: test-build-release | |
| build-args: | | |
| VERSION=${{ fromJSON(steps.goreleaser.outputs.metadata).version }} | |
| COMMIT=${{ fromJSON(steps.goreleaser.outputs.metadata).commit }} | |
| COMMIT_DATE=${{ fromJSON(steps.goreleaser.outputs.metadata).date }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |