Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 36 additions & 12 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -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 ./...
24 changes: 2 additions & 22 deletions .pre-commit-ci-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)$
Expand Down
4 changes: 2 additions & 2 deletions .project-settings.env
Original file line number Diff line number Diff line change
@@ -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
Loading