From 9d2602f637d668fb1d76d73281fdcee1fefdd355 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Mon, 30 Aug 2021 20:18:23 +0900 Subject: [PATCH 1/3] Fix CI --- .github/workflows/go.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 96379ba..d863f67 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,21 +1,21 @@ name: Go -on: [push] +on: [push, pull_request] jobs: build: - name: Build + name: Test strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] + go-version: [ "1.15", "1.16", "1.17" ] runs-on: ${{ matrix.os }} steps: - - name: Set up Go 1.13 - uses: actions/setup-go@v1 - with: - go-version: 1.13 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Build - run: go build -v cmd/dot/dot.go + - name: setup Go ${{ matrix.go-version }} + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: checkout + uses: actions/checkout@v2 + - name: build dot command + run: go build -v cmd/dot/dot.go + - name: test + run: go test -race -v ./... From 0e1fe2b5f8abaa7f32b05f44ac9a15654a1abfea Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Mon, 30 Aug 2021 20:23:39 +0900 Subject: [PATCH 2/3] Fix test for windows --- compatible_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compatible_test.go b/compatible_test.go index 96d16b9..1e2588b 100644 --- a/compatible_test.go +++ b/compatible_test.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "image" + "io" "io/ioutil" "os" "os/exec" @@ -113,7 +114,7 @@ func TestGraphviz_Compatible(t *testing.T) { t.Fatal(err) } targetHash, err := goimagehash.LoadImageHash(bytes.NewBuffer(dump)) - if err != nil { + if err != nil && err != io.EOF { t.Fatal(err) } distance, err := hash.Distance(targetHash) From 55d489706aff95a99f88a18d563f4117f7e1e330 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Mon, 30 Aug 2021 20:32:16 +0900 Subject: [PATCH 3/3] Exclude windows from testing --- .github/workflows/go.yml | 1 + compatible_test.go | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d863f67..1b82594 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,4 +18,5 @@ jobs: - name: build dot command run: go build -v cmd/dot/dot.go - name: test + if: ${{ matrix.os != 'windows-latest' }} run: go test -race -v ./... diff --git a/compatible_test.go b/compatible_test.go index 1e2588b..96d16b9 100644 --- a/compatible_test.go +++ b/compatible_test.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "image" - "io" "io/ioutil" "os" "os/exec" @@ -114,7 +113,7 @@ func TestGraphviz_Compatible(t *testing.T) { t.Fatal(err) } targetHash, err := goimagehash.LoadImageHash(bytes.NewBuffer(dump)) - if err != nil && err != io.EOF { + if err != nil { t.Fatal(err) } distance, err := hash.Distance(targetHash)