54 lines
2.1 KiB
YAML
54 lines
2.1 KiB
YAML
name: ci
|
|
|
|
# Гейт качества на PR и push в main: vet, тесты с race-детектором, линт,
|
|
# gofmt и проверка tidy. Внутренний CI (Gitea Actions).
|
|
#
|
|
# ВАЖНО: job-контейнер golang:1.27 не содержит Node.js, поэтому
|
|
# actions/checkout не работает — checkout делается вручную через git.
|
|
# Приватный модуль forge-toolkit лежит на том же Gitea, доступ — по токену.
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: backend
|
|
container: golang:1.27
|
|
steps:
|
|
- name: checkout
|
|
run: |
|
|
git clone "https://x-access-token:${{ github.token }}@git.totmin.ru/${{ github.repository }}.git" .
|
|
git checkout -q "${{ github.sha }}"
|
|
- name: configure private modules
|
|
run: |
|
|
git config --global url."https://x-access-token:${{ github.token }}@git.totmin.ru/".insteadOf "https://git.totmin.ru/"
|
|
go env -w GOPRIVATE=git.totmin.ru
|
|
- name: vet
|
|
run: go vet ./...
|
|
- name: test (race)
|
|
run: go test -race ./... -count=1
|
|
|
|
lint:
|
|
runs-on: backend
|
|
container: golang:1.27
|
|
steps:
|
|
- name: checkout
|
|
run: |
|
|
git clone "https://x-access-token:${{ github.token }}@git.totmin.ru/${{ github.repository }}.git" .
|
|
git checkout -q "${{ github.sha }}"
|
|
- name: configure private modules
|
|
run: |
|
|
git config --global url."https://x-access-token:${{ github.token }}@git.totmin.ru/".insteadOf "https://git.totmin.ru/"
|
|
go env -w GOPRIVATE=git.totmin.ru
|
|
- name: install golangci-lint
|
|
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2
|
|
- name: lint
|
|
run: $(go env GOPATH)/bin/golangci-lint run ./...
|
|
- name: gofmt
|
|
run: |
|
|
unformatted=$(gofmt -l .)
|
|
[ -z "$unformatted" ] || { echo "gofmt: требуется форматирование: $unformatted"; exit 1; }
|
|
- name: go mod tidy check
|
|
run: go mod tidy -diff
|