[HWORKS-1846] Cherry-pick tools and chat template #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
- 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 | |
make manifests | |
- 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 ./config ./charts)" ]; then | |
echo "${{ github.repository }} up to date." | |
else | |
echo "Found diffs in: $(git diff-index --name-only HEAD -- ./pkg ./python ./charts)" | |
for x in $(git diff-index --name-only HEAD -- ./pkg ./python ./charts); 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 |