Skip to content

Commit

Permalink
testscript: support Go 1.16, move to Actions
Browse files Browse the repository at this point in the history
https://go-review.googlesource.com/c/go/+/250977 adds a new method to
the testing.testDeps interface, so mirror that here in our no-op
implementation too.

While at it, replace Travis with GitHub Actions, which is faster and
easier to use. We still test on Linux, Mac, and Windows, and with the
two latest Go versions. Otherwise, the config is a straight port, and we
run the same commands.
  • Loading branch information
mvdan committed Aug 30, 2020
1 parent bb90167 commit 1115b6a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 41 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.14.x, 1.15.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: |
go test ./...
go test -race ./...
- name: Tidy
if: matrix.os == 'ubuntu-latest' # no need to do this everywhere
run: |
go mod tidy
test -z "$(gofmt -d .)" || (gofmt -d . && false)
test -z "$(git status --porcelain)" || (git status; git diff && false)
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions testscript/exe.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,6 @@ func (nopTestDeps) WriteHeapProfile(io.Writer) error {
// Not needed for Go 1.10.
return nil
}

// Note: SetPanicOnExit0 was added in Go 1.16.
func (nopTestDeps) SetPanicOnExit0(bool) {}
4 changes: 4 additions & 0 deletions testscript/testdata/wait.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[!exec:echo] skip
[!exec:false] skip

# TODO: the '\n' below doesn't work on Windows on Github Actions, which does
# have coreutils like "echo" installed. Perhaps they emit CRLF?
[windows] skip

exec echo foo
stdout foo

Expand Down

0 comments on commit 1115b6a

Please sign in to comment.