Files
any2anexoj/.gitea/workflows/quality.yml
T
natercio 6b4e02a7eb
Generate check / check-changes (pull_request) Successful in 35s
Generate check / verify-generate (pull_request) Skipped
Quality / check-changes (pull_request) Successful in 34s
Quality / check-go-mod-tidy (pull_request) Successful in 37s
Quality / check-go-vet (pull_request) Successful in 1m1s
Quality / check-go-vulncheck (pull_request) Successful in 1m5s
Quality / run-tests (pull_request) Successful in 1m19s
Add job to check for vulnerabilities
2026-08-03 09:22:10 +01:00

100 lines
2.4 KiB
YAML

name: Quality
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
has_go_changes: ${{ steps.check.outputs.has_go_changes }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for Go changes
id: check
run: |
if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.go$|go\.(mod|sum)$'; then
echo "has_go_changes=true" >> $GITHUB_OUTPUT
else
echo "has_go_changes=false" >> $GITHUB_OUTPUT
fi
check-go-mod-tidy:
runs-on: ubuntu-latest
needs: check-changes
if: needs.check-changes.outputs.has_go_changes == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.26
- name: Check tidyness
run: |
go mod tidy
if [ -n "$(git status --porcelain go.mod go.sum)" ]; then
echo "go.mod or go.sum changed after go mod tidy; please run go mod tidy and commit the result" >&2
git diff go.mod go.sum >&2
exit 1
fi
check-go-vet:
runs-on: ubuntu-latest
needs: check-changes
if: needs.check-changes.outputs.has_go_changes == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.26
- name: Run go vet
run: go vet ./...
check-go-vulncheck:
runs-on: ubuntu-latest
needs: check-changes
if: needs.check-changes.outputs.has_go_changes == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.26
- name: Run govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
run-tests:
runs-on: ubuntu-latest
needs: check-changes
if: needs.check-changes.outputs.has_go_changes == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.26
- name: Run Unit tests
run: |
go test -race -covermode atomic -coverprofile=coverage.out ./...