-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[master] Update GitHub Actions (#3972)
Copied from `https://github.com/knative/.github/tree/master/workflow-templates`. /assign grantr matzew n3wscott /cc grantr matzew n3wscott
- Loading branch information
Showing
5 changed files
with
257 additions
and
0 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,49 @@ | ||
# 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. | ||
|
||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ 'master', 'release-*' ] | ||
pull_request: | ||
branches: [ 'master', 'release-*' ] | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build | ||
strategy: | ||
matrix: | ||
go-version: [1.15.x] | ||
platform: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
|
||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Vet | ||
run: go vet ./... | ||
|
||
- name: Build | ||
run: go build -v ./... |
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,46 @@ | ||
# 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. | ||
|
||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ 'master', 'release-*' ] | ||
pull_request: | ||
branches: [ 'master', 'release-*' ] | ||
|
||
jobs: | ||
|
||
test: | ||
name: Test | ||
strategy: | ||
matrix: | ||
go-version: [1.15.x] | ||
platform: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
|
||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Test | ||
run: go test -race ./... |
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,31 @@ | ||
name: 'Close stale' | ||
on: | ||
schedule: | ||
- cron: '* * * * *' | ||
|
||
jobs: | ||
stale: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: 'actions/stale@v3' | ||
with: | ||
repo-token: '${{ secrets.GITHUB_TOKEN }}' # No need to setup | ||
|
||
stale-issue-message: |- | ||
This issue is stale because it has been open for 90 days with no | ||
activity. It will automatically close after 30 more days of | ||
inactivity. Reopen the issue with `/reopen`. Mark the issue as | ||
fresh by adding the comment `/remove-lifecycle stale`. | ||
stale-issue-label: 'lifecycle/stale' | ||
exempt-issue-labels: 'lifecycle/frozen' | ||
|
||
stale-pr-message: |- | ||
This Pull Request is stale because it has been open for 90 days with | ||
no activity. It will automatically close after 30 more days of | ||
inactivity. Reopen with `/reopen`. Mark as fresh by adding the | ||
comment `/remove-lifecycle stale`. | ||
stale-pr-label: 'lifecycle/stale' | ||
exempt-pr-labels: 'lifecycle/frozen' | ||
|
||
days-before-stale: 90 | ||
days-before-close: 30 |
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,57 @@ | ||
# 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. | ||
|
||
name: Code Style | ||
|
||
on: | ||
push: | ||
branches: [ 'master', 'release-*' ] | ||
pull_request: | ||
branches: [ 'master', 'release-*' ] | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Set up Go 1.15.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15.x | ||
id: go | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
# TODO: add prettier step | ||
# TODO: add goimports step | ||
|
||
- name: Go Format | ||
shell: bash | ||
run: | | ||
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print) | ||
- name: Verify | ||
shell: bash | ||
run: | | ||
if [[ $(git diff-index --name-only HEAD --) ]]; then | ||
echo "Found diffs in:" | ||
git diff-index --name-only HEAD -- | ||
echo "${{ github.repository }} is out of style. Please run go fmt." | ||
exit 1 | ||
fi | ||
echo "${{ github.repository }} is formatted correctly." |
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,74 @@ | ||
# 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. | ||
|
||
name: Verify | ||
|
||
on: | ||
push: | ||
branches: [ 'master', 'release-*' ] | ||
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 }} | ||
./hack/update-codegen.sh | ||
popd | ||
- name: Verify | ||
shell: bash | ||
run: | | ||
pushd ./src/knative.dev/${{ github.event.repository.name }} | ||
if [[ -z "$(git status --porcelain)" ]]; then | ||
echo "${{ github.repository }} up to date." | ||
else | ||
repoDiff=$(git diff-index --name-only HEAD --) | ||
echo "Found diffs in: $repoDiff" | ||
echo "${{ github.repository }} is out of date. Please run hack/update-codegen.sh" | ||
exit 1 | ||
fi | ||
popd |