2023-07-10 15:05:20 +00:00
|
|
|
name: Run linters
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- release/**
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-07-10 15:05:20 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.head_ref || github.run_id }}-lint
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deprecations:
|
|
|
|
name: Deprecated functions
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.base_ref == 'main'
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-07-12 19:26:00 +00:00
|
|
|
- uses: ./.github/actions/set-up-go
|
2023-07-10 15:05:20 +00:00
|
|
|
with:
|
2023-07-12 19:26:00 +00:00
|
|
|
github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-07-10 15:05:20 +00:00
|
|
|
- run: make ci-deprecations
|
|
|
|
name: Check deprecations
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-07-10 15:05:20 +00:00
|
|
|
codechecker:
|
2023-07-12 19:26:00 +00:00
|
|
|
name: Code checks
|
2023-07-10 15:05:20 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.base_ref == 'main'
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-07-12 19:26:00 +00:00
|
|
|
- uses: ./.github/actions/set-up-go
|
2023-07-10 15:05:20 +00:00
|
|
|
with:
|
2023-07-12 19:26:00 +00:00
|
|
|
github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-07-10 15:05:20 +00:00
|
|
|
# Note: if there is a function we want to ignore the nilnil check for,
|
|
|
|
# You can add 'ignore-nil-nil-function-check' somewhere in the
|
|
|
|
# godoc for the function.
|
|
|
|
- run: make ci-vet-codechecker
|
|
|
|
name: Check custom linters
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-07-10 15:05:20 +00:00
|
|
|
format:
|
|
|
|
name: Format
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2023-07-12 19:26:00 +00:00
|
|
|
- uses: ./.github/actions/set-up-go
|
2023-07-10 15:05:20 +00:00
|
|
|
with:
|
2023-07-12 19:26:00 +00:00
|
|
|
github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-07-10 15:05:20 +00:00
|
|
|
- name: Go format
|
|
|
|
run: |
|
|
|
|
make ci-bootstrap
|
|
|
|
echo "Using gofumpt version $(go run mvdan.cc/gofumpt -version)"
|
|
|
|
make fmt
|
|
|
|
if ! git diff --exit-code; then
|
|
|
|
echo "Code has formatting errors. Run 'make fmt' to fix"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-07-12 19:26:00 +00:00
|
|
|
|
2023-07-10 15:05:20 +00:00
|
|
|
semgrep:
|
|
|
|
name: Semgrep
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
image: returntocorp/semgrep@sha256:ffc6f3567654f9431456d49fd059dfe548f007c494a7eb6cd5a1a3e50d813fb3
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
|
|
- name: Run Semgrep Rules
|
|
|
|
id: semgrep
|
|
|
|
run: semgrep ci --include '*.go' --config 'tools/semgrep/ci'
|