ci: add a Github Actions workflow to test project (#125)
* checkers: switch back to github.com/kr/pretty dependency
* go.mod: add a go.mod file
* ci: add a Github Actions workflow to test on Linux, MacOS and Windows
* ci: add a job testing the GOPATH based workflow on a pre-modules Go
* tests: fix a few problems preventing the tests from passing on Windows
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
new file mode 100644
index 0000000..6d8911a
--- /dev/null
+++ b/.github/workflows/test.yaml
@@ -0,0 +1,44 @@
+name: test
+
+on:
+ push:
+ pull_request:
+
+jobs:
+ test:
+ strategy:
+ matrix:
+ os:
+ - ubuntu-latest
+ - macos-latest
+ - windows-latest
+
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/setup-go@v2
+ with:
+ go-version: '^1.13.0' # Latest 1.x release >= 1.13
+ - uses: actions/checkout@v2
+ - name: Build
+ run: go build .
+ - name: Test
+ run: go test -v ./...
+
+ gopath:
+ runs-on: ubuntu-latest
+ env:
+ GOPATH: ${{ github.workspace }}
+ package: gopkg.in/check.v1
+ steps:
+ - uses: actions/setup-go@v2
+ with:
+ go-version: '1.9.x'
+ - uses: actions/checkout@v2
+ with:
+ path: src/${{ env.package }}
+ - name: Dependencies
+ run: go get -t -d -v ${{ env.package }}/...
+ - name: Build
+ run: go build ${{ env.package }}
+ - name: Test
+ run: go test -v ${{ env.package }}/...
diff --git a/benchmark_test.go b/benchmark_test.go
index 8b6a8a6..122291e 100644
--- a/benchmark_test.go
+++ b/benchmark_test.go
@@ -70,7 +70,7 @@
}
Run(&helper, &runConf)
- expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark2\t\\s+[0-9]+\t\\s+[0-9]+ ns/op\t\\s+ *[1-9]\\.[0-9]{2} MB/s\n"
+ expected := "PASS: check_test\\.go:[0-9]+: FixtureHelper\\.Benchmark2\t\\s+[0-9]+\t\\s+[0-9]+ ns/op\t\\s+ *[0-9]\\.[0-9]{2} MB/s\n"
c.Assert(output.value, Matches, expected)
}
diff --git a/checkers.go b/checkers.go
index e146429..0326197 100644
--- a/checkers.go
+++ b/checkers.go
@@ -6,7 +6,7 @@
"regexp"
"strings"
- "github.com/niemeyer/pretty"
+ "github.com/kr/pretty"
)
// -----------------------------------------------------------------------
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..350cdd6
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,5 @@
+module gopkg.in/check.v1
+
+go 1.11
+
+require github.com/kr/pretty v0.2.1
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..10212ca
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,5 @@
+github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
diff --git a/run_test.go b/run_test.go
index f41fffc..e7f68a2 100644
--- a/run_test.go
+++ b/run_test.go
@@ -6,6 +6,7 @@
"errors"
. "gopkg.in/check.v1"
"os"
+ "regexp"
"sync"
)
@@ -411,7 +412,7 @@
runConf := RunConf{Output: &output, Verbose: true, KeepWorkDir: true}
result := Run(&WorkDirSuite{}, &runConf)
- c.Assert(result.String(), Matches, ".*\nWORK=" + result.WorkDir)
+ c.Assert(result.String(), Matches, ".*\nWORK=" + regexp.QuoteMeta(result.WorkDir))
stat, err := os.Stat(result.WorkDir)
c.Assert(err, IsNil)