|
| 1 | +name: Run checks |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +env: |
| 8 | + GO_VERSION: 1.24 |
| 9 | + CODESPELL_VERSION: v2.4.1 |
| 10 | + |
| 11 | +jobs: |
| 12 | + golangci-lint: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + if: | |
| 15 | + github.event_name == 'push' || |
| 16 | + github.event_name == 'pull_request' && |
| 17 | + github.event.pull_request.head.repo.full_name != github.repository |
| 18 | +
|
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - uses: actions/setup-go@v5 |
| 22 | + with: |
| 23 | + go-version: ${{ env.GO_VERSION }} |
| 24 | + |
| 25 | + - uses: golangci/golangci-lint-action@v8 |
| 26 | + name: run golangci-lint with gha format |
| 27 | + continue-on-error: true |
| 28 | + |
| 29 | + - uses: golangci/golangci-lint-action@v8 |
| 30 | + name: run golangci-lint with human-readable format |
| 31 | + |
| 32 | + codespell: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + if: | |
| 35 | + github.event_name == 'push' || |
| 36 | + github.event_name == 'pull_request' && |
| 37 | + github.event.pull_request.head.repo.full_name != github.repository |
| 38 | +
|
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: install codespell |
| 43 | + run: pip3 install codespell==${CODESPELL_VERSION} |
| 44 | + |
| 45 | + - name: run codespell |
| 46 | + run: make codespell |
| 47 | + |
| 48 | + verify-generation: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + if: | |
| 51 | + github.event_name == 'push' || |
| 52 | + github.event_name == 'pull_request' && |
| 53 | + github.event.pull_request.head.repo.full_name != github.repository |
| 54 | +
|
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + - uses: actions/setup-go@v5 |
| 58 | + with: |
| 59 | + go-version: ${{ env.GO_VERSION }} |
| 60 | + |
| 61 | + - name: generate code |
| 62 | + run: go generate ./... |
| 63 | + |
| 64 | + - name: check for changes |
| 65 | + run: | |
| 66 | + if [ -n "$(git status --porcelain)" ]; then |
| 67 | + echo "new files were generated" |
| 68 | + git status --porcelain |
| 69 | + git diff |
| 70 | + exit 1 |
| 71 | + fi |
0 commit comments