github.com/hamba/timex@v1.2.1-0.20240304044353-56d3de3a9ed9/.github/workflows/test.yml (about)

     1  on:
     2    push:
     3      branches:
     4        - main
     5    pull_request:
     6  
     7  name: run tests
     8  jobs:
     9    test:
    10  
    11      strategy:
    12        matrix:
    13          go-version: [ "1.21", "1.22" ]
    14      runs-on: ubuntu-latest
    15      env:
    16        GOLANGCI_LINT_VERSION: v1.56.1
    17  
    18      steps:
    19        - name: Install Go
    20          if: success()
    21          uses: actions/setup-go@v5
    22          with:
    23            go-version: ${{ matrix.go-version }}
    24  
    25        - name: Checkout code
    26          uses: actions/checkout@v4
    27  
    28        - name: Cache Go modules
    29          uses: actions/cache@v4
    30          with:
    31            path: ~/go/pkg/mod
    32            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    33            restore-keys: |
    34              ${{ runner.os }}-go-
    35  
    36        - name: Run linter
    37          uses: golangci/golangci-lint-action@v4
    38          with:
    39            version: ${{ env.GOLANGCI_LINT_VERSION }}
    40            args: --go ${{ matrix.go-version }}
    41  
    42        - name: Run tests
    43          run: go test -covermode=count -coverprofile=coverage.out ./...
    44  
    45        - name: Convert coverage.out to coverage.lcov
    46          uses: jandelgado/gcov2lcov-action@v1
    47        - name: Coveralls
    48          uses: coverallsapp/github-action@v2.2.3
    49          with:
    50            github-token: ${{ secrets.GITHUB_TOKEN }}
    51            path-to-lcov: coverage.lcov