Refactor qrm state #4697
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: {} | |
workflow_dispatch: {} | |
jobs: | |
fmt: | |
name: Format | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- name: Check Go modules | |
run: | | |
go mod tidy && git add go.* && | |
git diff --cached --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1); | |
- name: Verify gofumpt | |
run: | | |
echo "refer to https://github.com/mvdan/gofumpt for detailed info" && | |
GO111MODULE=on go install mvdan.cc/gofumpt@v0.4.0 && | |
make fmt-strict && git add pkg cmd && | |
git diff --cached --exit-code || (echo 'Please run "make fmt-strict" to verify fmt' && exit 1); | |
vet: | |
name: Vet | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- name: Verify govet | |
run: | | |
make vet && git add pkg cmd && | |
git diff --cached --exit-code || (echo 'Please run "make vet" to verify govet' && exit 1); | |
lint: | |
name: Lint | |
runs-on: vci-self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
args: --verbose --out-${NO_FUTURE}format colored-line-number --config .golangci.yml | |
version: v1.52.2 | |
skip-cache: true | |
build: | |
name: Build | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: Build | |
run: make all-binaries | |
parallel: | |
name: Parallel | |
runs-on: vci-self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
cache: false | |
- name: Check parallel | |
run: | | |
echo "refer to https://github.com/kunwardeep/paralleltest for detailed info" && | |
GO111MODULE=on go install github.com/kunwardeep/paralleltest@v1.0.10 && | |
paralleltest `go list ./... | grep -E -v "pkg/scheduler|pkg/controller/resource-recommend|pkg/util/resource-recommend"` | |
unit-test: | |
name: Unit Test | |
runs-on: vke-self-hosted | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
- name: Run unit tests | |
run: | | |
go install github.com/jstemmer/go-junit-report/v2@latest && | |
sudo make test 2>&1 | go-junit-report -parser gojson --set-exit-code -iocopy -out report.xml | |
- name: Test summary | |
uses: test-summary/action@v2 | |
with: | |
paths: report.xml | |
if: always() | |
- name: Check the number of changed lines | |
run: | | |
LINES_ADDED=$(git diff --numstat ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} pkg/ | awk '{ add += $1 } END { printf add }') | |
echo "lines added: $LINES_ADDED" | |
if [[ $LINES_ADDED -lt 10 ]]; then | |
echo "NEED_TO_CHECK=false" >> $GITHUB_ENV | |
else | |
echo "NEED_TO_CHECK=true" >> $GITHUB_ENV | |
fi | |
- name: Upload coverage to Codecov | |
if: ${{ (env.NEED_TO_CHECK == 'true') || (github.event_name != 'pull_request') }} | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: 411bcf91-fb5f-444e-ad16-8380573a8c81 | |
with: | |
flags: unittest | |
file: coverage.txt | |
fail_ci_if_error: true | |
verbose: true | |
license: | |
name: License | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check license header | |
run: | | |
make license && git add pkg cmd && | |
git diff --cached --exit-code || (echo 'Please run "make license" to add license headers' && exit 1); |