github.com/metacubex/quic-go@v0.44.1-0.20240520163451-20b689a59136/.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.21.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.58.0
    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@v6
    52          with:
    53            args: --timeout=3m
    54            version: ${{ env.GOLANGCI_LINT_VERSION }}
    55        - name: golangci-lint (Windows)
    56          if: success() || failure() # run this step even if the previous one failed
    57          uses: golangci/golangci-lint-action@v6
    58          env:
    59            GOOS: "windows"
    60          with:
    61            args: --timeout=3m
    62            version: ${{ env.GOLANGCI_LINT_VERSION }}
    63        - name: golangci-lint (OSX)
    64          if: success() || failure() # run this step even if the previous one failed
    65          uses: golangci/golangci-lint-action@v6
    66          env:
    67            GOOS: "darwin"
    68          with:
    69            args: --timeout=3m
    70            version: ${{ env.GOLANGCI_LINT_VERSION }}
    71        - name: golangci-lint (FreeBSD)
    72          if: success() || failure() # run this step even if the previous one failed
    73          uses: golangci/golangci-lint-action@v6
    74          env:
    75            GOOS: "freebsd"
    76          with:
    77            args: --timeout=3m
    78            version: ${{ env.GOLANGCI_LINT_VERSION }}
    79        - name: golangci-lint (others)
    80          if: success() || failure() # run this step even if the previous one failed
    81          uses: golangci/golangci-lint-action@v6
    82          env:
    83            GOOS: "solaris" # some OS that we don't have any build tags for
    84          with:
    85            args: --timeout=3m
    86            version: ${{ env.GOLANGCI_LINT_VERSION }}