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:
|
2022-04-21 22:24:30 +00:00
|
|
|
- main
|
2022-04-21 19:18:35 +00:00
|
|
|
tags:
|
2022-04-21 22:24:30 +00:00
|
|
|
- v2.*
|
2019-12-01 07:41:49 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
2022-04-21 22:24:30 +00:00
|
|
|
- main
|
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-08-14 14:31:53 +00:00
|
|
|
go: [1.17.x, 1.18.x, 1.19.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
|
|
|
|
2022-08-14 14:47:42 +00:00
|
|
|
- name: install goimports
|
|
|
|
if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
|
|
|
|
run: GOBIN=${PWD}/.local/bin go install golang.org/x/tools/cmd/goimports@latest
|
|
|
|
|
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
|
|
|
|
2022-08-14 14:47:42 +00:00
|
|
|
- name: goimports check
|
2022-08-14 14:31:53 +00:00
|
|
|
if: matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
|
2022-08-14 14:47:42 +00:00
|
|
|
run: test -z $(goimports -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
|
|
|
|
|
2022-05-07 19:21:00 +00:00
|
|
|
- name: test with urfave_cli_no_docs tag
|
2022-04-25 17:58:31 +00:00
|
|
|
run: go run internal/build/build.go -tags urfave_cli_no_docs test
|
|
|
|
|
2020-02-29 07:36:34 +00:00
|
|
|
- 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
|
|
|
|
2022-04-25 17:58:31 +00:00
|
|
|
- name: check-binary-size with tags (informational only)
|
2022-05-17 12:49:15 +00:00
|
|
|
run: go run internal/build/build.go -tags urfave_cli_no_docs check-binary-size
|
2022-04-25 17:58:31 +00:00
|
|
|
|
2019-12-25 17:10:48 +00:00
|
|
|
- name: Upload coverage to Codecov
|
2022-08-14 14:31:53 +00:00
|
|
|
if: success() && matrix.go == '1.19.x' && matrix.os == 'ubuntu-latest'
|
2022-04-21 19:18:35 +00:00
|
|
|
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-08-14 14:31:53 +00:00
|
|
|
go-version: 1.19.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-05-19 03:19:10 +00:00
|
|
|
run: |
|
2022-05-19 03:17:57 +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"
|
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
|
|
|
|
|
2022-05-02 03:02:05 +00:00
|
|
|
- name: diff check
|
|
|
|
run: |
|
|
|
|
git diff --exit-code
|
|
|
|
git diff --cached --exit-code
|
2022-05-09 00:49:08 +00:00
|
|
|
|
|
|
|
publish:
|
2022-05-19 03:20:47 +00:00
|
|
|
if: startswith(github.ref, 'refs/tags/')
|
2022-05-09 00:49:08 +00:00
|
|
|
name: publish
|
2022-05-19 02:58:46 +00:00
|
|
|
needs: [test-docs]
|
2022-05-09 00:49:08 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v3
|
2022-05-19 03:17:57 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-05-09 00:49:08 +00:00
|
|
|
|
2022-05-19 03:13:45 +00:00
|
|
|
- name: Setup mkdocs
|
|
|
|
run: |
|
|
|
|
pip install -U pip
|
|
|
|
pip install -r mkdocs-requirements.txt
|
|
|
|
git remote rm origin
|
|
|
|
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/urfave/cli.git
|
|
|
|
|
2022-05-09 00:49:08 +00:00
|
|
|
- name: Publish Docs
|
2022-05-19 03:13:45 +00:00
|
|
|
run: |
|
|
|
|
mkdocs gh-deploy --force
|