-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: improve GH actions and move cmd/ folder
- Loading branch information
1 parent
b194536
commit 1020102
Showing
3 changed files
with
64 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,74 @@ | ||
name: ko publish | ||
name: Test and publish | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
|
||
jobs: | ||
publish: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17.x | ||
go-version: 1.17 | ||
stable: true | ||
|
||
- run: | | ||
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
mkdir -p local/envtest-bin/ | ||
setup-envtest use -p env 1.21.x --bin-dir local/envtest-bin > local/envtest-bin/env | ||
- name: Run Unit tests | ||
run: | | ||
source local/envtest-bin/env | ||
export KUBEBUILDER_ASSETS=$(pwd)/$KUBEBUILDER_ASSETS | ||
go test -race -covermode atomic -coverprofile=profile.cov ./... | ||
- name: Send coverage | ||
env: | ||
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
go install github.com/mattn/goveralls | ||
goveralls -coverprofile=profile.cov -service=github | ||
release-tagged: | ||
if: "startsWith(github.ref, 'refs/tags/v')" | ||
needs: | ||
# - lint | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
stable: true | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: postfinance | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- uses: imjasonh/[email protected] | ||
env: | ||
KO_DOCKER_REPO: docker.io/postfinance | ||
- run: | | ||
tag=$(echo ${{ github.ref }} | cut -d "/" -f 3 - ) | ||
ko publish cmd/kubelet-csr-approver/main.go --base-import-paths --tags $tag | ||
release-untagged: | ||
if: "!startsWith(github.ref, 'refs/tags/v')" | ||
needs: | ||
# - lint | ||
- test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
stable: true | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
|
@@ -21,4 +78,5 @@ jobs: | |
- uses: imjasonh/[email protected] | ||
env: | ||
KO_DOCKER_REPO: docker.io/postfinance | ||
- run: ko publish cmd/approverd/main.go | ||
- run: | | ||
ko publish cmd/kubelet-csr-approver/main.go --base-import-paths |
File renamed without changes.