github.com/kubevela/workflow@v0.6.0/.github/workflows/go.yaml (about)

     1  name: Go
     2  
     3  on:
     4    push:
     5      branches:
     6        - main
     7        - release-*
     8    workflow_dispatch: {}
     9    pull_request:
    10      branches:
    11        - main
    12        - release-*
    13  
    14  env:
    15    # Common versions
    16    GO_VERSION: '1.19'
    17    GOLANGCI_VERSION: 'v1.49'
    18  
    19  jobs:
    20  
    21    detect-noop:
    22      runs-on: ubuntu-20.04
    23      outputs:
    24        noop: ${{ steps.noop.outputs.should_skip }}
    25      steps:
    26        - name: Detect No-op Changes
    27          id: noop
    28          uses: fkirc/skip-duplicate-actions@v5.3.0
    29          with:
    30            github_token: ${{ secrets.GITHUB_TOKEN }}
    31            paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
    32            do_not_skip: '["workflow_dispatch", "schedule", "push"]'
    33            concurrent_skipping: false
    34  
    35    staticcheck:
    36      runs-on: ubuntu-20.04
    37      needs: detect-noop
    38      if: needs.detect-noop.outputs.noop != 'true'
    39  
    40      steps:
    41        - name: Setup Go
    42          uses: actions/setup-go@v2
    43          with:
    44            go-version: ${{ env.GO_VERSION }}
    45  
    46        - name: Checkout
    47          uses: actions/checkout@v2
    48          with:
    49            submodules: true
    50  
    51        - name: Cache Go Dependencies
    52          uses: actions/cache@v2
    53          with:
    54            path: .work/pkg
    55            key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
    56            restore-keys: ${{ runner.os }}-pkg-
    57  
    58        - name: Install StaticCheck
    59          run: go install honnef.co/go/tools/cmd/staticcheck@2022.1
    60  
    61        - name: Static Check
    62          run: staticcheck ./...
    63  
    64    lint:
    65      runs-on: ubuntu-20.04
    66      needs: detect-noop
    67      if: needs.detect-noop.outputs.noop != 'true'
    68  
    69      steps:
    70        - name: Setup Go
    71          uses: actions/setup-go@v2
    72          with:
    73            go-version: ${{ env.GO_VERSION }}
    74  
    75        - name: Checkout
    76          uses: actions/checkout@v2
    77          with:
    78            submodules: true
    79  
    80        - name: Cache Go Dependencies
    81          uses: actions/cache@v2
    82          with:
    83            path: .work/pkg
    84            key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
    85            restore-keys: ${{ runner.os }}-pkg-
    86  
    87        # This action uses its own setup-go, which always seems to use the latest
    88        # stable version of Go. We could run 'make lint' to ensure our desired Go
    89        # version, but we prefer this action because it leaves 'annotations' (i.e.
    90        # it comments on PRs to point out linter violations).
    91        - name: Lint
    92          uses: golangci/golangci-lint-action@v3
    93          with:
    94            version: ${{ env.GOLANGCI_VERSION }}