all: switch to GitHub actions

Travis-CI is dead. The new hotness if GitHub actions.
For now we only test on Linux since testing on macOS and Windows
takes more effort to figure out.

Change-Id: I464df75b9142dafcdf07281f70c1bcf52514f71a
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/298089
Trust: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2021-03-02 17:09:55 -08:00
parent 731520d340
commit e7ab1125a6
3 changed files with 27 additions and 36 deletions

26
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,26 @@
on: [push]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.16.x]
os: [ubuntu-latest] # TODO: Add [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: sudo apt-get -y install autoconf automake libtool curl make g++ unzip
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: .cache
key: ${{ runner.os }}-${{ hashFiles('integration_test.go') }}
- name: Test
run: go test -v -mod=vendor -timeout=60m -count=1 integration_test.go -failfast

View File

@ -1,16 +0,0 @@
language: go
go: 1.12.x
install:
- unset GOROOT
- unset GOPATH
matrix:
include:
- os: linux
dist: xenial
- os: osx
osx_image: xcode10.1
script:
- ./test.bash
cache:
directories:
- .cache

View File

@ -180,25 +180,6 @@ func mustInitDeps(t *testing.T) {
testDir := filepath.Join(repoRoot, ".cache")
check(os.MkdirAll(testDir, 0775))
// Travis-CI has a hard-coded timeout where it kills the test after
// 10 minutes of a lack of activity on stdout.
// We work around this restriction by periodically printing the timestamp.
ticker := time.NewTicker(5 * time.Minute)
done := make(chan struct{})
go func() {
now := time.Now()
for {
select {
case t := <-ticker.C:
fmt.Printf("\tt=%0.fmin\n", t.Sub(now).Minutes())
case <-done:
return
}
}
}()
defer close(done)
defer ticker.Stop()
// Delete the current directory if non-empty,
// which only occurs if a dependency failed to initialize properly.
var workingDir string
@ -295,7 +276,7 @@ func mustInitDeps(t *testing.T) {
registerBinary("staticcheck", filepath.Join(checkDir, "staticcheck"))
finishWork()
// Travis-CI sets GOROOT, which confuses invocations of the Go toolchain.
// GitHub actions sets GOROOT, which confuses invocations of the Go toolchain.
// Explicitly clear GOROOT, so each toolchain uses their default GOROOT.
check(os.Unsetenv("GOROOT"))