Skip to content

Commit 4ade331

Browse files
authored
Update CI and Makefile (#619)
1 parent c3756d1 commit 4ade331

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

.github/workflows/gorelease.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ concurrency:
99
cancel-in-progress: true
1010

1111
env:
12-
GO_VERSION: 1.19.x
12+
GO_VERSION: stable
1313
jobs:
1414
gorelease:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Install Go stable
18-
if: env.GO_VERSION != 'tip'
1918
uses: actions/setup-go@v5
2019
with:
2120
go-version: ${{ env.GO_VERSION }}

.github/workflows/release-assets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install Go
1616
uses: actions/setup-go@v5
1717
with:
18-
go-version: 1.20.x
18+
go-version: stable
1919
- name: Checkout code
2020
uses: actions/checkout@v4
2121
- name: Build artifacts

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
test:
99
strategy:
1010
matrix:
11-
go-version: [ 1.16.x, 1.17.x, 1.19.x, 1.20.x, 1.21.x ] # Lowest supported and current stable versions.
11+
go-version: [ 1.16.x, 1.17.x, oldstable, stable ] # Lowest supported and current stable versions.
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Install Go
@@ -29,10 +29,10 @@ jobs:
2929
- name: Run gofmt
3030
run: gofmt -d -e . 2>&1 | tee outfile && test -z "$(cat outfile)" && rm outfile
3131
- name: Run staticcheck
32-
if: matrix.go-version == '1.20.x'
32+
if: matrix.go-version == 'stable'
3333
uses: dominikh/[email protected]
3434
with:
35-
version: "2023.1.3"
35+
version: "latest"
3636
install-go: false
3737
cache-key: ${{ matrix.go }}
3838

@@ -49,7 +49,7 @@ jobs:
4949
go install ./cmd/godog
5050
godog -f progress --strict
5151
- name: Report on code coverage
52-
if: matrix.go-version == '1.17.x'
52+
if: matrix.go-version == 'stable'
5353
uses: codecov/codecov-action@v4
5454
with:
5555
file: ./coverage.txt

Makefile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,32 @@
22

33
VERS ?= $(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
44

5-
FOUND_GO_VERSION := $(shell go version)
6-
EXPECTED_GO_VERSION = 1.17
5+
GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
6+
GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
7+
MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1
8+
MINIMUM_SUPPORTED_GO_MINOR_VERSION = 16
9+
GO_VERSION_VALIDATION_ERR_MSG = Go version $(GO_MAJOR_VERSION).$(GO_MINOR_VERSION) is not supported, please update to at least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION)
10+
711
.PHONY: check-go-version
812
check-go-version:
9-
@$(if $(findstring ${EXPECTED_GO_VERSION}, ${FOUND_GO_VERSION}),(exit 0),(echo Wrong go version! Please install ${EXPECTED_GO_VERSION}; exit 1))
13+
@if [ $(GO_MAJOR_VERSION) -gt $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION) ]; then \
14+
exit 0 ;\
15+
elif [ $(GO_MAJOR_VERSION) -lt $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION) ]; then \
16+
echo '$(GO_VERSION_VALIDATION_ERR_MSG)';\
17+
exit 1; \
18+
elif [ $(GO_MINOR_VERSION) -lt $(MINIMUM_SUPPORTED_GO_MINOR_VERSION) ] ; then \
19+
echo '$(GO_VERSION_VALIDATION_ERR_MSG)';\
20+
exit 1; \
21+
fi
1022

1123
test: check-go-version
1224
@echo "running all tests"
13-
@go install ./...
1425
@go fmt ./...
15-
@go run honnef.co/go/tools/cmd/staticcheck@v0.2.2 github.com/cucumber/godog
16-
@go run honnef.co/go/tools/cmd/staticcheck@v0.2.2 github.com/cucumber/godog/cmd/godog
26+
@go run honnef.co/go/tools/cmd/staticcheck@v0.4.7 github.com/cucumber/godog
27+
@go run honnef.co/go/tools/cmd/staticcheck@v0.4.7 github.com/cucumber/godog/cmd/godog
1728
go vet ./...
1829
go test -race ./...
19-
godog -f progress -c 4
30+
go run ./cmd/godog -f progress -c 4
2031

2132
gherkin:
2233
@if [ -z "$(VERS)" ]; then echo "Provide gherkin version like: 'VERS=commit-hash'"; exit 1; fi

0 commit comments

Comments
 (0)