feat(k3s): per-pool nodePrep (cloud-init packages/runcmd) (E2) (#146) #385
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] | |
| env: | |
| # Modules declare `go 1.25.0`; setup-go auto-downloads that toolchain | |
| # if it's newer than this baseline, but golangci-lint is compiled | |
| # against setup-go's version, so bumping to 1.25 keeps the linter | |
| # in sync with what it's parsing. | |
| GO_VERSION: "1.25" | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Download dependencies | |
| run: make deps | |
| - name: Build all | |
| run: make build | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Download dependencies | |
| run: make deps | |
| - name: Run tests | |
| run: make test | |
| - name: Run tests with race detector | |
| run: | | |
| go test -race ./... | |
| cd plugins/proxmox && go test -race ./... | |
| cd ../k3s && go test -race ./... | |
| cd ../k8s && go test -race ./... | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| # Install golangci-lint via `go install` so it's built with the | |
| # same Go toolchain that setup-go installed. The | |
| # golangci/golangci-lint-action's cached "latest" binary was built | |
| # against an older Go than what the module targets (go 1.25.0), | |
| # producing "the Go language version used to build golangci-lint | |
| # is lower than the targeted Go version" errors. | |
| - name: Install golangci-lint | |
| run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest | |
| - name: Run golangci-lint (root) | |
| run: golangci-lint run ./... | |
| - name: Run golangci-lint (proxmox plugin) | |
| run: cd plugins/proxmox && golangci-lint run --config=../../.golangci.yml ./... | |
| - name: Run golangci-lint (k3s plugin) | |
| run: cd plugins/k3s && golangci-lint run --config=../../.golangci.yml ./... | |
| - name: Run golangci-lint (k8s plugin) | |
| run: cd plugins/k8s && golangci-lint run --config=../../.golangci.yml ./... | |
| vet: | |
| name: Vet & Staticcheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Download dependencies | |
| run: make deps | |
| - name: Run go vet (root) | |
| run: go vet ./... | |
| - name: Run go vet (proxmox plugin) | |
| run: cd plugins/proxmox && go vet ./... | |
| - name: Run go vet (k3s plugin) | |
| run: cd plugins/k3s && go vet ./... | |
| - name: Run go vet (k8s plugin) | |
| run: cd plugins/k8s && go vet ./... | |
| - name: Install staticcheck | |
| run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
| - name: Run staticcheck (root) | |
| run: staticcheck ./... | |
| - name: Run staticcheck (proxmox plugin) | |
| run: cd plugins/proxmox && staticcheck ./... | |
| - name: Run staticcheck (k3s plugin) | |
| run: cd plugins/k3s && staticcheck ./... | |
| - name: Run staticcheck (k8s plugin) | |
| run: cd plugins/k8s && staticcheck ./... | |
| format: | |
| name: Format Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Check formatting | |
| run: | | |
| if [ -n "$(gofmt -l .)" ]; then | |
| echo "The following files are not formatted:" | |
| gofmt -l . | |
| exit 1 | |
| fi | |
| modernize: | |
| name: Modernize Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Download dependencies | |
| run: make deps | |
| - name: Install modernize | |
| run: go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest | |
| # Filter generated .pb.go files: modernize reports interface{} | |
| # → any suggestions on them, but its own -fix pass skips | |
| # `Code generated` files, so we can't act on the report. | |
| # Excluding here matches what `make modernize` produces. | |
| - name: Run modernize (root) | |
| run: | | |
| OUTPUT=$(modernize ./... 2>&1 | grep -v '\.pb\.go:' || true) | |
| if [ -n "$OUTPUT" ]; then | |
| echo "Modernize suggestions found:" | |
| echo "$OUTPUT" | |
| echo "" | |
| echo "Run 'make modernize' locally to apply fixes" | |
| exit 1 | |
| fi | |
| - name: Run modernize (proxmox plugin) | |
| run: | | |
| cd plugins/proxmox | |
| OUTPUT=$(modernize ./... 2>&1 | grep -v '\.pb\.go:' || true) | |
| if [ -n "$OUTPUT" ]; then | |
| echo "Modernize suggestions found in proxmox plugin:" | |
| echo "$OUTPUT" | |
| echo "" | |
| echo "Run 'make modernize' locally to apply fixes" | |
| exit 1 | |
| fi | |
| - name: Run modernize (k3s plugin) | |
| run: | | |
| cd plugins/k3s | |
| OUTPUT=$(modernize ./... 2>&1 | grep -v '\.pb\.go:' || true) | |
| if [ -n "$OUTPUT" ]; then | |
| echo "Modernize suggestions found in k3s plugin:" | |
| echo "$OUTPUT" | |
| echo "" | |
| echo "Run 'make modernize' locally to apply fixes" | |
| exit 1 | |
| fi | |
| - name: Run modernize (k8s plugin) | |
| run: | | |
| cd plugins/k8s | |
| OUTPUT=$(modernize ./... 2>&1 | grep -v '\.pb\.go:' || true) | |
| if [ -n "$OUTPUT" ]; then | |
| echo "Modernize suggestions found in k8s plugin:" | |
| echo "$OUTPUT" | |
| echo "" | |
| echo "Run 'make modernize' locally to apply fixes" | |
| exit 1 | |
| fi |