1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
name: validate
on:
push:
tags:
- v*
branches:
- main
- release-*
pull_request:
schedule:
# Runs at 00:00 UTC every Monday
- cron: '0 0 * * 1'
env:
GO_VERSION: 1.24
permissions:
contents: read
jobs:
lint:
timeout-minutes: 30
permissions:
contents: read
pull-requests: read
checks: write # to allow the action to annotate code in the PR.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 2
- uses: actions/setup-go@v6
with:
go-version: "${{ env.GO_VERSION }}"
- uses: golangci/golangci-lint-action@v8
with:
version: v2.4
# Extra linters, only checking new code from a pull request.
- name: lint-extra
if: github.event_name == 'pull_request'
run: |
golangci-lint run --config .golangci-extra.yml --new-from-rev=HEAD~1
go-fix:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 2
- uses: actions/setup-go@v6
with:
go-version: "${{ env.GO_VERSION }}"
- name: run go fix
run: |
go fix ./...
git diff --exit-code
codespell:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: install deps
# Use a known version of codespell.
run: pip install --break-system-packages codespell==v2.4.1
- name: run codespell
run: codespell
space-at-eol:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- run: if git -P grep -I -n '\s$'; then echo "^^^ extra whitespace at EOL, please fix"; exit 1; fi
deps:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: "${{ env.GO_VERSION }}"
- run: go mod tidy --diff
govulncheck:
runs-on: ubuntu-24.04
steps:
- uses: golang/govulncheck-action@v1
all-done:
needs:
- codespell
- deps
- go-fix
- govulncheck
- lint
- space-at-eol
runs-on: ubuntu-24.04
steps:
- run: echo "All jobs completed"
|