Skip to content

Commit

Permalink
Merge pull request #1 from rsteube/use-actions
Browse files Browse the repository at this point in the history
use github actions
  • Loading branch information
rsteube committed Dec 13, 2021
2 parents ca74351 + b0740b4 commit a17190b
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 68 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Go

on:
pull_request:
push:

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
binary: invoke-completion
tags:
- release
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
name_template: "invoke-completion_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

136 changes: 68 additions & 68 deletions root_test.go
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
package main

import "testing"

func TestBash(t *testing.T) {
vals, err := invokeBash("invoke-completion -s ")
if err != nil {
t.Error(err.Error())
}
assertContains(t, vals, rawValue{Value: "bash"})
}

func TestElvish(t *testing.T) {
vals, err := invokeElvish("invoke-completion -s ")
if err != nil {
t.Error(err.Error())
}
assertContains(t, vals, rawValue{Value: "elvish "})
}

func TestFish(t *testing.T) {
vals, err := invokeFish("invoke-completion -s ")
if err != nil {
t.Error(err.Error())
}
assertContains(t, vals, rawValue{Value: "fish"})
}

func TestOil(t *testing.T) {
vals, err := invokeOil("invoke-completion -s ")
if err != nil {
t.Error(err.Error())
}
assertContains(t, vals, rawValue{Value: "oil"})
}

func TestPowershell(t *testing.T) {
vals, err := invokePowershell("invoke-completion -s ")
if err != nil {
t.Error(err.Error())
}
assertContains(t, vals, rawValue{Value: "powershell "})
}

func TestXonsh(t *testing.T) {
vals, err := invokeXonsh("invoke-completion -s ")
if err != nil {
t.Error(err.Error())
}
assertContains(t, vals, rawValue{Value: "xonsh "})
}

func TestZsh(t *testing.T) {
vals, err := invokeZsh("invoke-completion -s ")
if err != nil {
t.Error(err.Error())
}
assertContains(t, vals, rawValue{Value: "zsh "})
}

func assertContains(t *testing.T, vals []*rawValue, expected rawValue) {
for _, v := range vals {
if (expected.Value == "" || v.Value == expected.Value) &&
(expected.Display == "" || v.Display == expected.Display) &&
(expected.Description == "" || v.Description == expected.Description) {
return
}
}
t.Errorf("expected %#v", expected)
}
//import "testing"
//
//func TestBash(t *testing.T) {
// vals, err := InvokeBash("invoke-completion -s ")
// if err != nil {
// t.Error(err.Error())
// }
// assertContains(t, vals, rawValue{Value: "bash"})
//}
//
//func TestElvish(t *testing.T) {
// vals, err := InvokeElvish("invoke-completion -s ")
// if err != nil {
// t.Error(err.Error())
// }
// assertContains(t, vals, rawValue{Value: "elvish "})
//}
//
//func TestFish(t *testing.T) {
// vals, err := InvokeFish("invoke-completion -s ")
// if err != nil {
// t.Error(err.Error())
// }
// assertContains(t, vals, rawValue{Value: "fish"})
//}
//
//func TestOil(t *testing.T) {
// vals, err := InvokeOil("invoke-completion -s ")
// if err != nil {
// t.Error(err.Error())
// }
// assertContains(t, vals, rawValue{Value: "oil"})
//}
//
//func TestPowershell(t *testing.T) {
// vals, err := InvokePowershell("invoke-completion -s ")
// if err != nil {
// t.Error(err.Error())
// }
// assertContains(t, vals, rawValue{Value: "powershell "})
//}
//
//func TestXonsh(t *testing.T) {
// vals, err := InvokeXonsh("invoke-completion -s ")
// if err != nil {
// t.Error(err.Error())
// }
// assertContains(t, vals, rawValue{Value: "xonsh "})
//}
//
//func TestZsh(t *testing.T) {
// vals, err := InvokeZsh("invoke-completion -s ")
// if err != nil {
// t.Error(err.Error())
// }
// assertContains(t, vals, rawValue{Value: "zsh "})
//}
//
//func assertContains(t *testing.T, vals []*rawValue, expected rawValue) {
// for _, v := range vals {
// if (expected.Value == "" || v.Value == expected.Value) &&
// (expected.Display == "" || v.Display == expected.Display) &&
// (expected.Description == "" || v.Description == expected.Description) {
// return
// }
// }
// t.Errorf("expected %#v", expected)
//}

0 comments on commit a17190b

Please sign in to comment.