Skip to content

Commit

Permalink
Use Github Actions (#342)
Browse files Browse the repository at this point in the history
* Use Github Actions

Co-authored-by: Daniele Santos <[email protected]>
  • Loading branch information
genevieveluyt and dani-santos-code authored May 25, 2021
1 parent 41e1eff commit 5c9d942
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/autolabeler.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
core: ["/cmd"]
legal: ["LICENSE*", "CODE_OF_CONDUCT*"]
config: [".github","build","travis.yml","Makefile","/configs"]
config: [".github","build","Makefile","/configs"]
go-modules: ["go.*"]
readme: ["README*"]
datafiles: ["/fixtures"]
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.16.x"
- name: Clone repo
uses: actions/checkout@v2
- name: Install kubectl
run: sudo snap install kubectl --classic
- name: Install kind
run: GO111MODULE=on go get sigs.k8s.io/kind
- name: Go mod download and go tidy
run: make setup
- name: Run tests
run: make test
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ifneq ($(GOVERSION_MIN), $(GOVERSION_CHECK))
$(error Detected Go version $(GOVERSION) < required version $(GOVERSION_MIN))
endif

all: setup test build
all: test build

build:
$(GOBUILD) -o $(BINARY_NAME) -v -ldflags=all="$(LDFLAGS)" cmd/main.go
Expand All @@ -45,20 +45,20 @@ test-teardown:
show-coverage: test
go tool cover -html=coverage.txt

setup:
$(GOMOD) download
$(GOMOD) tidy

clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)

setup:
$(GOMOD) download
$(GOMOD) tidy

# Cross Compilation
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v

docker-build:
docker run --rm -it -v "$(GOPATH)":/go -w /go/src/github.com/Shopify/kubeaudit golang:1.12 go build -o "$(BINARY_UNIX)" -v

.PHONY: all build install plugin test test-setup test-teardown show-coverage clean setup build-linux docker-build
.PHONY: all build install plugin test test-setup test-teardown show-coverage clean build-linux docker-build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://api.travis-ci.org/Shopify/kubeaudit.svg?branch=master)](https://travis-ci.org/Shopify/kubeaudit/)
[![Build Status](https://github.com/Shopify/kubeaudit/actions/workflows/ci.yml/badge.svg)](https://github.com/Shopify/kubeaudit/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/Shopify/kubeaudit)](https://goreportcard.com/report/github.com/Shopify/kubeaudit)
[![GoDoc](https://godoc.org/github.com/Shopify/kubeaudit?status.png)](https://godoc.org/github.com/Shopify/kubeaudit)

Expand Down
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi

touch coverage.txt

for d in $(go list ./... | grep -v vendor); do
for d in $(go list ./...); do
go test -race -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
Expand Down

0 comments on commit 5c9d942

Please sign in to comment.