ci: Check if working tree is dirty

- run unit tests in a dedicated CI step
- check if working tree is dirty and fail CI build
This commit is contained in:
stefanprodan 2020-04-13 19:57:47 +03:00
parent 0e4e3cd660
commit 3bd15423e4
2 changed files with 8 additions and 2 deletions

View File

@ -29,7 +29,13 @@ jobs:
uses: ./.github/actions/kustomize
- name: Setup Kubebuilder
uses: ./.github/actions/kubebuilder
- name: Run tests and build image
- name: Run tests
run: make test
env:
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
- name: Check if working tree is dirty
run: git diff --quiet || echo 'run make test and commit changes' && exit 1
- name: Build container image
run: make docker-build IMG=test/source-controller:latest
env:
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin

View File

@ -62,7 +62,7 @@ generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
# Build the docker image
docker-build: test
docker-build:
docker build . -t ${IMG}
# Push the docker image