add github action ci check (#5)
* add github action ci check * fix gofmt error Co-authored-by: chupei <chupei@qiniu.com>
This commit is contained in:
parent
3fe54bc470
commit
6591292580
40
.github/workflows/style_check.yml
vendored
Normal file
40
.github/workflows/style_check.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
name: style-check
|
||||
on:
|
||||
# Trigger the workflow on push or pull request,
|
||||
# but only for the master branch
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
jobs:
|
||||
run:
|
||||
name: go style check
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.13.x, 1.14.x]
|
||||
platform: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
# This step checks out a copy of your repository.
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Go vet check
|
||||
run: |
|
||||
go vet ./...
|
||||
- name: Gofmt check
|
||||
run: |
|
||||
diff=`find . -name "*.go" | xargs gofmt -s -d`
|
||||
if [[ -n "${diff}" ]]; then
|
||||
echo "Gofmt check failed :"
|
||||
echo "${diff}"
|
||||
echo "Please run this command to fix: [find . -name "*.go" | xargs gofmt -s -w]"
|
||||
exit 1
|
||||
fi
|
31
.github/workflows/ut_check.yml
vendored
Normal file
31
.github/workflows/ut_check.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: ut-check
|
||||
on:
|
||||
# Trigger the workflow on push or pull request,
|
||||
# but only for the master branch
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
jobs:
|
||||
run:
|
||||
name: go test
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.13.x, 1.14.x]
|
||||
platform: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
# This step checks out a copy of your repository.
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Go test
|
||||
run: |
|
||||
go test ./...
|
Loading…
Reference in New Issue
Block a user