From bc3d13148e756c766c3c8ea6ec067479cdff953d Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Sun, 31 May 2020 21:16:18 +0200 Subject: [PATCH] Github Action simple CI --- .github/workflows/main.yml | 32 ++++++++------------------------ Makefile | 13 +++++++++++-- Readme.md | 2 ++ workflows/kubeconform.yml | 17 ----------------- 4 files changed, 21 insertions(+), 43 deletions(-) delete mode 100644 workflows/kubeconform.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d6783e2..1e00f88 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,33 +1,17 @@ -# This is a basic workflow to help you get started with Actions +name: build -name: CI +on: push -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 + - name: checkout + uses: actions/checkout@v2 - # Runs a single command using the runners shell - - name: Run a one-line script - run: echo Hello, world! + - name: test + run: make docker-test - # Runs a set of commands using the runners shell - - name: Run a multi-line script - run: | - echo Add other actions to build, - echo test, and deploy your project. + - name: build + run: make docker-build-static \ No newline at end of file diff --git a/Makefile b/Makefile index e88cb4d..9bed59b 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,19 @@ #!/usr/bin/make -f -build: - go build -o bin/kubeconform +test-build: test build test: go test ./... +build: + go build -o bin/kubeconform + build-static: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o bin/kubeconform + +docker-test: + docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.14 make test + +docker-build-static: + docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.14 make build-static + diff --git a/Readme.md b/Readme.md index 7b3f9bc..5e24ddc 100644 --- a/Readme.md +++ b/Readme.md @@ -1,5 +1,7 @@ # Kubeconform +![Build status](https://github.com/yannh/kubeconform/workflows/build/badge.svg) + Kubeconform is a Kubernetes manifests validation tool. Build it into your CI to validate your Kubernetes configuration using the schemas from the registry maintained by the [kubernetes-json-schema](https://github.com/instrumenta/kubernetes-json-schema) project! diff --git a/workflows/kubeconform.yml b/workflows/kubeconform.yml deleted file mode 100644 index fdbfd01..0000000 --- a/workflows/kubeconform.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: kubeconform - -on: - push: - branches: [ master ] - -jobs: - build: - name: docker-build - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v2 - - - name: docker-build - run: | - docker build -t kubeconform .