Skip to content

Merge pull request #712 from luomingmeng/dev/fix-no-linux-build #146

Merge pull request #712 from luomingmeng/dev/fix-no-linux-build

Merge pull request #712 from luomingmeng/dev/fix-no-linux-build #146

Workflow file for this run

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/[email protected] &&
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/[email protected] &&
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: Coverage
run: sudo make test
- 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);