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
|
2022-04-21 19:18:35 +00:00
|
|
|
tags:
|
|
|
|
- v2.*
|
2019-12-01 07:41:49 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2019-12-05 17:47:53 +00:00
|
|
|
- master
|
2019-12-01 07:41:49 +00:00
|
|
|
|
|
|
|
jobs:
|
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]
|
2022-04-21 19:18:35 +00:00
|
|
|
go: [1.16.x, 1.17.x, 1.18.x]
|
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 }}
|
2022-04-21 19:18:35 +00:00
|
|
|
uses: actions/setup-go@v3
|
2019-12-01 07:45:16 +00:00
|
|
|
with:
|
2019-12-01 15:44:37 +00:00
|
|
|
go-version: ${{ matrix.go }}
|
2019-12-01 07:45:16 +00:00
|
|
|
|
2022-04-21 19:18:35 +00:00
|
|
|
- name: Set PATH
|
|
|
|
run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"
|
2019-12-01 15:55:06 +00:00
|
|
|
|
2019-12-01 07:45:16 +00:00
|
|
|
- name: Checkout Code
|
2022-04-21 19:18:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2019-12-01 07:45:16 +00:00
|
|
|
|
2020-01-25 17:54:15 +00:00
|
|
|
- name: GOFMT Check
|
2022-04-21 19:18:35 +00:00
|
|
|
if: matrix.go == '1.17.x' && 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
|
2022-04-21 19:18:35 +00:00
|
|
|
if: success() && matrix.go == '1.17.x' && matrix.os == 'ubuntu-latest'
|
|
|
|
uses: codecov/codecov-action@v2
|
2019-12-25 17:10:48 +00:00
|
|
|
with:
|
|
|
|
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:
|
2021-04-24 16:22:33 +00:00
|
|
|
- name: Set up Go
|
2022-04-21 19:18:35 +00:00
|
|
|
uses: actions/setup-go@v3
|
2019-12-25 17:10:48 +00:00
|
|
|
with:
|
2022-04-21 19:18:35 +00:00
|
|
|
go-version: 1.18.x
|
2019-12-25 17:10:48 +00:00
|
|
|
|
2022-04-21 19:18:35 +00:00
|
|
|
- name: Use Node.js 16
|
|
|
|
uses: actions/setup-node@v3
|
2020-01-13 05:27:42 +00:00
|
|
|
with:
|
2022-04-21 19:18:35 +00:00
|
|
|
node-version: '16'
|
2020-01-13 05:26:43 +00:00
|
|
|
|
2022-04-21 19:18:35 +00:00
|
|
|
- name: Set PATH
|
|
|
|
run: echo "${GITHUB_WORKSPACE}/.local/bin" >>"${GITHUB_PATH}"
|
2019-12-05 17:44:25 +00:00
|
|
|
|
2019-12-25 17:10:48 +00:00
|
|
|
- name: Checkout Code
|
2022-04-21 19:18:35 +00:00
|
|
|
uses: actions/checkout@v3
|
2019-12-25 17:10:48 +00:00
|
|
|
|
|
|
|
- name: Install Dependencies
|
2022-04-21 19:18:35 +00:00
|
|
|
run:
|
2022-04-21 19:24:14 +00:00
|
|
|
mkdir -p "${GITHUB_WORKSPACE}/.local/bin" &&
|
|
|
|
curl -fsSL -o "${GITHUB_WORKSPACE}/.local/bin/gfmrun" "https://github.com/urfave/gfmrun/releases/download/v1.3.0/gfmrun-$(go env GOOS)-$(go env GOARCH)-v1.3.0" &&
|
|
|
|
chmod +x "${GITHUB_WORKSPACE}/.local/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
|
|
|
|
2022-04-21 19:18:35 +00:00
|
|
|
- name: gfmrun
|
|
|
|
run: go run internal/build/build.go gfmrun docs/v2/manual.md
|
|
|
|
|
|
|
|
- name: toc
|
|
|
|
run: go run internal/build/build.go toc docs/v2/manual.md
|