Skip to content

Commit c7ba1fd

Browse files
committed
build: Replace Travis with Github Actions
1 parent bec72b8 commit c7ba1fd

File tree

5 files changed

+39
-19
lines changed

5 files changed

+39
-19
lines changed

‎.github/FUNDING.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [bep]

‎.github/workflows/test.yml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
name: Test
6+
jobs:
7+
test:
8+
strategy:
9+
matrix:
10+
go-version: [1.21.x, 1.22.x]
11+
platform: [ubuntu-latest, macos-latest, windows-latest]
12+
runs-on: ${{ matrix.platform }}
13+
steps:
14+
- name: Install Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version: ${{ matrix.go-version }}
18+
- name: Install staticcheck
19+
run: go install honnef.co/go/tools/cmd/staticcheck@latest
20+
shell: bash
21+
- name: Update PATH
22+
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
23+
shell: bash
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
- name: Fmt
27+
if: matrix.platform != 'windows-latest' # :(
28+
run: "diff <(gofmt -d .) <(printf '')"
29+
shell: bash
30+
- name: Vet
31+
run: go vet ./...
32+
- name: Staticcheck
33+
run: staticcheck ./...
34+
- name: Test
35+
run: go test -race ./...

‎.travis.yml‎

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

‎gitmap.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var (
1919
// will be modified during tests
2020
gitExec string
2121

22-
GitNotFound = errors.New("Git executable not found in $PATH")
22+
ErrGitNotFound = errors.New("git executable not found in $PATH")
2323
)
2424

2525
type GitRepo struct {
@@ -75,7 +75,6 @@ func Map(repository, revision string) (*GitRepo, error) {
7575

7676
gitLogArgs = append([]string{"-c", "diff.renames=0", "-c", "log.showSignature=0", "-C", repository, "log"}, gitLogArgs...)
7777
out, err = git(gitLogArgs...)
78-
7978
if err != nil {
8079
return nil, err
8180
}
@@ -110,7 +109,7 @@ func git(args ...string) ([]byte, error) {
110109
if err != nil {
111110
if ee, ok := err.(*exec.Error); ok {
112111
if ee.Err == exec.ErrNotFound {
113-
return nil, GitNotFound
112+
return nil, ErrGitNotFound
114113
}
115114
}
116115

‎gitmap_test.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ func assertMessage(
171171
if gi.Body != expectedBody {
172172
t.Error("Incorrect commit body. Got", gi.Body)
173173
}
174-
175174
}
176175

177176
func TestActiveRevision(t *testing.T) {
@@ -201,7 +200,7 @@ func TestGitExecutableNotFound(t *testing.T) {
201200
gitExec = "thisShouldHopefullyNotExistOnPath"
202201
gi, err := Map(repository, revision)
203202

204-
if err != GitNotFound || gi != nil {
203+
if err != ErrGitNotFound || gi != nil {
205204
t.Fatal("Invalid error handling")
206205
}
207206
}

0 commit comments

Comments
 (0)