Skip to content

Commit

Permalink
Add github actions for build and release
Browse files Browse the repository at this point in the history
  • Loading branch information
mogensen committed Aug 12, 2020
1 parent ac8edcd commit 8acade2
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Test
on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: Build & Test
steps:
-
name: Checkout
uses: actions/checkout@v2
-
uses: actions/setup-go@v2-beta
with:
go-version: '^1.14.0'
-
name: Download dependencies
run: go mod download
-
name: Build & Test
run: |
go build -v ./cmd/git-goopen
go test ./...
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@master
with:
args: release --snapshot --skip-publish --rm-dist
19 changes: 19 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test coverage
on:
push:
jobs:
codecov:
name: codecov
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
uses: actions/setup-go@v2-beta
with:
go-version: '^1.14.0'
-
name: Generate coverage report
run: go test ./... -coverprofile=coverage.txt -covermode=atomic

28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release with goreleaser
on:
push:
tags:
- v*.*.*
jobs:
build:
runs-on: ubuntu-latest
name: goreleaser
steps:

-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
-
uses: actions/setup-go@v2-beta
with:
go-version: '^1.14.0'
-
name: Release via goreleaser
uses: goreleaser/goreleaser-action@master
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion cmd/git-goopen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ func getOverwriteDomain(gitRepo *git.Repository) string {
}

// Lookup Hostname alias in ssh config, empty if none is found
return ssh_config.Get(url.Host, "HostName")
sshConf := ssh_config.DefaultUserSettings
sshConf.IgnoreErrors = true
return sshConf.Get(url.Host, "HostName")
}

func openBrowser(url string) {
Expand Down

0 comments on commit 8acade2

Please sign in to comment.