Merge pull request #34 from argon-it/feature/approve-flow-format #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |