diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..cc3530b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +--- +name: Build +on: + push: + branches: + - main + paths-ignore: + - "*.md" + - "LICENSE" + - "NOTICE" + pull_request: + paths-ignore: + - "*.md" + - "LICENSE" + - "NOTICE" +jobs: + build: + name: Build + runs-on: ubuntu-18.04 + steps: + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.12 + - name: Checkout code + uses: actions/checkout@v2 + - name: yaml-lint + uses: ibiqlik/action-yamllint@v3 + - name: Run unit tests + run: make tests + - name: Upload code coverage + uses: codecov/codecov-action@v1 + with: + file: ./coverage.txt + - name: Dry-run release snapshot + uses: goreleaser/goreleaser-action@v2 + with: + version: v0.148.0 + args: release --snapshot --skip-publish --rm-dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5d8f835 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +--- +name: Release +on: + push: + tags: + - "v*" +jobs: + release: + name: Release + runs-on: ubuntu-18.04 + steps: + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.15 + - name: Checkout code + uses: actions/checkout@v2 + - name: Run unit tests + run: make tests + - name: Upload code coverage + uses: codecov/codecov-action@v1 + with: + file: ./coverage.txt + - name: Release + uses: goreleaser/goreleaser-action@v2 + with: + version: v0.148.0 + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index a8d2b81..882246e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ conf* .vscode .gitignore *.exe* + +coverage.txt \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..cc5ce98 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,25 @@ +env: + - GO111MODULE=on +builds: + - id: build-app + main: kube-query.go + binary: kube-query + env: + - CGO_ENABLED=0 +archives: + - replacements: + darwin: Darwin + linux: Linux + 386: i386 + amd64: x86_64 +checksum: + name_template: "checksums.txt" +snapshot: + name_template: "{{ .FullCommit }}" +changelog: + sort: asc + filters: + exclude: + - '^docs' + - '^test' + - '^release' diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..34c9366 --- /dev/null +++ b/.yamllint @@ -0,0 +1,6 @@ +--- +extends: default + +rules: + line-length: disable + truthy: disable diff --git a/Makefile b/Makefile index fc716a6..74b4fc2 100644 --- a/Makefile +++ b/Makefile @@ -6,4 +6,7 @@ build: all: make clean - make build \ No newline at end of file + make build + +tests: + GO111MODULE=on go test -v -short -race -timeout 30s -coverprofile=coverage.txt -covermode=atomic ./... \ No newline at end of file diff --git a/README.md b/README.md index edc78d0..d6cb0d5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,24 @@ # kube-query +[![GitHub Release][release-img]][release] +![Downloads][download] +[![Go Report Card][report-card-img]][report-card] +[![Go Doc][go-doc-img]][go-doc] +![Code Coverage][code-cov] +[![License][license-img]][license] + +[download]: https://img.shields.io/github/downloads/aquasecurity/kube-query/total?logo=github +[release-img]: https://img.shields.io/github/release/aquasecurity/kube-query.svg?logo=github +[release]: https://github.com/aquasecurity/kube-query/releases +[docker-pull]: https://img.shields.io/docker/pulls/krol/go_api?logo=docker&label=docker%20pulls%20%2F%20go_api +[report-card-img]: https://goreportcard.com/badge/github.com/aquasecurity/kube-query +[report-card]: https://goreportcard.com/report/github.com/aquasecurity/kube-query +[go-doc-img]: https://godoc.org/github.com/aquasecurity/kube-query?status.svg +[go-doc]: https://godoc.org/github.com/aquasecurity/kube-query +[code-cov]: https://codecov.io/gh/aquasecurity/kube-query/branch/main/graph/badge.svg +[license-img]: https://img.shields.io/badge/License-Apache%202.0-blue.svg +[license]: https://github.com/aquasecurity/kube-query/blob/main/LICENSE + kube-query is an extension for [osquery](https://osquery.io), letting you visualize your cluster using sql queries. Deployment