Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Use Github Actions #342

Merged
merged 5 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this still re-run CI if you push commits to a PR? For example, if tests fail and you push a new commit to fix the test, I think we want CI to run again?

Copy link
Contributor

@dani-santos-code dani-santos-code May 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every time we push a commit to this PR, ci will re-run. You can see the little check next to every commit:

Screen Shot 2021-05-25 at 4 46 34 PM

Is that what you mean? πŸ€”

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice yea!

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