From e849f62e61ace2a8260442d30f14ce23a130c2fc Mon Sep 17 00:00:00 2001 From: Quentin Renard Date: Wed, 26 Jul 2023 16:22:40 +0200 Subject: [PATCH 1/2] Added github action --- .github/workflows/test.yml | 33 +++++++++++++++++++++++++++++++++ .travis.yml | 15 --------------- README.md | 2 +- 3 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e1ac19d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,33 @@ +name: Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: Install dependencies + run: go mod download + + - name: Run tests + run: go test -race -covermode atomic -coverprofile=covprofile ./... + + - if: github.event_name != 'pull_request' + name: Send coverage + env: + COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }} + run: | + go install github.com/mattn/goveralls@latest + goveralls -coverprofile=covprofile -service=github diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 05ca03d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go -go: -- 1.x -- tip -install: -- go get -t ./... -- go get golang.org/x/tools/cmd/cover -- go get github.com/mattn/goveralls -- go install github.com/mattn/goveralls -matrix: - allow_failures: - - go: tip -script: -- go test -race -v -coverprofile=coverage.out -- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci \ No newline at end of file diff --git a/README.md b/README.md index c18e5f5..e38219a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![GoReportCard](http://goreportcard.com/badge/github.com/asticode/go-astilectron)](http://goreportcard.com/report/github.com/asticode/go-astilectron) [![GoDoc](https://godoc.org/github.com/asticode/go-astilectron?status.svg)](https://godoc.org/github.com/asticode/go-astilectron) -[![Travis](https://travis-ci.org/asticode/go-astilectron.svg?branch=master)](https://travis-ci.org/asticode/go-astilectron#) +[![Test](https://github.com/asticode/go-astilectron/actions/workflows/test.yml/badge.svg)](https://github.com/asticode/go-astilectron/actions/workflows/test.yml) [![Coveralls](https://coveralls.io/repos/github/asticode/go-astilectron/badge.svg?branch=master)](https://coveralls.io/github/asticode/go-astilectron) Thanks to `go-astilectron` build cross platform GUI apps with GO and HTML/JS/CSS. It is the official GO bindings of [astilectron](https://github.com/asticode/astilectron) and is powered by [Electron](https://github.com/electron/electron). From 1082851c1ea20b0cf3baa9ae2295256efff590c2 Mon Sep 17 00:00:00 2001 From: Ken Date: Wed, 18 Oct 2023 15:10:45 +0800 Subject: [PATCH 2/2] Fix the error in the event Badge (#397) which currently does not allow empty strings. Change it to use a String pointer. Co-authored-by: ken --- dock.go | 2 +- event.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dock.go b/dock.go index 56113e4..7dc2318 100644 --- a/dock.go +++ b/dock.go @@ -92,7 +92,7 @@ func (d *Dock) SetBadge(badge string) (err error) { if err = d.ctx.Err(); err != nil { return } - _, err = synchronousEvent(d.ctx, d, d.w, Event{Name: eventNameDockCmdSetBadge, TargetID: d.id, Badge: badge}, eventNameDockEventBadgeSet) + _, err = synchronousEvent(d.ctx, d, d.w, Event{Name: eventNameDockCmdSetBadge, TargetID: d.id, Badge: &badge}, eventNameDockEventBadgeSet) return } diff --git a/event.go b/event.go index 6e02927..c27904c 100644 --- a/event.go +++ b/event.go @@ -21,7 +21,7 @@ type Event struct { // A choice was made not to use interfaces since it's a pain in the ass asserting each an every payload afterwards // We use pointers so that omitempty works AuthInfo *EventAuthInfo `json:"authInfo,omitempty"` - Badge string `json:"badge,omitempty"` + Badge *string `json:"badge,omitempty"` BounceType string `json:"bounceType,omitempty"` Bounds *RectangleOptions `json:"bounds,omitempty"` CallbackID string `json:"callbackId,omitempty"`