-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Scott Nichols
committed
Apr 17, 2020
1 parent
8c43b9b
commit d3f19bb
Showing
5 changed files
with
272 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,42 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build | ||
strategy: | ||
matrix: | ||
go-version: [1.13.x, 1.14.x] | ||
platform: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
env: | ||
GOPATH: ${{ github.workspace }} | ||
GO111MODULE: off | ||
|
||
steps: | ||
|
||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
||
- name: Check out code onto GOPATH | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: ./src/github.com/${{ github.repository }} | ||
|
||
- name: Vet | ||
run: go vet github.com/${{ github.repository }}/... | ||
|
||
- name: Build | ||
run: go build -v github.com/${{ github.repository }}/... |
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,53 @@ | ||
name: Code Style | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
GOPATH: ${{ github.workspace }} | ||
GO111MODULE: off | ||
|
||
steps: | ||
|
||
- name: Set up Go 1.13.x | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.x | ||
id: go | ||
|
||
- name: Check out code onto GOPATH | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: ./src/github.com/${{ github.repository }} | ||
|
||
# TODO: add pretter step | ||
|
||
- name: Go Format | ||
shell: bash | ||
run: | | ||
pushd ./src/github.com/${{ github.repository }} | ||
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print) | ||
popd | ||
- name: Verify | ||
shell: bash | ||
run: | | ||
pushd ./src/github.com/${{ github.repository }} | ||
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." | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
|
||
test: | ||
name: Test | ||
strategy: | ||
matrix: | ||
go-version: [1.13.x, 1.14.x] | ||
platform: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
env: | ||
GOPATH: ${{ github.workspace }} | ||
GO111MODULE: off | ||
|
||
steps: | ||
|
||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
||
- name: Check out code onto GOPATH | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: ./src/github.com/${{ github.repository }} | ||
|
||
- name: Test | ||
run: go test -race github.com/${{ github.repository }}/... |
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,71 @@ | ||
name: Verify | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
|
||
verify: | ||
name: Verify Deps and Codegen | ||
strategy: | ||
matrix: | ||
go-version: [1.13.x, 1.14.x] | ||
platform: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
env: | ||
GOPATH: ${{ github.workspace }} | ||
GO111MODULE: off | ||
|
||
steps: | ||
|
||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
||
- name: Add GOPATH/bin to PATH | ||
shell: bash | ||
run: | | ||
echo "::set-env name=GOPATH::$(go env GOPATH)" | ||
echo "::add-path::$(go env GOPATH)/bin" | ||
- name: Install Dependencies | ||
run: | | ||
go get github.com/golang/dep/cmd/dep | ||
go get github.com/google/ko/cmd/ko | ||
go get github.com/google/licenseclassifier | ||
go get github.com/google/go-licenses | ||
go get knative.dev/test-infra/tools/dep-collector | ||
- name: Check out code onto GOPATH | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
path: ./src/github.com/${{ github.repository }} | ||
|
||
- name: Update Codegen | ||
shell: bash | ||
run: | | ||
pushd ./src/github.com/${{ github.repository }} | ||
./hack/update-codegen.sh | ||
popd | ||
- name: Verify | ||
shell: bash | ||
run: | | ||
pushd ./src/github.com/${{ github.repository }} | ||
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 |
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,67 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
|
||
ko-resolve: | ||
name: Release ko artifact | ||
runs-on: ubuntu-latest | ||
env: | ||
GOPATH: ${{ github.workspace }} | ||
GO111MODULE: off | ||
KO_DOCKER_REPO: docker.io/n3wscott | ||
|
||
steps: | ||
- name: Set up Go 1.13.x | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13.x | ||
|
||
- name: Add GOPATH/bin to PATH | ||
shell: bash | ||
run: | | ||
echo "::set-env name=GOPATH::$(go env GOPATH)" | ||
echo "::add-path::$(go env GOPATH)/bin" | ||
- name: Setup ko | ||
run: | | ||
GO111MODULE=on go get github.com/google/ko/cmd/ko | ||
docker login -u n3wscott -p ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Check out code onto GOPATH | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: ./src/github.com/${{ github.repository }} | ||
|
||
- name: Build and Publish images, Produce release artifact. | ||
working-directory: ./src/github.com/${{ github.repository }} | ||
run: | | ||
ko resolve --tags $(basename "${{ github.ref }}" ) -BRf config/ > release.yaml | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: true | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./src/github.com/${{ github.repository }}/release.yaml | ||
asset_name: release.yaml | ||
asset_content_type: text/plain |