github.com/ethersphere/bee/v2@v2.2.0/.github/workflows/go.yml (about)

     1  name: Go
     2  
     3  on:
     4    push:
     5      paths-ignore:
     6        - packaging/**
     7      branches:
     8        - 'master'
     9    pull_request:
    10      paths-ignore:
    11        - packaging/**
    12      branches:
    13        - '**'
    14  
    15  jobs:
    16    test:
    17      name: Test
    18      runs-on: ${{ matrix.os }}
    19      strategy:
    20        matrix:
    21          os: [ubuntu-latest, macos-latest, windows-latest]
    22      steps:
    23      - name: Checkout
    24        uses: actions/checkout@v4
    25      - name: Setup Go
    26        uses: actions/setup-go@v5
    27        with:
    28          cache: true
    29          go-version-file: go.mod
    30      - name: Build
    31        run: make build
    32      - name: Test with race detector (Ubuntu and MacOS)
    33        if: matrix.os != 'windows-latest'
    34        run: make test-ci-race
    35      - name: Test without race detector (Windows)
    36        if: matrix.os == 'windows-latest'
    37        run: make test-ci
    38    test-flaky:
    39      name: Test (flaky)
    40      runs-on: ubuntu-latest
    41      continue-on-error: ${{ github.ref == 'refs/heads/master' }}
    42      steps:
    43      - name: Checkout
    44        uses: actions/checkout@v4
    45      - name: Setup Go
    46        uses: actions/setup-go@v5
    47        with:
    48          cache: true
    49          go-version-file: go.mod
    50      - name: Run flaky test
    51        run: make test-ci-flaky
    52        continue-on-error: ${{ github.ref == 'refs/heads/master' }}
    53    lint:
    54      name: Lint
    55      runs-on: ubuntu-latest
    56      steps:
    57      - name: Checkout
    58        uses: actions/checkout@v4
    59        with:
    60          fetch-depth: 0
    61      - name: Setup Go
    62        uses: actions/setup-go@v5
    63        with:
    64          cache: false
    65          go-version-file: go.mod
    66      - name: Commit linting
    67        if: github.ref != 'refs/heads/master'
    68        uses: wagoid/commitlint-github-action@v5
    69      - name: GolangCI-Lint
    70        uses: golangci/golangci-lint-action@v4
    71        with:
    72          skip-cache: false
    73          version: v1.54.1
    74      - name: Whitespace check
    75        run: make check-whitespace
    76      - name: go mod tidy check
    77        uses: katexochen/go-tidy-check@v2
    78    coverage:
    79      name: Coverage Report
    80      if: github.ref == 'refs/heads/master'
    81      runs-on: ubuntu-latest
    82      steps:
    83      - name: Checkout
    84        uses: actions/checkout@v4
    85      - name: Setup Go
    86        uses: actions/setup-go@v5
    87        with:
    88          cache: false
    89          go-version-file: go.mod
    90      - name: Cache Go Modules
    91        uses: actions/cache@v3
    92        with:
    93          path: |
    94            ~/.cache/go-build
    95            ~/go/pkg/mod
    96          key: ${{ runner.os }}-go-coverage-${{ hashFiles('**/go.sum') }}
    97      - name: Test with code coverage
    98        run: make cover=1 test-ci
    99      - name: Upload coverage to Codecov
   100        uses: codecov/codecov-action@v3
   101        with:
   102          token: ${{ secrets.CODECOV_TOKEN }}
   103          fail_ci_if_error: true
   104          files: ./cover.out
   105    trigger-beekeeper:
   106      name: Trigger Beekeeper
   107      runs-on: ubuntu-latest
   108      needs: [test, lint, coverage]
   109      if: github.ref == 'refs/heads/master'
   110      steps:
   111      - name: Checkout
   112        uses: actions/checkout@v4
   113        with:
   114          fetch-depth: 0
   115      - name: Setup Go
   116        uses: actions/setup-go@v5
   117        with:
   118          cache: false
   119          go-version-file: go.mod
   120      - name: Trigger Beekeeper
   121        uses: peter-evans/repository-dispatch@v2
   122        with:
   123          token: ${{ secrets.GHA_PAT_BASIC }}
   124          repository: ${{ github.repository }}
   125          event-type: trigger-beekeeper
   126          client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'