forked from kubernetes-sigs/work-api
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
36165be
commit 77c1551
Showing
18 changed files
with
458 additions
and
89 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,33 @@ | ||
|
||
### Description of your changes | ||
|
||
<!-- | ||
Briefly describe what this pull request does. We love pull requests that have a clear purpose. If yours fix an issue, | ||
please uncomment the below line to indicate which issue your PR fixes, for example | ||
"Fixes #500": | ||
--> | ||
|
||
Fixes # | ||
|
||
I have: | ||
|
||
- [ ] Read and followed Caravel's [Code of conduct](https://github.com/Azure/k8s-work-api/blob/master/code-of-conduct.md). | ||
- [ ] Run `make reviewable` to ensure this PR is ready for review. | ||
|
||
### How has this code been tested | ||
|
||
<!-- | ||
Before reviewers can be confident in the correctness of this pull request, it needs to tested and shown to be correct. | ||
Briefly describe the testing that has already been done or which is planned for this change. | ||
--> | ||
|
||
|
||
### Special notes for your reviewer | ||
|
||
<!-- | ||
Be sure to direct your reviewers' attention to anything that needs special consideration. | ||
--> |
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,9 @@ | ||
{ | ||
"LABEL": { | ||
"name": "title-needs-formatting", | ||
"color": "EEEEEE" | ||
}, | ||
"CHECKS": { | ||
"prefixes": [ "[WIP] ", "Feat: ", "Test: ", "Fix: ", "Docs: ", "Style: ", "Interface: ", "Util: ", "Chore: ", "CI: ", "Perf: ", "Refactor: ", "Revert: " ] | ||
} | ||
} |
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,62 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
# Publish semver tags as releases. | ||
tags: [ 'v*.*.*' ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Workaround: https://github.com/docker/build-push-action/issues/461 | ||
- name: Setup Docker buildx | ||
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | ||
|
||
# Login against the container registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract image metadata | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
|
||
# Build and push container image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push image | ||
id: build-and-push | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
@@ -1,29 +1,35 @@ | ||
name: CI Workflow | ||
on: | ||
# Run this workflow every time a new commit pushed to upstream/fork repository. | ||
# Run workflow on fork repository will help contributors find and resolve issues before sending a PR. | ||
push: | ||
pull_request: | ||
branches: | ||
- master | ||
- release-* | ||
workflow_dispatch: {} | ||
|
||
defaults: | ||
run: | ||
working-directory: go/src/sigs.k8s.io/work-api | ||
|
||
env: | ||
# Common versions | ||
GO_VERSION: 1.17.x | ||
GO_PATH: '/home/runner/work/work-api/work-api/go' | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
detect-noop: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
noop: ${{ steps.noop.outputs.should_skip }} | ||
steps: | ||
- uses: actions/setup-go@v2 | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
- name: Detect No-op Changes | ||
id: noop | ||
uses: fkirc/[email protected] | ||
with: | ||
# the version of golangci-lint. | ||
version: v1.45.2 | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]' | ||
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | ||
concurrent_skipping: false | ||
|
||
# show only new issues if it's a pull request. | ||
only-new-issues: false | ||
args: --timeout 3m0s | ||
verify: | ||
name: verify | ||
runs-on: ubuntu-latest | ||
|
@@ -33,32 +39,52 @@ jobs: | |
with: | ||
fetch-depth: 1 | ||
path: go/src/sigs.k8s.io/work-api | ||
|
||
- name: install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.x | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: verify | ||
run: hack/verify-all.sh -v | ||
env: | ||
GOPATH: '/home/runner/work/work-api/work-api/go' | ||
GOPATH: ${{ env.GO_PATH }} | ||
|
||
test: | ||
name: unit test | ||
needs: verify | ||
runs-on: ubuntu-latest | ||
if: needs.detect-noop.outputs.noop != 'true' | ||
steps: | ||
- name: checkout code | ||
- name: Checkout source | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
path: go/src/sigs.k8s.io/work-api | ||
- name: install Go | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.x | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Get dependencies | ||
run: go get -v -t -d ./... | ||
|
||
- name: make test | ||
run: make test | ||
env: | ||
GOPATH: '/home/runner/work/work-api/work-api/go' | ||
GOPATH: ${{ env.GO_PATH }} | ||
|
||
- name: Upload report | ||
uses: codecov/[email protected] | ||
with: | ||
## Repository upload token - get it from codecov.io. Required only for private repositories | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
## Comma-separated list of files to upload | ||
files: ./cover.out | ||
flags: ci-tests | ||
name: codecov-umbrella | ||
|
||
e2e: | ||
name: e2e | ||
runs-on: ubuntu-latest | ||
|
@@ -71,7 +97,7 @@ jobs: | |
- name: install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16.x | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: images | ||
run: make docker-build | ||
env: | ||
|
@@ -87,4 +113,4 @@ jobs: | |
run: | | ||
make test-e2e | ||
env: | ||
KUBECONFIG: /home/runner/.kube/config | ||
KUBECONFIG: /home/runner/.kube/config |
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,85 @@ | ||
name: Go | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- '**' | ||
workflow_dispatch: {} | ||
|
||
env: | ||
# Common versions | ||
GO_VERSION: '1.17.x' | ||
GOLANGCI_VERSION: 'v1.46' | ||
|
||
jobs: | ||
|
||
detect-noop: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
noop: ${{ steps.noop.outputs.should_skip }} | ||
steps: | ||
- name: Detect No-op Changes | ||
id: noop | ||
uses: fkirc/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]' | ||
do_not_skip: '["workflow_dispatch", "schedule", "push"]' | ||
concurrent_skipping: false | ||
|
||
staticcheck: | ||
runs-on: ubuntu-latest | ||
needs: detect-noop | ||
if: needs.detect-noop.outputs.noop != 'true' | ||
|
||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Cache Go Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .work/pkg | ||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-pkg- | ||
|
||
- name: Install StaticCheck | ||
run: GO111MODULE=auto go get honnef.co/go/tools/cmd/[email protected] | ||
|
||
- name: Static Check | ||
run: staticcheck ./... | ||
|
||
lint: | ||
runs-on: ubuntu-20.04 | ||
needs: detect-noop | ||
if: needs.detect-noop.outputs.noop != 'true' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Cache Go Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .work/pkg | ||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-pkg- | ||
|
||
# This action uses its own setup-go, which always seems to use the latest | ||
# stable version of Go. We could run 'make lint' to ensure our desired Go | ||
# version, but we prefer this action because it leaves 'annotations' (i.e. | ||
# it comments on PRs to point out linter violations). | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: ${{ env.GOLANGCI_VERSION }} | ||
timeout-minutes: 3 |
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,19 @@ | ||
name: PR Lint | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- labeled | ||
- unlabeled | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: thehanimo/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
pass_on_octokit_error: true | ||
configuration_path: ".github/pr-title-config.json" |
Oops, something went wrong.