Skip to content

Commit

Permalink
check generated file as part of GitHub Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
honnix committed Mar 9, 2020
1 parent fd92064 commit 9dc23bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
go-version: [1.10]
steps:
- uses: actions/checkout@v1
- name: Kustomize and diff
run: DELTA_CHECK=true make kustomize
- name: Set up Go@${{ matrix.go-version }}
uses: actions/setup-go@v1
with:
Expand Down
16 changes: 16 additions & 0 deletions script/kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,19 @@ for deployment in ${DEPLOYMENT}; do
"overlays/${deployment}/flyte" \
> "${DIR}/../deployment/${deployment}/flyte_generated.yaml"
done

# This section is used by GitHub workflow to ensure that the generation step was run
if [ -n "$DELTA_CHECK" ]; then
DIRTY=$(git status --porcelain)
if [ -n "$DIRTY" ]; then
echo "FAILED: kustomize code updated without commiting generated code."
echo "Ensure make kustomize has run and all changes are committed."
DIFF=$(git diff)
echo "diff detected: $DIFF"
DIFF=$(git diff --name-only)
echo "files different: $DIFF"
exit 1
else
echo "SUCCESS: Generated code is up to date."
fi
fi

0 comments on commit 9dc23bb

Please sign in to comment.