From aa21f5542be8903fdab5e87ac35a4757bc6fac59 Mon Sep 17 00:00:00 2001 From: Andrea Panattoni Date: Thu, 30 May 2024 10:47:15 +0200 Subject: [PATCH] Add a CI step to verify `config/` folder sync Add a make rule to verify `make manifests` has been run after every change to the CRDs. Signed-off-by: Andrea Panattoni --- .github/workflows/test.yml | 10 ++++++++++ Makefile | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 910c1f18e..45cb7eac1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -74,6 +74,16 @@ jobs: - name: check go modules are up to date run: make check-deps + manifests: + name: check manifests + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: check if the config/ folder is up to date + run: make check-manifests + golangci: name: Golangci-lint runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index e6fa128ae..748a0b1b9 100644 --- a/Makefile +++ b/Makefile @@ -109,6 +109,11 @@ manifests: controller-gen $(CONTROLLER_GEN) $(CRD_OPTIONS) webhook paths="./..." output:crd:artifacts:config=$(CRD_BASES) cp ./config/crd/bases/* ./deployment/sriov-network-operator/crds/ +check-manifests: manifests + @set +e; git diff --quiet config; \ + if [ $$? -eq 1 ]; \ + then echo -e "\n`config` folder is out of date. Please run `make manifests` and commit your changes"; \ + exit 1; fi sync-manifests-%: manifests @mkdir -p manifests/$*