Skip to content

feat: approve flow format, adaptive throttler, write guard #22

feat: approve flow format, adaptive throttler, write guard

feat: approve flow format, adaptive throttler, write guard #22

Workflow file for this run

name: CI
on:
push:
branches: [dev]
pull_request:
branches: [dev]
permissions:
contents: write
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.1'
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
ci:
name: CI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25.1'
cache: true
- name: Auto-format
if: github.event_name == 'push'
run: gofmt -w .
- name: Commit formatting
if: github.event_name == 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
changed=$(git diff --name-only)
if [ -n "$changed" ]; then
count=$(echo "$changed" | wc -l)
git add -A
git commit -m "chore: auto-format ($count files)"
git push
fi
- name: Check formatting
if: github.event_name == 'pull_request'
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "::error::Files not formatted. Run 'gofmt -w .' locally."
echo "$unformatted"
exit 1
fi
- name: Build
run: go build ./...
- name: Build (dev)
run: go build -tags dev ./...
- name: Vet
run: go vet ./...
- name: Test with coverage
run: go test -coverprofile=coverage.out -timeout 300s ./...
- name: Coverage summary
if: always()
run: |
if [ -f coverage.out ]; then
echo "### Coverage Summary"
go tool cover -func=coverage.out | tail -1
fi
- name: Upload coverage profile
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-profile
path: coverage.out
retention-days: 30