Skip to content

Commit 3bd1542

Browse files
committed
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
1 parent 0e4e3cd commit 3bd1542

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.github/workflows/e2e.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ jobs:
2929
uses: ./.github/actions/kustomize
3030
- name: Setup Kubebuilder
3131
uses: ./.github/actions/kubebuilder
32-
- name: Run tests and build image
32+
- name: Run tests
33+
run: make test
34+
env:
35+
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
36+
- name: Check if working tree is dirty
37+
run: git diff --quiet || echo 'run make test and commit changes' && exit 1
38+
- name: Build container image
3339
run: make docker-build IMG=test/source-controller:latest
3440
env:
3541
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ generate: controller-gen
6262
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
6363

6464
# Build the docker image
65-
docker-build: test
65+
docker-build:
6666
docker build . -t ${IMG}
6767

6868
# Push the docker image

0 commit comments

Comments
 (0)