diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62431b3c9..07deb7fcc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,37 +17,20 @@ jobs: # our oldest (officially) supported version and the two upstream-supported versions go: [1.21.x, oldstable, stable] - env: - # avoid downloading any alternate toolchains (https://go.dev/doc/toolchain) - GOTOOLCHAIN: local - steps: - name: checkout source code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: setup go environment - uses: actions/setup-go@v5 + uses: actions/setup-go@v7 with: go-version: ${{ matrix.go }} - - name: install golangci-lint - uses: golangci/golangci-lint-action@v9 - with: - version: v2.14 - install-only: true - - - name: run golangci-lint - run: | - golangci-lint run - cd schema/validate && golangci-lint run --path-prefix schema/validate - - name: run tests run: | set -x make install.tools - make .govet - make .gitvalidation make docs make -C schema test diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5c30099ea..3f1f3a757 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,11 +3,27 @@ name: Lint on: [push, pull_request] jobs: + golangci-lint: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-go@v7 + with: + # Keep in sync with the Go version golangci-lint is built with. + go-version: 1.27.x + - name: install golangci-lint + uses: golangci/golangci-lint-action@v9 + with: + version: v2.14 + install-only: true + - name: run golangci-lint + run: make lint + check-format: runs-on: ubuntu-24.04 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Run make -C schema fmt run: make -C schema fmt - name: Check for changes @@ -16,7 +32,7 @@ jobs: codespell: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: install deps run: pip install --break-system-packages codespell==v2.4.1 - name: run codespell diff --git a/Makefile b/Makefile index 9d2bd3611..bf058ba37 100644 --- a/Makefile +++ b/Makefile @@ -54,14 +54,10 @@ endif version.md: ./specs-go/version.go go run ./.tool/version-doc.go > $@ -HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-) -# this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked. -ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' = '$(1)' && echo 'true') - -test: .govet .golint .gitvalidation - -.govet: - go vet -x ./... +.PHONY: lint +lint: + golangci-lint run + cd schema/validate && golangci-lint run --path-prefix schema/validate # When this is running in GitHub, it will only check the GitHub commit range .gitvalidation: