mirror of
https://github.com/mgechev/revive.git
synced 2025-10-08 22:41:54 +02:00
86 lines
2.3 KiB
YAML
86 lines
2.3 KiB
YAML
name: Lint
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
go-mod:
|
|
name: Check go.mod
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: stable
|
|
- name: Check go.mod
|
|
run: |
|
|
go mod tidy
|
|
git diff --exit-code go.mod
|
|
git diff --exit-code go.sum
|
|
|
|
lint-go:
|
|
name: Lint Go
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go and register problem matcher
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: stable
|
|
|
|
- name: Install revive
|
|
run: go install
|
|
|
|
- name: Run revive
|
|
run: revive --config revive.toml ./...
|
|
|
|
- name: Run golangci-lint
|
|
uses: golangci/golangci-lint-action@v8
|
|
with:
|
|
version: v2.2.1
|
|
|
|
lint-md:
|
|
name: Lint Markdown
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: stable
|
|
|
|
- name: Setup mdsf
|
|
uses: hougesen/mdsf@v0.9.5
|
|
|
|
- name: Setup goimports
|
|
# https://pkg.go.dev/golang.org/x/tools/cmd/goimports
|
|
run: go install golang.org/x/tools/cmd/goimports@v0.33.0
|
|
|
|
- name: Setup shfmt
|
|
# https://github.com/mvdan/sh#shfmt
|
|
run: go install mvdan.cc/sh/v3/cmd/shfmt@v3.11.0
|
|
|
|
- name: Setup taplo
|
|
# https://taplo.tamasfe.dev/cli/installation/binary.html
|
|
run: curl -fsSL https://github.com/tamasfe/taplo/releases/download/0.10.0/taplo-linux-x86_64.gz | gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo
|
|
|
|
- name: Verify files format using markdownlint-cli2
|
|
uses: DavidAnson/markdownlint-cli2-action@v20
|
|
with:
|
|
config: .markdownlint-cli2.yaml
|
|
|
|
- name: Verify code snippets using mdsf
|
|
id: verify_snippets
|
|
run: mdsf verify --on-missing-language-definition ignore --on-missing-tool-binary fail-fast .
|
|
|
|
- name: Show diff when mdsf failed
|
|
if: failure() && steps.verify_snippets.outcome == 'failure'
|
|
run: |
|
|
mdsf format --debug --on-missing-language-definition ignore --on-missing-tool-binary fail-fast .
|
|
git diff --exit-code
|