Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Commit

Permalink
Add test and docker build step to ci (#24)
Browse files Browse the repository at this point in the history
closes #21
closes #22
  • Loading branch information
turbaszek committed Mar 22, 2020
1 parent 89f8f9e commit cff68ae
Show file tree
Hide file tree
Showing 11 changed files with 326 additions and 357 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
- "//"
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit cff68ae

Please sign in to comment.