github.com/thanos-io/thanos@v0.32.5/.github/workflows/go.yaml (about)

     1  name: go
     2  
     3  on:
     4    push:
     5      branches:
     6        - main
     7      tags:
     8    pull_request:
     9  
    10  # TODO(bwplotka): Add tests here.
    11  jobs:
    12    cross-build-check:
    13      runs-on: ubuntu-latest
    14      name: Go build for different platforms
    15      env:
    16        GOBIN: /tmp/.bin
    17      steps:
    18        - name: Checkout code
    19          uses: actions/checkout@v3
    20  
    21        - name: Install Go
    22          uses: actions/setup-go@v3
    23          with:
    24            go-version: 1.21.x
    25  
    26        - uses: actions/cache@v3
    27          with:
    28            path: |
    29              ~/.cache/go-build
    30              ~/.cache/golangci-lint
    31              ~/go/pkg/mod
    32            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    33            restore-keys: |
    34              ${{ runner.os }}-go-
    35  
    36        - name: Cross build check
    37          run: make crossbuild
    38  
    39    lint:
    40      runs-on: ubuntu-latest
    41      name: Linters (Static Analysis) for Go
    42      env:
    43        GOBIN: /tmp/.bin
    44      steps:
    45        - name: Checkout code
    46          uses: actions/checkout@v3
    47  
    48        - name: Install Go
    49          uses: actions/setup-go@v3
    50          with:
    51            go-version: 1.21.x
    52  
    53        - uses: actions/cache@v3
    54          with:
    55            path: |
    56              ~/.cache/go-build
    57              ~/.cache/golangci-lint
    58              ~/go/pkg/mod
    59            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    60            restore-keys: |
    61              ${{ runner.os }}-go-
    62  
    63        - name: Format.
    64          run: make format
    65  
    66        - name: Linting & vetting
    67          run: make go-lint
    68  
    69    e2e:
    70      strategy:
    71        fail-fast: false
    72        matrix:
    73          parallelism: [4]
    74          index: [0, 1, 2, 3]
    75      runs-on: ubuntu-latest
    76      name: Thanos end-to-end tests
    77      env:
    78        GOBIN: /tmp/.bin
    79      steps:
    80        - name: Checkout code
    81          uses: actions/checkout@v3
    82  
    83        - name: Install Go.
    84          uses: actions/setup-go@v3
    85          with:
    86            go-version: 1.21.x
    87  
    88        - uses: actions/cache@v3
    89          with:
    90            path: |
    91              ~/.cache/go-build
    92              ~/.cache/golangci-lint
    93              ~/go/pkg/mod
    94            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    95  
    96        - name: Run e2e docker-based tests
    97          run: make test-e2e GH_PARALLEL=${{ matrix.parallelism }} GH_INDEX=${{ matrix.index }}