-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update codegen step to use vendored codegen tools (#795)
- Loading branch information
Showing
5 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Copyright 2020 The Knative Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This file is automagically synced here from github.com/knative-sandbox/.github | ||
# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. | ||
|
||
name: Verify | ||
|
||
on: | ||
pull_request: | ||
branches: [ 'master', 'release-*' ] | ||
|
||
jobs: | ||
|
||
verify: | ||
name: Verify Deps and Codegen | ||
strategy: | ||
matrix: | ||
go-version: [1.15.x] | ||
platform: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
env: | ||
GOPATH: ${{ github.workspace }} | ||
|
||
steps: | ||
|
||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
||
- name: Install Dependencies | ||
run: | | ||
go get github.com/google/ko/cmd/ko | ||
go get github.com/google/go-licenses | ||
- name: Check out code onto GOPATH | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ./src/knative.dev/${{ github.event.repository.name }} | ||
|
||
- name: Update Codegen | ||
shell: bash | ||
run: | | ||
pushd ./src/knative.dev/${{ github.event.repository.name }} | ||
[[ ! -f hack/update-codegen.sh ]] || ./hack/update-codegen.sh | ||
popd | ||
- name: Verify | ||
shell: bash | ||
run: | | ||
# 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 | ||
function urlencode() { | ||
sed ':begin;$!N;s/\n/%0A/;tbegin' | ||
} | ||
pushd ./src/knative.dev/${{ github.event.repository.name }} | ||
if [[ -z "$(git status --porcelain)" ]]; then | ||
echo "${{ github.repository }} up to date." | ||
else | ||
# Print it both ways because sometimes we haven't modified the file (e.g. zz_generated), | ||
# and sometimes we have (e.g. configmap checksum). | ||
echo "Found diffs in: $(git diff-index --name-only HEAD --)" | ||
for x in $(git diff-index --name-only HEAD --); do | ||
echo "::error file=$x::Please run ./hack/update-codegen.sh.%0A$(git diff $x | urlencode)" | ||
done | ||
echo "${{ github.repository }} is out of date. Please run hack/update-codegen.sh" | ||
exit 1 | ||
fi | ||
popd |
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
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
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
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