Skip to content

Commit 45dde2b

Browse files
authored
Move from Travis to GH actions (#505)
Use Go 1.16 Fix transformer_test mutex vet error. Fixes #504
1 parent 7016326 commit 45dde2b

File tree

3 files changed

+56
-17
lines changed

3 files changed

+56
-17
lines changed

.github/workflows/prerequisites.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Check prerequisites
2+
on: [push, pull_request]
3+
jobs:
4+
check-format:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Setup Go 1.16
8+
uses: actions/setup-go@v1
9+
with:
10+
go-version: '1.16'
11+
12+
- name: Install goimports
13+
run: go get golang.org/x/tools/cmd/goimports
14+
15+
- name: Checkout the repository
16+
uses: actions/checkout@v2
17+
18+
# Comment this out for now until amppackager passes goimports.
19+
# https://github.com/ampproject/amppackager/issues/506
20+
# - name: Check formatting with goimports
21+
# run: |
22+
# if $(go env GOPATH)/bin/goimports -d . | grep . ; then
23+
# exit 1
24+
# fi
25+
26+
go-vet:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Setup Go 1.16
30+
uses: actions/setup-go@v1
31+
with:
32+
go-version: '1.16'
33+
34+
- name: Checkout the repository
35+
uses: actions/checkout@v2
36+
37+
- name: Diagnose the code with go vet
38+
# TODO(banaag): Turn on composite checking when
39+
# https://github.com/ampproject/amppackager/issues/507 is fixed.
40+
run: go vet -composites=false ./...
41+
42+
go-test:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Setup Go 1.16
46+
uses: actions/setup-go@v1
47+
with:
48+
go-version: '1.16'
49+
50+
- name: Checkout the repository
51+
uses: actions/checkout@v2
52+
53+
- name: Run the tests
54+
run: go test ./...

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

transformer/transformer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ func TestCustom(t *testing.T) {
309309
}
310310

311311
func TestCustomFail(t *testing.T) {
312-
r := rpb.Request{Html: "<html ⚡><lemur>", Config: rpb.Request_CUSTOM, Transformers: []string{"does_not_exist"}}
313-
if html, _, err := Process(&r); err == nil {
312+
r := &rpb.Request{Html: "<html ⚡><lemur>", Config: rpb.Request_CUSTOM, Transformers: []string{"does_not_exist"}}
313+
if html, _, err := Process(r); err == nil {
314314
t.Fatalf("Process(%v) = %s, nil; want error", r, html)
315315
}
316316
}

0 commit comments

Comments
 (0)