Skip to content

add new methods ready for release #17

add new methods ready for release

add new methods ready for release #17

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
# Запускается для ЛЮБОГО pull request, независимо от целевой ветки
branches: [ '**' ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
# Оптимальный набор версий: последняя стабильная + 1 предыдущая
go-version: ['1.22', '1.23']
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Важно для pull_request событий
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./pkg/...
- name: Upload coverage
uses: codecov/codecov-action@v4
if: matrix.go-version == '1.23' && github.event_name == 'pull_request'
with:
file: ./coverage.out
fail_ci_if_error: false
lint:
name: Lint
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/develop'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m
quality:
name: Code Quality
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/develop'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Check formatting
run: |
UNFORMATTED=$(gofmt -s -l .)
if [ -n "$UNFORMATTED" ]; then
echo "Code is not formatted. Run 'go fmt ./...'"
echo "$UNFORMATTED"
exit 1
fi
- name: Run go vet
run: go vet ./...