2019-12-01 16:06:16 +00:00
|
|
|
name: Run Tests
|
2019-12-01 07:41:49 +00:00
|
|
|
|
|
|
|
on:
|
2019-12-18 08:40:37 +00:00
|
|
|
push:
|
|
|
|
branches:
|
2019-12-25 17:03:27 +00:00
|
|
|
- master
|
2019-12-19 02:11:43 +00:00
|
|
|
- v1
|
2019-12-01 07:41:49 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2019-12-05 17:47:53 +00:00
|
|
|
- master
|
|
|
|
- v1
|
2019-12-01 07:41:49 +00:00
|
|
|
|
|
|
|
jobs:
|
2019-12-25 17:10:48 +00:00
|
|
|
|
2019-12-01 15:44:37 +00:00
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2019-12-06 05:09:25 +00:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2020-03-09 08:05:04 +00:00
|
|
|
go: [1.12, 1.13, 1.14]
|
2019-12-01 16:06:16 +00:00
|
|
|
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
|
2019-12-01 15:44:37 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2019-12-01 07:41:49 +00:00
|
|
|
steps:
|
2019-12-01 15:44:37 +00:00
|
|
|
- name: Set up Go ${{ matrix.go }}
|
2019-12-01 07:45:16 +00:00
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
2019-12-01 15:44:37 +00:00
|
|
|
go-version: ${{ matrix.go }}
|
2019-12-01 07:45:16 +00:00
|
|
|
|
2019-12-06 10:54:53 +00:00
|
|
|
- name: Set GOPATH, PATH and ENV
|
2019-12-01 15:55:06 +00:00
|
|
|
run: |
|
2019-12-06 07:21:15 +00:00
|
|
|
echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)"
|
2019-12-06 10:54:53 +00:00
|
|
|
echo "::set-env name=GO111MODULE::on"
|
2019-12-06 10:56:34 +00:00
|
|
|
echo "::set-env name=GOPROXY::https://proxy.golang.org"
|
2019-12-06 07:21:15 +00:00
|
|
|
echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin"
|
2019-12-01 15:55:06 +00:00
|
|
|
shell: bash
|
|
|
|
|
2019-12-01 07:45:16 +00:00
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
with:
|
2019-12-01 15:44:37 +00:00
|
|
|
ref: ${{ github.ref }}
|
2019-12-01 07:45:16 +00:00
|
|
|
|
2020-01-25 17:54:15 +00:00
|
|
|
- name: GOFMT Check
|
2020-03-09 08:05:04 +00:00
|
|
|
if: matrix.go == 1.14 && matrix.os == 'ubuntu-latest'
|
2020-01-26 12:12:27 +00:00
|
|
|
run: test -z $(gofmt -l .)
|
2020-01-25 17:54:15 +00:00
|
|
|
|
2020-02-29 07:36:34 +00:00
|
|
|
- name: vet
|
|
|
|
run: go run internal/build/build.go vet
|
|
|
|
|
|
|
|
- name: test
|
|
|
|
run: go run internal/build/build.go test
|
|
|
|
|
|
|
|
- name: check-binary-size
|
|
|
|
run: go run internal/build/build.go check-binary-size
|
2019-12-19 02:09:40 +00:00
|
|
|
|
2019-12-25 17:10:48 +00:00
|
|
|
- name: Upload coverage to Codecov
|
2020-03-09 08:05:04 +00:00
|
|
|
if: success() && matrix.go == 1.14 && matrix.os == 'ubuntu-latest'
|
2019-12-25 17:10:48 +00:00
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
token: 0a8cc73b-bb7c-480b-8626-38a461643761
|
|
|
|
fail_ci_if_error: true
|
|
|
|
|
|
|
|
test-docs:
|
|
|
|
name: test-docs
|
2020-01-14 06:13:41 +00:00
|
|
|
runs-on: ubuntu-latest
|
2019-12-25 17:10:48 +00:00
|
|
|
steps:
|
2020-03-09 08:05:04 +00:00
|
|
|
- name: Set up Go 1.14
|
2019-12-25 17:10:48 +00:00
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
2020-03-09 08:05:04 +00:00
|
|
|
go-version: 1.14
|
2019-12-25 17:10:48 +00:00
|
|
|
|
2020-01-13 13:32:13 +00:00
|
|
|
- name: Use Node.js 12.x
|
2020-01-13 05:27:42 +00:00
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
2020-01-13 13:32:13 +00:00
|
|
|
node-version: 12.x
|
2020-01-13 05:26:43 +00:00
|
|
|
|
2020-01-13 16:41:38 +00:00
|
|
|
- name: Set GOPATH, PATH and ENV
|
2019-12-19 02:09:40 +00:00
|
|
|
run: |
|
2019-12-25 17:10:48 +00:00
|
|
|
echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)"
|
|
|
|
echo "::set-env name=GO111MODULE::on"
|
|
|
|
echo "::set-env name=GOPROXY::https://proxy.golang.org"
|
|
|
|
echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin"
|
|
|
|
shell: bash
|
2019-12-05 17:44:25 +00:00
|
|
|
|
2019-12-25 17:10:48 +00:00
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v1
|
|
|
|
with:
|
|
|
|
ref: ${{ github.ref }}
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
2019-12-06 08:34:12 +00:00
|
|
|
run: |
|
2019-12-25 17:10:48 +00:00
|
|
|
mkdir -p $GOPATH/bin
|
|
|
|
curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-$(go env GOOS)-amd64-v1.2.14"
|
|
|
|
chmod +x $GOPATH/bin/gfmrun
|
2020-01-13 13:29:36 +00:00
|
|
|
npm install -g markdown-toc@1.2.0
|
2019-12-06 08:34:12 +00:00
|
|
|
|
2019-12-25 17:10:48 +00:00
|
|
|
- name: Run Tests (v1)
|
|
|
|
if: contains(github.base_ref, 'v1')
|
2019-12-06 08:34:12 +00:00
|
|
|
run: |
|
2020-02-29 07:06:39 +00:00
|
|
|
go run internal/build/build.go gfmrun docs/v1/manual.md
|
|
|
|
go run internal/build/build.go toc docs/v1/manual.md
|
2019-12-06 08:34:12 +00:00
|
|
|
|
2019-12-25 17:10:48 +00:00
|
|
|
- name: Run Tests (v2)
|
|
|
|
if: contains(github.base_ref, 'master')
|
2019-12-01 07:45:16 +00:00
|
|
|
run: |
|
2020-02-29 07:06:39 +00:00
|
|
|
go run internal/build/build.go gfmrun docs/v2/manual.md
|
|
|
|
go run internal/build/build.go toc docs/v2/manual.md
|