2019-12-01 16:06:16 +00:00
|
|
|
name: Run Tests
|
2019-12-01 07:41:49 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
2019-12-05 17:47:53 +00:00
|
|
|
- master
|
|
|
|
- v1
|
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]
|
2019-12-01 15:44:37 +00:00
|
|
|
go: [1.11, 1.12, 1.13]
|
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
|
|
|
|
2019-12-07 07:04:48 +00:00
|
|
|
- name: Install Dependencies (Linux / MacOS)
|
|
|
|
if: matrix.os != 'windows-latest'
|
2019-12-01 07:45:16 +00:00
|
|
|
run: |
|
2019-12-05 17:57:48 +00:00
|
|
|
mkdir -p $GOPATH/bin
|
2019-12-07 07:04:48 +00:00
|
|
|
curl -L -o $GOPATH/bin/gfmrun "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-$(go env GOOS)-amd64-v1.2.14"
|
2019-12-06 04:48:30 +00:00
|
|
|
chmod +x $GOPATH/bin/gfmrun
|
|
|
|
npm install markdown-toc
|
2019-12-06 04:42:58 +00:00
|
|
|
|
2019-12-06 05:09:25 +00:00
|
|
|
- name: Install Dependencies (Windows)
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
run: |
|
2019-12-06 07:21:15 +00:00
|
|
|
curl -L -o gfmrun.exe "https://github.com/urfave/gfmrun/releases/download/v1.2.14/gfmrun-windows-amd64-v1.2.14.exe"
|
2019-12-06 05:09:25 +00:00
|
|
|
npm install markdown-toc
|
|
|
|
|
2019-12-07 07:04:48 +00:00
|
|
|
- name: Run Tests (v1) (Linux / MacOS)
|
2019-12-06 08:34:12 +00:00
|
|
|
if: contains(github.base_ref, 'v1') && matrix.os != 'windows-latest'
|
2019-12-05 17:44:25 +00:00
|
|
|
run: |
|
|
|
|
go run build.go vet
|
|
|
|
go run build.go test
|
|
|
|
go run build.go gfmrun docs/v1/manual.md
|
|
|
|
go run build.go toc docs/v1/manual.md
|
|
|
|
|
2019-12-06 08:34:12 +00:00
|
|
|
- name: Run Tests (v1) (Windows)
|
|
|
|
if: contains(github.base_ref, 'v1') && matrix.os == 'windows-latest'
|
|
|
|
run: |
|
|
|
|
go run build.go vet
|
|
|
|
go run build.go test
|
|
|
|
go run build.go gfmrun docs\v1\manual.md
|
|
|
|
go run build.go toc docs\v1\manual.md
|
|
|
|
|
2019-12-07 07:04:48 +00:00
|
|
|
- name: Run Tests (v2) (Linux / MacOS)
|
2019-12-06 08:34:12 +00:00
|
|
|
if: contains(github.base_ref, 'master') && matrix.os != 'windows-latest'
|
|
|
|
run: |
|
|
|
|
go run build.go vet
|
|
|
|
go run build.go test
|
|
|
|
go run build.go gfmrun docs/v2/manual.md
|
|
|
|
go run build.go toc docs/v2/manual.md
|
|
|
|
|
|
|
|
- name: Run Tests (v2) (Windows)
|
|
|
|
if: contains(github.base_ref, 'master') && matrix.os == 'windows-latest'
|
2019-12-01 07:45:16 +00:00
|
|
|
run: |
|
|
|
|
go run build.go vet
|
|
|
|
go run build.go test
|
|
|
|
go run build.go gfmrun docs/v2/manual.md
|
|
|
|
go run build.go toc docs/v2/manual.md
|
2019-12-01 17:29:04 +00:00
|
|
|
|
|
|
|
- name: Send Coverage Report
|
|
|
|
if: success()
|
2019-12-02 09:03:48 +00:00
|
|
|
env:
|
|
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
2019-12-01 17:29:04 +00:00
|
|
|
run: bash <(curl -s https://codecov.io/bash)
|