Skip to content

Commit

Permalink
Add Go CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bschimke95 committed Jul 2, 2024
1 parent 7bac9bc commit 362425b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Go

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
test:
permissions:
contents: read # for actions/checkout to fetch code
name: Unit Tests & Code Quality
runs-on: ubuntu-latest

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Check out code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.22"

- name: go fmt
working-directory: src/k8s
run: make go.fmt

- name: go vet
working-directory: src/k8s
run: make go.vet

- name: go test
working-directory: src/k8s
run: make test-unit
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ BOOTSTRAP_IMG ?= $(REGISTRY)/bootstrap-controller
CONTROLPLANE_IMG_TAG ?= $(RELEASE_TAG)
CONTROLPLANE_IMG ?= $(REGISTRY)/controlplane-controller

go-vet:
go vet ./...

go-fmt:
go fmt ./...

test-unit: test-common test-bootstrap test-controlplane

test-common:
go test $(shell pwd)/pkg/... -coverprofile cover.out

Expand Down
5 changes: 5 additions & 0 deletions bootstrap/api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/cloudinit/controlplane_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestNewInitControlPlane(t *testing.T) {
"prerun2",
"/capi/scripts/install.sh",
"/capi/scripts/bootstrap.sh",
"/capi/scripts/load-images.sh",
"/capi/scripts/wait-apiserver-ready.sh",
"/capi/scripts/deploy-manifests.sh",
"/capi/scripts/configure-token.sh",
Expand Down

0 comments on commit 362425b

Please sign in to comment.