From 7d73cd6129584a6e0e69b7a3030a93117eabaf59 Mon Sep 17 00:00:00 2001 From: rsteube Date: Tue, 6 Sep 2022 23:19:40 +0200 Subject: [PATCH] github action --- .github/workflows/go.yml | 41 ++++++++++++++++++++++++++++++++++++++++ .goreleaser.yml | 3 +++ flag_test.go | 3 ++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/go.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 00000000..abca960e --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,41 @@ +name: Go + +on: + pull_request: + push: + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - name: shallow clone + uses: actions/checkout@v2 + if: "!startsWith(github.ref, 'refs/tags/')" + + - name: deep clone + uses: actions/checkout@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.19 + + - 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 }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..1c819058 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,3 @@ +project_name: carapace-pflag +build: + skip: true diff --git a/flag_test.go b/flag_test.go index 508550de..eec1ecef 100644 --- a/flag_test.go +++ b/flag_test.go @@ -1237,7 +1237,8 @@ func TestPrintDefaults(t *testing.T) { got := buf.String() if got != defaultOutput { fmt.Println("\n" + got) - fmt.Println("\n" + defaultOutput) + fmt.Print("\n" + defaultOutput) + fmt.Println() t.Errorf("got %q want %q\n", got, defaultOutput) } }