Skip to content

Commit 8049ab3

Browse files
authored
Create go.yml (#5)
Switch to using GitHub actions and drop the Travis from the CI tests.
1 parent f208370 commit 8049ab3

File tree

4 files changed

+53
-13
lines changed

4 files changed

+53
-13
lines changed

.github/workflows/go.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.15
20+
21+
- name: Build
22+
run: go build -v ./...
23+
24+
- name: Test
25+
run: go test -v ./...

.github/workflows/golangci-lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
- main
9+
pull_request:
10+
jobs:
11+
golangci:
12+
name: lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: golangci-lint
17+
uses: golangci/golangci-lint-action@v2
18+
with:
19+
version: v1.34
20+
only-new-issues: true

.travis.yml

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

test/clone_options.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ import (
77
"github.com/go-git/go-git/v5/plumbing"
88
)
99

10-
// MakeCloneOptions determines if we are running in Travis,
10+
// MakeCloneOptions determines if we are running in GitHub,
1111
// and ensures that it's using the correct branch.
12+
//
13+
// This is because the codebase that the tests run in is not a clone, so we have
14+
// to clone the upstream.
15+
//
16+
// For local development, you're working on the branch, and we can use that
17+
// branch correctly.
1218
func MakeCloneOptions() *git.CloneOptions {
1319
o := &git.CloneOptions{
1420
URL: "../..",
1521
Depth: 1,
1622
}
17-
if b := os.Getenv("TRAVIS_PULL_REQUEST_BRANCH"); b != "" {
23+
if b := os.Getenv("GITHUB_BASE_REF"); b != "" {
1824
o.ReferenceName = plumbing.NewBranchReferenceName(b)
1925
o.URL = "https://github.com/redhat-developer/gitops-backend.git"
2026
}

0 commit comments

Comments
 (0)