From 2f803e2fae6f0cbae07f78bb65f27ed264386e58 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 23 Mar 2022 00:20:23 +0300 Subject: [PATCH 1/4] Migrate to go modules + Improve GitHub actions workflows --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/godoc.yml | 2 +- Makefile | 30 ++++++++++++++++++------------ README.md | 10 +++++----- badge_test.go | 2 +- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f7c9d9..a217a28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - go: [ '1.16.x', '1.17.x' ] + go: [ '1.17.x', '1.18.x' ] steps: - name: Set up Go @@ -32,7 +32,7 @@ jobs: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ${{env.SRC_DIR}} @@ -60,7 +60,7 @@ jobs: run: goveralls -service github -coverprofile cover.out - name: Set up Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: '14.x' @@ -88,7 +88,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: '1.16.x' + go-version: '1.17.x' id: go - name: Setup PATH @@ -98,7 +98,7 @@ jobs: echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ${{env.SRC_DIR}} diff --git a/.github/workflows/godoc.yml b/.github/workflows/godoc.yml index 8bf64c0..d789613 100644 --- a/.github/workflows/godoc.yml +++ b/.github/workflows/godoc.yml @@ -10,4 +10,4 @@ jobs: steps: - name: Trigger GoSumDB and PkgGoDev - uses: essentialkaos/pkgre-godoc-action@v1 + uses: essentialkaos/godoc-action@v1 diff --git a/Makefile b/Makefile index 31f1dc4..c0abcbb 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,36 @@ ################################################################################ -# This Makefile generated by GoMakeGen 1.3.2 using next command: -# gomakegen . +# This Makefile generated by GoMakeGen 1.5.1 using next command: +# gomakegen --mod . # # More info: https://kaos.sh/gomakegen ################################################################################ +export GO111MODULE=on + .DEFAULT_GOAL := help -.PHONY = fmt vet git-config deps deps-test test help +.PHONY = fmt vet deps deps-test test mod-init mod-update mod-vendor help ################################################################################ -git-config: ## Configure git redirects for stable import path services - git config --global http.https://pkg.re.followRedirects true - -deps: git-config ## Download dependencies - go get -d -v github.com/golang/freetype - go get -d -v golang.org/x/image/font +deps: mod-update ## Download dependencies -deps-test: git-config ## Download dependencies for tests - go get -d -v pkg.re/essentialkaos/check.v1 +deps-test: deps ## Download dependencies for tests test: ## Run tests go test -covermode=count . +mod-init: ## Initialize new module + go mod init + go mod tidy + +mod-update: ## Download modules to local cache + go mod download + +mod-vendor: ## Make vendored copy of dependencies + go mod vendor + fmt: ## Format source code with gofmt find . -name "*.go" -exec gofmt -s -w {} \; @@ -36,6 +42,6 @@ help: ## Show this info @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-12s\033[0m %s\n", $$1, $$2}' @echo -e '' - @echo -e '\033[90mGenerated by GoMakeGen 1.3.2\033[0m\n' + @echo -e '\033[90mGenerated by GoMakeGen 1.5.1\033[0m\n' ################################################################################ diff --git a/README.md b/README.md index cd3f5d1..771a7ac 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@

- PkgGoDev + PkgGoDev GitHub Actions CI Status GoReportCard Coverage Status @@ -18,16 +18,16 @@ ### Installation -Make sure you have a working Go 1.16+ workspace (_[instructions](https://golang.org/doc/install)_), then: +Make sure you have a working Go 1.17+ workspace (_[instructions](https://golang.org/doc/install)_), then: ````bash -go get -d pkg.re/essentialkaos/go-badge.v1 +go get -d github.com/essentialkaos/go-badge ```` For update to latest stable release, do: ```bash -go get -d -u pkg.re/essentialkaos/go-badge.v1 +go get -d -u github.com/essentialkaos/go-badge ``` ### Usage example @@ -39,7 +39,7 @@ package main import ( "fmt" - "pkg.re/essentialkaos/go-badge.v1" + "github.com/essentialkaos/go-badge" ) // ////////////////////////////////////////////////////////////////////////// // diff --git a/badge_test.go b/badge_test.go index bffe0c8..d510b04 100644 --- a/badge_test.go +++ b/badge_test.go @@ -11,7 +11,7 @@ import ( "io/ioutil" "testing" - . "pkg.re/essentialkaos/check.v1" + . "github.com/essentialkaos/check" ) // ////////////////////////////////////////////////////////////////////////////////// // From 414f63571773ac02cff3685aafa5fe0432994128 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 23 Mar 2022 00:20:38 +0300 Subject: [PATCH 2/4] Migrate to go modules + Improve GitHub actions workflows --- .github/dependabot.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..fc51337 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,30 @@ +version: 2 + +updates: + - package-ecosystem: "gomod" + directory: "/" + target-branch: "develop" + schedule: + interval: "daily" + timezone: "Europe/London" + time: "03:00" + labels: + - "PR • MAINTENANCE" + assignees: + - "andyone" + reviewers: + - "andyone" + + - package-ecosystem: "github-actions" + directory: "/" + target-branch: "develop" + schedule: + interval: "daily" + timezone: "Europe/London" + time: "04:00" + labels: + - "PR • MAINTENANCE" + assignees: + - "andyone" + reviewers: + - "andyone" From a47b205de3901cb4fdbf8085ace2a6b256d6af3d Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 23 Mar 2022 00:21:00 +0300 Subject: [PATCH 3/4] Add module info --- go.mod | 15 +++++++++++++++ go.sum | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..fe8cd00 --- /dev/null +++ b/go.mod @@ -0,0 +1,15 @@ +module github.com/essentialkaos/go-badge + +go 1.17 + +require ( + github.com/essentialkaos/check v1.2.1 + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 + golang.org/x/image v0.0.0-20220321031419-a8550c1d254a +) + +require ( + github.com/kr/pretty v0.3.0 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/rogpeppe/go-internal v1.6.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e87bdd3 --- /dev/null +++ b/go.sum @@ -0,0 +1,20 @@ +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/essentialkaos/check v1.2.1 h1:avvyFy/1acUNwfxwuOLsHeCjfXtMygtbu0lVDr3nxFs= +github.com/essentialkaos/check v1.2.1/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +golang.org/x/image v0.0.0-20220321031419-a8550c1d254a h1:LnH9RNcpPv5Kzi15lXg42lYMPUf0x8CuPv1YnvBWZAg= +golang.org/x/image v0.0.0-20220321031419-a8550c1d254a/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= From d350872b65edaa9846cf8dbe80479eb753a50c18 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 23 Mar 2022 00:21:26 +0300 Subject: [PATCH 4/4] Improve Github CI workflow --- .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 a217a28..e692076 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: - name: Download dependencies working-directory: ${{env.SRC_DIR}} - run: make deps deps-test + run: make deps - name: Download Verdana font working-directory: ${{env.SRC_DIR}}