forked from openkruise/kruise-game
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ChrisLiu <[email protected]>
- Loading branch information
1 parent
b6f41e5
commit a182e06
Showing
3 changed files
with
143 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,107 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- release-* | ||
pull_request: {} | ||
workflow_dispatch: {} | ||
|
||
env: | ||
# Common versions | ||
GO_VERSION: '1.18' | ||
GOLANGCI_VERSION: 'v1.47' | ||
DOCKER_BUILDX_VERSION: 'v0.4.2' | ||
|
||
# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run | ||
# a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether | ||
# credentials have been provided before trying to run steps that need them. | ||
DOCKER_USR: ${{ secrets.DOCKER_USR }} | ||
AWS_USR: ${{ secrets.AWS_USR }} | ||
|
||
jobs: | ||
|
||
golangci-lint: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Cache Go Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go- | ||
- name: Code generate | ||
run: | | ||
make generate | ||
- name: Lint golang code | ||
uses: golangci/[email protected] | ||
with: | ||
version: ${{ env.GOLANGCI_VERSION }} | ||
args: --verbose | ||
skip-pkg-cache: true | ||
|
||
markdownlint-misspell-shellcheck: | ||
runs-on: ubuntu-18.04 | ||
# this image is build from Dockerfile | ||
# https://github.com/pouchcontainer/pouchlinter/blob/master/Dockerfile | ||
container: pouchcontainer/pouchlinter:v0.1.2 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Run misspell | ||
run: find ./* -name "*" | grep -v vendor | xargs misspell -error | ||
- name: Run shellcheck | ||
run: find ./ -name "*.sh" | grep -v vendor | xargs shellcheck | ||
- name: Lint markdown files | ||
run: find ./ -name "*.md" | grep -v vendor | grep -v commandline | grep -v .github | grep -v swagger | grep -v api | xargs mdl -r ~MD010,~MD013,~MD014,~MD022,~MD024,~MD029,~MD031,~MD032,~MD033,~MD036 | ||
# - name: Check markdown links | ||
# run: | | ||
# set +e | ||
# for name in $(find . -name \*.md | grep -v vendor | grep -v CHANGELOG); do | ||
# if [ -f $name ]; then | ||
# markdown-link-check -q $name -c .github/workflows/markdown-link-check.config.json; | ||
# if [ $? -ne 0 ]; then | ||
# code=1 | ||
# fi | ||
# fi | ||
# done | ||
# bash -c "exit $code"; | ||
|
||
unit-tests: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Fetch History | ||
run: git fetch --prune --unshallow | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Cache Go Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: ${{ runner.os }}-go- | ||
- name: Run Unit Tests | ||
run: | | ||
make test | ||
git status | ||
- name: Publish Unit Test Coverage | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
flags: unittests | ||
file: cover.out | ||
- name: Check diff | ||
run: '[[ -z $(git status -s) ]] || (printf "Existing modified/untracked files.\nPlease run \"make generate manifests\" and push again.\n"; exit 1)' |
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,26 @@ | ||
name: License | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release-* | ||
workflow_dispatch: {} | ||
pull_request: | ||
branches: | ||
- master | ||
- release-* | ||
|
||
jobs: | ||
license_check: | ||
runs-on: ubuntu-latest | ||
name: Check for unapproved licenses | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6 | ||
- name: Install dependencies | ||
run: gem install license_finder | ||
- name: Run tests | ||
run: license_finder --decisions_file .license/dependency_decisions.yml |
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,10 @@ | ||
{ | ||
"ignorePatterns": [ | ||
{ | ||
"pattern": "^https://codecov.io" | ||
}, | ||
{ | ||
"pattern": "^https://openkruise.io" | ||
} | ||
] | ||
} |