github.com/elastic/gosigar@v0.14.3/.github/workflows/ci.yml (about)

     1  ---
     2    name: ci
     3  
     4    on:
     5      workflow_dispatch:
     6      push:
     7        branches:
     8          - master
     9      pull_request:
    10  
    11    permissions:
    12      contents: read
    13  
    14    ## Concurrency only allowed in the main branch.
    15    ## So old builds running for old commits within the same Pull Request are cancelled
    16    concurrency:
    17      group: ${{ github.workflow }}-${{ github.ref }}
    18      cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
    19  
    20    jobs:
    21      lint:
    22        runs-on: ubuntu-latest
    23        steps:
    24          - uses: actions/checkout@v3
    25  
    26          - uses: actions/setup-go@v4
    27            with:
    28              go-version-file: 'go.mod'
    29  
    30          - name: Lint
    31            run: |-
    32              go mod tidy && git diff --exit-code
    33              gofmt -l . | read && echo "Code differs from gofmt's style. Run 'gofmt -w .'" 1>&2 && exit 1 || true
    34              go vet
    35      go-test:
    36        strategy:
    37          fail-fast: false
    38          matrix:
    39            go-version: ['1.15', '1.16']
    40            os: [macos-latest, ubuntu-latest, windows-latest]
    41        runs-on: ${{ matrix.os }}
    42        steps:
    43          - uses: actions/checkout@v3
    44  
    45          - uses: actions/setup-go@v4
    46            with:
    47              go-version: ${{ matrix.go-version }}
    48              cache: true
    49              cache-dependency-path: '**/go.sum'
    50  
    51          - name: Build
    52            run: go build
    53  
    54          - name: Test
    55            run: go test -v ./...
    56  
    57          - name: Run examples
    58            run: ${{ startsWith(matrix.os,'windows') && '.github/examples.bat' || '.github/examples.sh' }}
    59      test:
    60        if: always()
    61        runs-on: ubuntu-latest
    62        needs:
    63          - go-test
    64        steps:
    65          - id: check
    66            uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current
    67            with:
    68              needs: ${{ toJSON(needs) }}
    69          - run: ${{ steps.check.outputs.isSuccess }}