Merge pull request #1017 from urfave/github-actions-windows

GitHub actions windows
main
lynn [they] 5 years ago committed by GitHub
commit 565ec5884d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,22 +3,19 @@ name: Run Tests
on:
push:
branches:
- master
- master
- v1
pull_request:
branches:
- master
- v1
env:
GO111MODULE: on
GOPROXY: https://proxy.golang.org
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
go: [1.11, 1.12, 1.13]
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
@ -28,14 +25,50 @@ jobs:
with:
go-version: ${{ matrix.go }}
- name: Set GOPATH, PATH and ENV
run: |
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
- name: Checkout Code
uses: actions/checkout@v1
with:
ref: ${{ github.ref }}
- name: Run Tests
run: |
go run build.go vet
go run build.go test
- name: Upload coverage to Codecov
if: success() && matrix.go == 1.13 && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v1
with:
token: 0a8cc73b-bb7c-480b-8626-38a461643761
fail_ci_if_error: true
test-docs:
name: test-docs
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Set GOPATH and PATH
- name: Set GOPATH, PATH and ENV
run: |
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
@ -51,11 +84,6 @@ jobs:
chmod +x $GOPATH/bin/gfmrun
npm install -g markdown-toc@1.2.0
- name: Run Tests
run: |
go run build.go vet
go run build.go test
- name: Run Tests (v1)
if: contains(github.base_ref, 'v1')
run: |
@ -67,10 +95,3 @@ jobs:
run: |
go run build.go gfmrun docs/v2/manual.md
go run build.go toc docs/v2/manual.md
- name: Upload coverage to Codecov
if: success() && matrix.go == 1.13 && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v1
with:
token: 0a8cc73b-bb7c-480b-8626-38a461643761
fail_ci_if_error: true

@ -190,7 +190,7 @@ func TestPathApplyInputSourceMethodSet(t *testing.T) {
expected := "/path/to/source/hello"
if runtime.GOOS == "windows" {
expected = `C:\path\to\source\hello`
expected = `D:\path\to\source\hello`
}
expect(t, expected, c.String("test"))
}

@ -1,28 +0,0 @@
version: "{build}"
os: Windows Server 2016
image: Visual Studio 2017
clone_folder: c:\gopath\src\github.com\urfave\cli
cache:
- node_modules
environment:
GOPATH: C:\gopath
GOVERSION: 1.11.x
GO111MODULE: on
GOPROXY: https://proxy.golang.org
install:
- set PATH=%GOPATH%\bin;C:\go\bin;%PATH%
- go version
- go env
- go get github.com/urfave/gfmrun/cmd/gfmrun
- go mod tidy
build_script:
- go run build.go vet
- go run build.go test
- go run build.go gfmrun docs/v1/manual.md

@ -1,6 +1,7 @@
package cli
import (
"bytes"
"io/ioutil"
"testing"
)
@ -77,6 +78,9 @@ func testApp() *App {
func expectFileContent(t *testing.T, file, expected string) {
data, err := ioutil.ReadFile(file)
// Ignore windows line endings
// TODO: Replace with bytes.ReplaceAll when support for Go 1.11 is dropped
data = bytes.Replace(data, []byte("\r\n"), []byte("\n"), -1)
expect(t, err, nil)
expect(t, string(data), expected)
}

Loading…
Cancel
Save