Skip to content

Commit

Permalink
ci: add manifests validation in pull request
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinandan Purkait <purkaitabhinandan@gmail.com>
  • Loading branch information
Abhinandan-Purkait committed Jul 29, 2024
1 parent 5b13ad9 commit e9880a8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- uses: rrbutani/use-nix-shell-action@v1.1.0
with:
file: shell.nix

- name: Check if the chart follows a valid semver version
run: |
branch_name="${{ github.event.pull_request.base.ref }}"
Expand All @@ -42,8 +43,30 @@ jobs:
run: |
ct lint --config ct.yaml
validate_codegen:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go 1.19
uses: actions/setup-go@v4
with:
go-version: 1.19.9
cache: false

- name: Helm tool installer
uses: Azure/setup-helm@v4.2.0

- name: Verify all manifests
run: |
make verify-manifests || exit 1;
unit-tests:
runs-on: ubuntu-latest
needs: ["validate_codegen"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,14 @@ golint:
@echo "--------------------------------"
@echo ""

.PHONY: verify-manifests
verify-manifests: bootstrap manifests
@./buildscripts/check-diff.sh
@echo "Completed verify-codegen no changes detected !!"

.PHONY: verify-kubegen
verify-kubegen: bootstrap kubegen
@./buildscripts/check-diff.sh
@echo "Completed verify-codegen no changes detected !!"

include Makefile.buildx.mk
7 changes: 7 additions & 0 deletions buildscripts/check-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e

if [[ `git diff --shortstat | wc -l | tr -d ' '` != 0 ]]; then
echo "Some files got changed after (make kubegen) and (make manifests) \n";
exit 1;
fi
1 change: 0 additions & 1 deletion buildscripts/push
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,3 @@ then
# Push COMMIT tagged image - :COMMIT
TagAndPushImage "${DIMAGE}" "${COMMIT}"
fi;

0 comments on commit e9880a8

Please sign in to comment.