github.com/apernet/quic-go@v0.43.1-0.20240515053213-5e9e635fd9f0/.github/workflows/lint.yml (about)

     1  on: [push, pull_request]
     2  
     3  jobs:
     4    check:
     5      runs-on: ubuntu-latest
     6      steps:
     7        - uses: actions/checkout@v4
     8        - uses: actions/setup-go@v5
     9          with:
    10            go-version: "1.22.x"
    11        - name: Check that no non-test files import Ginkgo or Gomega
    12          run: .github/workflows/no_ginkgo.sh
    13        - name: Check for //go:build ignore in .go files
    14          run: |
    15            IGNORED_FILES=$(grep -rl '//go:build ignore' . --include='*.go') || true
    16            if [ -n "$IGNORED_FILES" ]; then
    17              echo "::error::Found ignored Go files: $IGNORED_FILES"
    18              exit 1
    19            fi
    20        - name: Check that go.mod is tidied
    21          if: success() || failure() # run this step even if the previous one failed
    22          run: |
    23            cp go.mod go.mod.orig
    24            cp go.sum go.sum.orig
    25            go mod tidy
    26            diff go.mod go.mod.orig
    27            diff go.sum go.sum.orig
    28        - name: Run code generators
    29          if: success() || failure() # run this step even if the previous one failed
    30          run: .github/workflows/go-generate.sh
    31        - name: Check that go mod vendor works
    32          if: success() || failure() # run this step even if the previous one failed
    33          run: |
    34            cd integrationtests/gomodvendor
    35            go mod vendor
    36    golangci-lint:
    37      runs-on: ubuntu-latest
    38      strategy:
    39        fail-fast: false
    40        matrix:
    41          go: [  "1.21.x", "1.22.x" ]
    42      env:
    43        GOLANGCI_LINT_VERSION: v1.56.1
    44      name: golangci-lint (Go ${{ matrix.go }})
    45      steps:
    46        - uses: actions/checkout@v4
    47        - uses: actions/setup-go@v5
    48          with:
    49            go-version: ${{ matrix.go }}
    50        - name: golangci-lint (Linux)
    51          uses: golangci/golangci-lint-action@v4
    52          with:
    53            skip-pkg-cache: true
    54            args: --timeout=3m
    55            version: ${{ env.GOLANGCI_LINT_VERSION }}
    56        - name: golangci-lint (Windows)
    57          if: success() || failure() # run this step even if the previous one failed
    58          uses: golangci/golangci-lint-action@v4
    59          env:
    60            GOOS: "windows"
    61          with:
    62            skip-pkg-cache: true
    63            args: --timeout=3m
    64            version: ${{ env.GOLANGCI_LINT_VERSION }}
    65        - name: golangci-lint (OSX)
    66          if: success() || failure() # run this step even if the previous one failed
    67          uses: golangci/golangci-lint-action@v4
    68          env:
    69            GOOS: "darwin"
    70          with:
    71            skip-pkg-cache: true
    72            args: --timeout=3m
    73            version: ${{ env.GOLANGCI_LINT_VERSION }}
    74        - name: golangci-lint (FreeBSD)
    75          if: success() || failure() # run this step even if the previous one failed
    76          uses: golangci/golangci-lint-action@v4
    77          env:
    78            GOOS: "freebsd"
    79          with:
    80            skip-pkg-cache: true
    81            args: --timeout=3m
    82            version: ${{ env.GOLANGCI_LINT_VERSION }}
    83        - name: golangci-lint (others)
    84          if: success() || failure() # run this step even if the previous one failed
    85          uses: golangci/golangci-lint-action@v4
    86          env:
    87            GOOS: "solaris" # some OS that we don't have any build tags for
    88          with:
    89            skip-pkg-cache: true
    90            args: --timeout=3m
    91            version: ${{ env.GOLANGCI_LINT_VERSION }}