From 13f6e2122a990de2b5c3aa949cd731f451f035a8 Mon Sep 17 00:00:00 2001 From: Tronje Krop Date: Fri, 12 Jan 2024 16:24:44 +0100 Subject: [PATCH] fix: bild script (#68) --- .github/workflows/{go.yaml => build.yaml} | 14 ++++++------- .github/workflows/release.yaml | 25 +++++++++++++++++++++++ Makefile | 10 ++++----- go.mod | 6 +++--- go.sum | 12 +++++------ revive.toml | 6 +++--- 6 files changed, 48 insertions(+), 25 deletions(-) rename .github/workflows/{go.yaml => build.yaml} (61%) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/go.yaml b/.github/workflows/build.yaml similarity index 61% rename from .github/workflows/go.yaml rename to .github/workflows/build.yaml index a0ec808..ab445e3 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/build.yaml @@ -1,5 +1,5 @@ -name: Go -on: [push, pull_request] +name: Go Build +on: [push] jobs: build: runs-on: ubuntu-latest @@ -8,20 +8,18 @@ jobs: uses: actions/checkout@v3 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v3 with: - go-version: ^1.21 + go-version: 1.21 - name: Build and tests env: CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + LANG: en_US.UTF-8 + # using --trace has a side effect on the the test output. run: make --trace all - name: Send coverage report uses: shogo82148/actions-goveralls@v1 with: path-to-profile: ./build/test-all.cover - - - name: Release and publish - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: make --trace release && make --trace publish diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c496ba2 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,25 @@ +name: Go Release +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.21 + + - name: Release new version + env: + GH_TOKEN: ${{ github.token }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: make --trace release + + - name: Publish new version + env: + GH_TOKEN: ${{ github.token }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: make --trace publish || true diff --git a/Makefile b/Makefile index bc4f52c..f74da1c 100644 --- a/Makefile +++ b/Makefile @@ -8,14 +8,14 @@ else endif GOBIN ?= $(shell go env GOPATH)/bin -GOMAKE ?= github.com/tkrop/go-make@v0.0.18 -TARGETS := $(shell command -v go-make >/dev/null || \ - go install $(GOMAKE) && go-make targets) +GOMAKE ?= github.com/tkrop/go-make@v0.0.32 +TARGETS := $(shell command -v $(GOBIN)/go-make >/dev/null || \ + go install $(GOMAKE) >/dev/stderr && $(GOBIN)/go-make targets) # Declare all targets phony to make them available for auto-completion. -.PHONY: $(TARGETS) +.PHONY:: $(TARGETS) # Delegate all targets to go-make in a single call suppressing other targets. $(eval $(wordlist 1,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))::;@:) $(firstword $(MAKECMDGOALS) all):: - $(GOBIN)/go-make $(MAKEFLAGS) $(MAKECMDGOALS); + @$(GOBIN)/go-make $(strip $(MAKEFLAGS) $(MAKECMDGOALS)); diff --git a/go.mod b/go.mod index 2319a94..4755339 100644 --- a/go.mod +++ b/go.mod @@ -2,16 +2,16 @@ module github.com/tkrop/go-testing go 1.21 -toolchain go1.21.5 +toolchain go1.21.6 require ( github.com/golang/mock v1.6.0 github.com/h2non/gock v1.2.0 github.com/huandu/go-clone v1.6.0 github.com/stretchr/testify v1.8.4 - golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc + golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 golang.org/x/text v0.13.0 - golang.org/x/tools v0.16.1 + golang.org/x/tools v0.17.0 ) require ( diff --git a/go.sum b/go.sum index aa93352..f45487a 100644 --- a/go.sum +++ b/go.sum @@ -33,8 +33,8 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM= -golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= @@ -43,8 +43,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -58,8 +58,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= -golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/revive.toml b/revive.toml index 7ca89e4..3eb6572 100644 --- a/revive.toml +++ b/revive.toml @@ -36,9 +36,9 @@ enableAllRules = true disabled = true # Restricted alias naming conflicts with '.'-imports. -# Not supporte by current Codacy revive v1.3.3 +# Not supporte by current Codacy revive v1.2.3 #[rule.import-alias-naming] - # disabled = true +# disabled = true # Exluding '.'-import makes test package separation unnecessary difficult. [rule.dot-imports] @@ -47,7 +47,7 @@ enableAllRules = true # Fails to exclude nolint directives from reporting. # Not supporte by current Codacy revive v1.2.3 #[rule.comment-spacings] - # disabled = true +# disabled = true # Revive v1.2.3 is reporting incorrect empty lines. [rule.empty-lines]