|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v6 |
| 18 | + |
| 19 | + - name: Set up Go |
| 20 | + uses: actions/setup-go@v6 |
| 21 | + with: |
| 22 | + go-version-file: go.mod |
| 23 | + |
| 24 | + - name: Build |
| 25 | + run: go build -o band ./cmd/band |
| 26 | + |
| 27 | + - name: Test |
| 28 | + run: go test ./... -v |
| 29 | + |
| 30 | + lint: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v6 |
| 35 | + |
| 36 | + - name: Set up Go |
| 37 | + uses: actions/setup-go@v6 |
| 38 | + with: |
| 39 | + go-version-file: go.mod |
| 40 | + |
| 41 | + - name: Run golangci-lint |
| 42 | + uses: golangci/golangci-lint-action@v7 |
| 43 | + |
| 44 | + security: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v6 |
| 49 | + |
| 50 | + - name: Set up Go |
| 51 | + uses: actions/setup-go@v6 |
| 52 | + with: |
| 53 | + go-version-file: go.mod |
| 54 | + |
| 55 | + - name: Install govulncheck |
| 56 | + run: go install golang.org/x/vuln/cmd/govulncheck@latest |
| 57 | + |
| 58 | + - name: Run govulncheck |
| 59 | + run: govulncheck ./... |
| 60 | + |
| 61 | + docs-check: |
| 62 | + if: github.event_name == 'pull_request' |
| 63 | + runs-on: ubuntu-latest |
| 64 | + steps: |
| 65 | + - name: Checkout |
| 66 | + uses: actions/checkout@v6 |
| 67 | + with: |
| 68 | + fetch-depth: 0 |
| 69 | + |
| 70 | + - name: Check for doc updates |
| 71 | + run: | |
| 72 | + BASE=${{ github.event.pull_request.base.sha }} |
| 73 | + HEAD=${{ github.event.pull_request.head.sha }} |
| 74 | + CHANGED=$(git diff --name-only "$BASE" "$HEAD") |
| 75 | +
|
| 76 | + CODE_CHANGED=false |
| 77 | + DOCS_CHANGED=false |
| 78 | +
|
| 79 | + # Check if command surface or flags changed |
| 80 | + if echo "$CHANGED" | grep -qE '^cmd/|^internal/cmdutil/'; then |
| 81 | + CODE_CHANGED=true |
| 82 | + fi |
| 83 | +
|
| 84 | + # Check if any docs were touched |
| 85 | + if echo "$CHANGED" | grep -qE '^README\.md$|^AGENTS\.md$'; then |
| 86 | + DOCS_CHANGED=true |
| 87 | + fi |
| 88 | +
|
| 89 | + if [ "$CODE_CHANGED" = true ] && [ "$DOCS_CHANGED" = false ]; then |
| 90 | + echo "::warning::Command code changed without documentation updates. If this PR adds, removes, or changes commands/flags, please update README.md and/or AGENTS.md." |
| 91 | + fi |
0 commit comments