diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f830d3a..3a61742 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,29 +1,53 @@ --- -# This workflow will build a golang project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go - name: Go on: - push: - branches: [ "main" ] pull_request: - branches: [ "main" ] + push: + branches: [main] jobs: - build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + - name: Load project settings + id: settings + run: | + set -a + source .project-settings.env + set +a + echo "go_version=${GO_VERSION}" >> "$GITHUB_OUTPUT" + echo "gci_prefix=${GCI_PREFIX:-github.com/hyp3rd/hypercache}" >> "$GITHUB_OUTPUT" + echo "golangci_lint_version=${GOLANGCI_LINT_VERSION}" >> "$GITHUB_OUTPUT" + echo "proto_enabled=${PROTO_ENABLED:-true}" >> "$GITHUB_OUTPUT" - name: Set up Go - uses: actions/setup-go@v6 + uses: actions/setup-go@v6.1.0 + with: + go-version: "${{ steps.settings.outputs.go_version }}" + check-latest: true + + - name: Cache Go modules + uses: actions/cache@v5 with: - go-version: '1.25' + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ steps.settings.outputs.go_version }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ steps.settings.outputs.go_version }}- + + - name: Modules download + run: go mod download + + - name: Tidy check + run: | + go mod tidy + git diff --exit-code go.mod go.sum + + - name: Verify + run: go mod verify - name: Build run: go build -v ./... - - - name: Test - run: go test -v ./... diff --git a/.pre-commit-ci-config.yaml b/.pre-commit-ci-config.yaml index 4c23e01..2e6c7a4 100644 --- a/.pre-commit-ci-config.yaml +++ b/.pre-commit-ci-config.yaml @@ -3,9 +3,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - - id: check-json - - id: pretty-format-json - exclude: cspell.json - id: end-of-file-fixer - id: mixed-line-ending - id: trailing-whitespace @@ -16,20 +13,15 @@ repos: files: .*\.(yaml|yml)$ exclude: mkdocs.yml args: [--allow-multiple-documents] - - id: requirements-txt-fixer - repo: https://github.com/adrienverge/yamllint.git - rev: v1.37.1 + rev: v1.38.0 hooks: - id: yamllint files: \.(yaml|yml)$ types: [file, yaml] entry: yamllint --strict -f parsable - - repo: https://github.com/hadolint/hadolint - rev: v2.14.0 - hooks: - - id: hadolint-docker - repo: https://github.com/streetsidesoftware/cspell-cli - rev: v9.3.3 + rev: v9.4.0 hooks: # Spell check changed files - id: cspell @@ -53,15 +45,3 @@ repos: entry: mdl language: ruby files: \.(md|mdown|markdown)$ - - repo: local - hooks: - - id: go-verify - name: go-verify - language: system - entry: ./.pre-commit/go-mod-hook - require_serial: true - - id: gci - name: gci - language: system - entry: ./.pre-commit/gci-hook - require_serial: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e088411..b7b709a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: requirements-txt-fixer - id: no-commit-to-branch - repo: https://github.com/adrienverge/yamllint.git - rev: v1.37.1 + rev: v1.38.0 hooks: - id: yamllint files: \.(yaml|yml)$ diff --git a/.project-settings.env b/.project-settings.env index 6358924..c20586b 100644 --- a/.project-settings.env +++ b/.project-settings.env @@ -1,5 +1,5 @@ -GOLANGCI_LINT_VERSION=v2.7.2 -BUF_VERSION=v1.61.0 +GOLANGCI_LINT_VERSION=v2.8.0 +BUF_VERSION=v1.63.0 GO_VERSION=1.25.5 GCI_PREFIX=github.com/hyp3rd/hypercache PROTO_ENABLED=true