Refactor control plane module #13
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Go vet | |
| run: go vet ./... | |
| - name: Install staticcheck | |
| run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
| - name: Staticcheck | |
| run: staticcheck ./... | |
| - name: Check formatting | |
| run: | | |
| unformatted=$(gofmt -l .) | |
| if [ -n "$unformatted" ]; then | |
| echo "Files not formatted:" | |
| echo "$unformatted" | |
| exit 1 | |
| fi | |
| - name: Verify go.mod is tidy | |
| run: | | |
| go mod tidy | |
| git diff --exit-code go.mod go.sum | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run tests with race detector | |
| run: go test -race -count=1 -coverprofile=coverage.out ./... | |
| - name: Print coverage summary | |
| run: go tool cover -func=coverage.out | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - binary: agent | |
| path: ./cmd/agent/ | |
| - binary: controlplane | |
| path: ./cmd/controlplane/ | |
| - binary: fc-init | |
| path: ./cmd/fc-init/ | |
| env: GOOS=linux GOARCH=arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build ${{ matrix.binary }} | |
| run: ${{ matrix.env }} go build -o /dev/null ${{ matrix.path }} | |
| docker: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build control-plane image (linux/amd64) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile.controlplane | |
| platforms: linux/amd64 | |
| push: false | |
| load: false | |
| build-args: | | |
| VERSION=ci | |
| COMMIT=${{ github.sha }} | |
| BUILD_TIME=ci |