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