Skip to content
Permalink
Browse files
Add test and docker build step to ci (#24)
closes #21
closes #22
  • Loading branch information
turbaszek committed Mar 22, 2020
1 parent 89f8f9e commit cff68ae0a488f84dae5b86aa82e25cb1de1b63a5
Showing 11 changed files with 326 additions and 357 deletions.
@@ -38,17 +38,31 @@ jobs:
- uses: pre-commit/action@v1.0.1

build:
name: Build
name: Build docker
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build
run: docker build . -t "ci"

tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Check out code into the Go module directory
- name: Check out code
uses: actions/checkout@v2
- name: Get dependencies
run: go mod download
- name: Build
run: go build -v .
- name: Install kubebuilder
run: |
os=$(go env GOOS) && \
arch=$(go env GOARCH) && \
curl -L https://go.kubebuilder.io/dl/2.3.0/$os/$arch | tar -xz -C /tmp/ && \
sudo mv /tmp/kubebuilder_2.3.0_${os}_${arch} /usr/local/kubebuilder && \
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Run test
run: make test
@@ -46,7 +46,7 @@ repos:
hooks:
- id: insert-license
name: Add license for all yaml files
exclude: ^vendor/.*$
exclude: ^vendor/.*$|^config/crd/bases/.*$|^config/rbac/role.yaml$|^config/webhook/manifests.yaml$
types: [yaml]
args:
- --comment-style
@@ -67,7 +67,7 @@ repos:
- id: insert-license
name: Add license for all go files
files: \.go$
exclude: ^vendor/.*$|^zz_generated.*$
exclude: ^vendor/.*$|api/v1alpha1/zz_generated.deepcopy.go
args:
- --comment-style
- "//"
@@ -17,6 +17,7 @@
FROM golang:1.13 as builder

WORKDIR /workspace
COPY vendor/ vendor/
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
@@ -33,14 +33,14 @@ IMG ?= controller:latest
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"

all: test manager
all: test build

# Run tests
test: generate fmt vet manifests
test: generate manifests
go test ./controllers/... -coverprofile cover.out

# Build manager binary
manager: generate fmt vet
build: generate fmt vet
go build -o bin/manager main.go

# Run against the configured Kubernetes cluster in ~/.kube/config

Some generated files are not rendered by default. Learn more.

0 comments on commit cff68ae

Please sign in to comment.