From 40a3fb303a68bc6f154aff50829b2c099d846fd8 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Sat, 23 Nov 2019 15:26:26 -0500 Subject: [PATCH 1/4] actions --- .github/FUNDING.yml | 3 +- .github/workflows/release.yml | 28 +++++++++++++++++ .github/workflows/tests.yml | 22 +++++++++++++ .goreleaser.yml | 58 ++++++++++++++++++++++------------- version.go | 2 +- 5 files changed, 89 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 9fb7f12..65b45f1 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,4 @@ # These are supported funding model platforms -github: [@markbates] +github: markbates +patreon: buffalo diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..60d9d7b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release +on: + release: + types: + - published + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - + name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + - + name: Checkout Code + uses: actions/checkout@master + - + name: Run GoReleaser + env: + GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..68804c1 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,22 @@ +name: Tests +on: [push] +jobs: + + tests-on: + name: ${{matrix.go-version}} ${{matrix.os}} + runs-on: ${{ matrix.os }} + strategy: + matrix: + go-version: [1.12.x, 1.13.x] + os: [macos-latest, windows-latest, ubuntu-latest] + steps: + - name: Checkout Code + uses: actions/checkout@v1 + with: + fetch-depth: 1 + - name: Test + run: | + go mod tidy -v + go test -race ./... + + diff --git a/.goreleaser.yml b/.goreleaser.yml index 19ac1de..0ea9d65 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,31 +1,45 @@ -# Code generated by github.com/gobuffalo/release. DO NOT EDIT. -# Edit .goreleaser.yml.plush instead - builds: -- - goos: - - darwin - - linux - - windows - env: - - CGO_ENABLED=0 - main: cmd/here/main.go - + - + main: ./cmd/here/main.go + env: + - CGO_ENABLED=0 + ldflags: + - -s -w -X "github.com/gobuffalo/here.Version={{.Tag}}" + goos: + - darwin + - linux + - windows + goarch: + - amd64 + - 386 + - arm + - arm64 + goarm: + - 6 + - 7 +archives: + - + replacements: + '386': i386 + darwin: Darwin + linux: Linux + windows: Windows + amd64: x86_64 checksum: - name_template: 'checksums.txt' - + name_template: checksums.txt snapshot: - name_template: "{{ .Tag }}-next" - + name_template: '{{ .Tag }}-next' changelog: sort: asc filters: exclude: - '^docs:' - '^test:' - -brew: - github: - owner: gobuffalo - name: homebrew-tap - +brews: + - + name: 'here' + github: + owner: 'gobuffalo' + name: 'homebrew-tap' + install: | + bin.install "here" diff --git a/version.go b/version.go index daa7c49..97fdbe8 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package here // Version of here -const Version = "v0.4.2" +var Version = "development" From d06cf331b23063e16fcdd152e5b6baf134f1c92d Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Sat, 23 Nov 2019 15:29:46 -0500 Subject: [PATCH 2/4] err --- dir.go | 3 +-- here.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dir.go b/dir.go index 1c00fdd..9fb3e35 100644 --- a/dir.go +++ b/dir.go @@ -2,7 +2,6 @@ package here import ( "encoding/json" - "fmt" "os" "path/filepath" ) @@ -38,7 +37,7 @@ func (h Here) Dir(p string) (Info, error) { if nonGoDirRx.MatchString(err.Error()) { return fromNonGoDir(p) } - return i, fmt.Errorf("%w %s", err, p) + return i, err } if err := json.Unmarshal(b, &i); err != nil { diff --git a/here.go b/here.go index c8379be..3b6fb5b 100644 --- a/here.go +++ b/here.go @@ -32,7 +32,7 @@ func run(n string, args ...string) ([]byte, error) { c.Stderr = ebb err := c.Run() if err != nil { - return nil, fmt.Errorf("%w: %s", err, ebb) + return nil, fmt.Errorf("%s: %s", err, ebb) } return bb.Bytes(), nil From 7117b9a1ca3a4ff29a4283b7d838435d0a1dc38c Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Sat, 23 Nov 2019 15:33:18 -0500 Subject: [PATCH 3/4] remove all files --- .goreleaser.yml.plush | 28 ---------------------------- azure-pipelines.yml | 39 --------------------------------------- azure-tests.yml | 19 ------------------- 3 files changed, 86 deletions(-) delete mode 100644 .goreleaser.yml.plush delete mode 100644 azure-pipelines.yml delete mode 100644 azure-tests.yml diff --git a/.goreleaser.yml.plush b/.goreleaser.yml.plush deleted file mode 100644 index c83d1d4..0000000 --- a/.goreleaser.yml.plush +++ /dev/null @@ -1,28 +0,0 @@ -builds: -- - goos: - - darwin - - linux - - windows - env: - - CGO_ENABLED=0 - main: cmd/here/main.go - -checksum: - name_template: 'checksums.txt' - -snapshot: - name_template: "{{ .Tag }}-next" - -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' -<%= if (brew) { %> -brew: - github: - owner: gobuffalo - name: homebrew-tap -<% } %> diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 4788f97..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,39 +0,0 @@ -variables: - GOPROXY: "https://proxy.golang.org" - GOBIN: "$(GOPATH)/bin" # Go binaries path - GOPATH: "$(system.defaultWorkingDirectory)/gopath" # Go workspace path - modulePath: "$(GOPATH)/src/github.com/$(build.repository.name)" # Path to the module"s code - -jobs: -- job: Windows - pool: - vmImage: "vs2017-win2016" - strategy: - matrix: - go 1.13.4: - go_version: "1.13.4" - GO111MODULE: "on" - steps: - - template: azure-tests.yml - -- job: macOS - pool: - vmImage: "macOS-10.13" - strategy: - matrix: - go 1.13.4: - go_version: "1.13.4" - GO111MODULE: "on" - steps: - - template: azure-tests.yml - -- job: Linux - pool: - vmImage: "ubuntu-16.04" - strategy: - matrix: - go 1.13.4: - go_version: "1.13.4" - GO111MODULE: "on" - steps: - - template: azure-tests.yml diff --git a/azure-tests.yml b/azure-tests.yml deleted file mode 100644 index eea5822..0000000 --- a/azure-tests.yml +++ /dev/null @@ -1,19 +0,0 @@ -steps: - - task: GoTool@0 - inputs: - version: $(go_version) - - task: Bash@3 - inputs: - targetType: inline - script: | - mkdir -p "$(GOBIN)" - mkdir -p "$(GOPATH)/pkg" - mkdir -p "$(modulePath)" - shopt -s extglob - mv !(gopath) "$(modulePath)" - displayName: "Setup Go Workspace" - - script: | - go get -t -v ./... - go test -race ./... - workingDirectory: "$(modulePath)" - displayName: "Tests" From 520e2cbe0bd456805fc740fcf1dfcac323886717 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Sat, 23 Nov 2019 16:03:21 -0500 Subject: [PATCH 4/4] add actions badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a4c1923..79bc3d8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Here +[![](https://github.com/gobuffalo/here/workflows/Tests/badge.svg)](https://github.com/gobuffalo/here/actions) [![GoDoc](https://godoc.org/github.com/gobuffalo/here?status.svg)](https://godoc.org/github.com/gobuffalo/here) Here will get you **accurate** Go information about the directory of package requested.