gitlab.com/infor-cloud/martian-cloud/tharsis/go-limiter@v0.0.0-20230411193226-3247984d5abc/.github/workflows/test.yml (about)

     1  name: Test
     2  
     3  on:
     4    push:
     5      branches:
     6      - main
     7      tags:
     8      - '*'
     9    pull_request:
    10      branches:
    11      - main
    12  
    13  jobs:
    14    # unit runs the unit tests
    15    unit:
    16      strategy:
    17        fail-fast: false
    18        matrix:
    19          go:
    20          - '1.14'
    21          - '1.15'
    22          - '1.16'
    23          - '1.17'
    24          os:
    25          - 'macos-latest'
    26          - 'ubuntu-latest'
    27          - 'windows-latest'
    28  
    29      runs-on: ${{ matrix.os }}
    30  
    31      steps:
    32      - uses: actions/checkout@v2
    33  
    34      - uses: actions/setup-go@v2
    35        with:
    36          go-version: ${{ matrix.go }}
    37  
    38      - uses: actions/cache@v2
    39        with:
    40          path: ~/go/pkg/mod
    41          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    42          restore-keys: |
    43            ${{ runner.os }}-go-
    44  
    45      - name: Lint
    46        run: make fmtcheck staticcheck spellcheck
    47        if: ${{ matrix.os == 'ubuntu-latest' && matrix.go == '1.16' }}
    48  
    49      - name: Test
    50        run: make test
    51  
    52    # build runs go build on the target platforms to ensure the runtime links are
    53    # correct.
    54    build:
    55      strategy:
    56        fail-fast: false
    57        matrix:
    58          goos:
    59          - 'darwin'
    60          - 'freebsd'
    61          - 'linux'
    62          - 'netbsd'
    63          - 'openbsd'
    64          - 'solaris'
    65          - 'windows'
    66          goarch:
    67          - 'amd64'
    68  
    69      runs-on: 'ubuntu-latest'
    70  
    71      steps:
    72      - uses: actions/checkout@v2
    73  
    74      - uses: actions/setup-go@v2
    75        with:
    76          go-version: '1.16'
    77  
    78      - uses: actions/cache@v2
    79        with:
    80          path: ~/go/pkg/mod
    81          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    82          restore-keys: |
    83            ${{ runner.os }}-go-
    84  
    85      - name: Build
    86        env:
    87          GOOS: ${{ matrix.goos }}
    88          GOARCH: ${{ matrix.goarch }}
    89        run: go build ./...