Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 53acfdc

Browse files
authored
ci: use GitHub actions (#94)
Fix up tests etc whilst we are at it
1 parent f2461c8 commit 53acfdc

File tree

14 files changed

+241
-210
lines changed

14 files changed

+241
-210
lines changed

.github/workflows/test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- '**'
8+
9+
env:
10+
GOPROXY: https://proxy.golang.org
11+
12+
# At the time of writing (2020-04-07) the default git config
13+
# on action runners includes core.autocrlf=true. Therefore we
14+
# override that below before checkout out the code.
15+
#
16+
# See also https://github.com/actions/checkout/issues/135
17+
18+
name: Test
19+
jobs:
20+
test:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
go-version: [1.13.9, 1.14.1]
25+
platform: [ubuntu-latest, macos-latest, windows-latest]
26+
runs-on: ${{ matrix.platform }}
27+
steps:
28+
- name: Install Go
29+
uses: actions/setup-go@9fbc767707c286e568c92927bbf57d76b73e0892
30+
with:
31+
go-version: ${{ matrix.go-version }}
32+
- name: Fix git config
33+
run: git config --global core.autocrlf false
34+
- run: mkdir -p gopath/src/github.com/myitcv/gobin
35+
- name: Checkout code
36+
uses: actions/checkout@01aecccf739ca6ff86c0539fbc67a7a5007bbc81
37+
with:
38+
path: gopath/src/github.com/myitcv/gobin
39+
- name: Test
40+
run: go test ./...
41+
working-directory: gopath/src/github.com/myitcv/gobin
42+
- name: Adjust GOPATH for non-module install
43+
run: echo "::set-env name=GOPATH::$PWD/gopath"
44+
- name: Adjust GO111MODULE for non-module install
45+
run: echo "::set-env name=GO111MODULE::off"
46+
- name: Non-module install test
47+
run: go install
48+
working-directory: gopath/src/github.com/myitcv/gobin

.github/workflows/verify_commit.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- '**'
8+
9+
env:
10+
GOPROXY: https://proxy.golang.org
11+
12+
name: Verify commit is clean
13+
jobs:
14+
test:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
go-version: [1.14.1]
19+
platform: [ubuntu-latest]
20+
runs-on: ${{ matrix.platform }}
21+
steps:
22+
- name: Install Go
23+
uses: actions/setup-go@9fbc767707c286e568c92927bbf57d76b73e0892
24+
with:
25+
go-version: ${{ matrix.go-version }}
26+
- name: Checkout code
27+
uses: actions/checkout@01aecccf739ca6ff86c0539fbc67a7a5007bbc81
28+
- run: go mod vendor
29+
- run: go mod tidy
30+
- name: Check git is clean
31+
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
32+

.travis.yml

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

_scripts/apply_known_diffs.sh

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

_scripts/known_diffs/go1.11.13/badly_sorted_vendor_modules.txt.diff

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

_scripts/known_diffs/go1.12.9/badly_sorted_vendor_modules.txt.diff

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

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/myitcv/gobin
22

3-
require github.com/rogpeppe/go-internal v1.3.1
3+
require github.com/rogpeppe/go-internal v1.5.2
44

55
go 1.11

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
33
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
44
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
55
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
6-
github.com/rogpeppe/go-internal v1.3.1 h1:pgz0lCb+F99TrCwoy7d83j5kI//45fBQ34KzZ7t5as0=
7-
github.com/rogpeppe/go-internal v1.3.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
6+
github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w=
7+
github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
88
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
99
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1010
gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=

main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,15 @@ func getGoEnv() (goEnv, error) {
771771
}
772772
}
773773
{
774+
// Create a temp dir that is not a module for the simple
775+
// results we need from a go list of runtime
776+
td, err := ioutil.TempDir("", "gobin-release-tags-")
777+
if err != nil {
778+
return goEnv{}, fmt.Errorf("failed to create temp dir for release tags derivation: %v", err)
779+
}
780+
defer os.RemoveAll(td)
774781
cmd := exec.Command("go", "list", `-f={{join context.ReleaseTags "\n"}}`, "runtime")
782+
cmd.Dir = td
775783
out, err := cmd.CombinedOutput()
776784
if err != nil {
777785
return goEnv{}, fmt.Errorf("failed to get release tags: %v\n%s", err, out)

script_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ func TestExitCode(t *testing.T) {
6060
"GONOSUMDB=*",
6161
"GOPROXY="+proxyURL,
6262
"TESTSCRIPT_COMMAND=gobin",
63+
64+
// We zero GOPATH here so that we definitely use the default
65+
// location of $HOME (with the new $HOME)
66+
"GOPATH=",
6367
)
6468

65-
err = cmd.Run()
69+
out, err := cmd.CombinedOutput()
70+
fmt.Printf(">> %s\n", out)
6671
if err == nil {
6772
t.Fatalf("unexpected success")
6873
}
@@ -72,7 +77,7 @@ func TestExitCode(t *testing.T) {
7277
}
7378
want := 42
7479
if got := ExitCode(ee.ProcessState); want != got {
75-
t.Fatalf("expected exit code %v; got %v", want, got)
80+
t.Fatalf("expected exit code %v; got %v; output was: %s", want, got, out)
7681
}
7782
}
7883

testdata/mod_readonly.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ cd repo
88
! stdout .+
99
[go1.11] [!go1.12] stderr 'import lookup disabled by -mod=readonly'
1010
[go1.12] [!go1.13] stderr 'can''t load package: package github.com/gobin-testrepos/simple-main: unknown import path "github.com/gobin-testrepos/simple-main": import lookup disabled by -mod=readonly'
11-
[go1.13] stderr 'can''t load package: package github\.com/gobin-testrepos/simple-main: import lookup disabled by -mod=readonly'
11+
[go1.13] [!go1.14] stderr 'updates to go.mod needed, disabled by -mod=readonly'
12+
[go1.14] stderr 'cannot find module providing package github\.com/gobin-testrepos/simple-main: import lookup disabled by -mod=readonly'
1213

1314
-- repo/go.mod --
1415
module example.com/repo

vendor/github.com/rogpeppe/go-internal/testscript/cmd.go

Lines changed: 12 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)