Skip to content

ci: publish helm chart to ghcr #1

ci: publish helm chart to ghcr

ci: publish helm chart to ghcr #1

name: "Verify Generated Code"
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
verify-codegen:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21
- name: Checkout source code
uses: actions/checkout@v3
- name: Install dependencies
run: |
go mod download
- name: Update Codegen
shell: bash
run: |
GOPATH=$(go env GOPATH)
KSERVE_PATH=$GOPATH/src/github.com/kserve/kserve
echo "KSERVE_PATH=$KSERVE_PATH" >> "$GITHUB_ENV"
mkdir -p $KSERVE_PATH
cp -a . $KSERVE_PATH
cd $KSERVE_PATH
make generate
- name: Verify
shell: bash
run: |
cd $KSERVE_PATH
# From: https://backreference.org/2009/12/23/how-to-match-newlines-in-sed/
# This is to leverage this workaround:
# https://github.com/actions/toolkit/issues/193#issuecomment-605394935
urlencode() {
sed ':begin;$!N;s/\n/%0A/;tbegin'
}
# When running make generate, it introduces some lint errors which is fixed manually.
# Reset these files to avoid false triggers due to those changes.
git checkout -- python/kserve/test/__init__.py python/kserve/kserve/api_client.py
if [ -z "$(git status --porcelain ./pkg ./python)" ]; then
echo "${{ github.repository }} up to date."
else
echo "Found diffs in: $(git diff-index --name-only HEAD -- ./pkg ./python)"
for x in $(git diff-index --name-only HEAD -- ./pkg ./python); do
echo "::error file=$x::Please run make generate.%0A$(git diff $x | urlencode)"
done
echo "${{ github.repository }} is out of date. Please run make generate"
exit 1
fi