Skip to content

Fix ci

Fix ci #131

Workflow file for this run

name: Test
on:
push:
branches:
- main
paths:
- '**.go'
- '**.gotmpl'
- 'go.*'
- '.golangci.yml'
- '.github/workflows/test.yml'
pull_request:
paths:
- '**.go'
- '**.gotmpl'
- 'go.*'
- '.golangci.yml'
- '.github/workflows/test.yml'
env:
GO111MODULE: on
jobs:
Pre-Commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/Library/Caches/go-build
~/AppData/Local/go-build
~/go/pkg/mod
key: go-${{ hashFiles('**/go.sum') }}
restore-keys: go-mod
- name: Setup mdtoc
run: go install sigs.k8s.io/mdtoc@latest
- uses: pre-commit/[email protected]
env:
SKIP: golangci-lint,go-build,go-unit-tests
GolangCI-Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- id: versions
run: |
golangci="$(yq '.repos[] | select(.repo | contains("golangci-lint")) | .rev' .pre-commit-config.yaml)"
echo "golangci=$golangci" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/Library/Caches/go-build
~/AppData/Local/go-build
~/go/pkg/mod
key: go-${{ hashFiles('**/go.sum') }}
restore-keys: go-mod
- name: Run linters
uses: golangci/golangci-lint-action@v6
with:
version: ${{ steps.versions.outputs.golangci }}
Vet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/Library/Caches/go-build
~/AppData/Local/go-build
~/go/pkg/mod
key: go-${{ hashFiles('**/go.sum') }}
restore-keys: go-mod
- name: Run vet
run: go vet
Test:
runs-on: ubuntu-latest
name: Go Tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/Library/Caches/go-build
~/AppData/Local/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
restore-keys: go-mod
- name: Run tests
shell: bash
run: go test -v -cover -race