From 160eccf352f68a06342e3c7963f56910b4f82944 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sun, 5 Feb 2023 21:17:13 +0100 Subject: [PATCH 1/5] ci: general ci improvements Signed-off-by: Mark Sagi-Kazar --- .github/.editorconfig | 2 ++ .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/go.yml | 28 ---------------------------- README.md | 7 +++---- 4 files changed, 38 insertions(+), 32 deletions(-) create mode 100644 .github/.editorconfig create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/go.yml diff --git a/.github/.editorconfig b/.github/.editorconfig new file mode 100644 index 0000000..0902c6a --- /dev/null +++ b/.github/.editorconfig @@ -0,0 +1,2 @@ +[{*.yml,*.yaml}] +indent_size = 2 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1817575 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + # Fail fast is disabled because there are Go version specific features and tests + # that should be able to fail independently. + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + go-version: ['1.16', '1.17', '1.18'] + + steps: + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go }} + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -race -v ./... diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index c4f0f68..0000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Go - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - strategy: - matrix: - go-version: [1.16.x, 1.17.x, 1.18.x] - os: [ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: ${{ matrix.go-version }} - - - name: Build - run: go build -v ./... - - - name: Test - run: go test -race -v ./... diff --git a/README.md b/README.md index 120a573..c68b910 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -cast -==== +# cast + [![GoDoc](https://godoc.org/github.com/spf13/cast?status.svg)](https://godoc.org/github.com/spf13/cast) -[![Build Status](https://github.com/spf13/cast/actions/workflows/go.yml/badge.svg)](https://github.com/spf13/cast/actions/workflows/go.yml) +[![Build Status](https://github.com/spf13/cast/actions/workflows/ci.yml/badge.svg)](https://github.com/spf13/cast/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/spf13/cast)](https://goreportcard.com/report/github.com/spf13/cast) Easy and safe casting from one type to another in Go @@ -72,4 +72,3 @@ the code for a complete set. var eight interface{} = 8 cast.ToInt(eight) // 8 cast.ToInt(nil) // 0 - From c9c46a17924c84b0cacac50d0523ed70e41e0a41 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sun, 5 Feb 2023 21:17:45 +0100 Subject: [PATCH 2/5] ci: add Go 1.19 and 1.20 to the build matrix Signed-off-by: Mark Sagi-Kazar --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1817575..d80fdc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - go-version: ['1.16', '1.17', '1.18'] + go-version: ['1.16', '1.17', '1.18', '1.19', '1.20'] steps: - name: Set up Go From b7b9986f2c2e97d7aee51342d4efe6ff7cb1a59e Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sun, 5 Feb 2023 21:18:28 +0100 Subject: [PATCH 3/5] ci: add dependabot config Signed-off-by: Mark Sagi-Kazar --- .github/dependabot.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/dependabot.yaml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..5153b81 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,16 @@ +version: 2 + +updates: + - package-ecosystem: gomod + directory: / + labels: + - dependencies + schedule: + interval: daily + + - package-ecosystem: github-actions + directory: / + labels: + - dependencies + schedule: + interval: daily From cb4b5fb39691151d77c436ad606dfc7fbb9c56a4 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sun, 5 Feb 2023 21:21:24 +0100 Subject: [PATCH 4/5] ci: add a name to the build Signed-off-by: Mark Sagi-Kazar --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d80fdc2..e3501b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ on: jobs: build: + name: Build runs-on: ${{ matrix.os }} strategy: # Fail fast is disabled because there are Go version specific features and tests From 111af0b83989e6796f75cf356ae4febda185b6d1 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sun, 5 Feb 2023 21:23:57 +0100 Subject: [PATCH 5/5] chore: improve badges in readme Signed-off-by: Mark Sagi-Kazar --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c68b910..50cd825 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # cast -[![GoDoc](https://godoc.org/github.com/spf13/cast?status.svg)](https://godoc.org/github.com/spf13/cast) [![Build Status](https://github.com/spf13/cast/actions/workflows/ci.yml/badge.svg)](https://github.com/spf13/cast/actions/workflows/ci.yml) +[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/spf13/cast)](https://pkg.go.dev/mod/github.com/spf13/cast) +![Go Version](https://img.shields.io/badge/go%20version-%3E=1.16-61CFDD.svg?style=flat-square) [![Go Report Card](https://goreportcard.com/badge/github.com/spf13/cast)](https://goreportcard.com/report/github.com/spf13/cast) Easy and safe casting from one type to another in Go