github.com/go-oss/image@v0.1.1-0.20230517025328-001b78555e78/.github/workflows/test.yml (about)

     1  name: Test
     2  
     3  on:
     4    push:
     5      branches:
     6        - master
     7    pull_request:
     8      branches:
     9        - master
    10  
    11  jobs:
    12    lint:
    13      name: Lint
    14      runs-on: ubuntu-latest
    15      steps:
    16        - uses: actions/checkout@v2
    17        - name: golangci-lint
    18          uses: golangci/golangci-lint-action@v2
    19          with:
    20            version: v1.41
    21  
    22    test:
    23      strategy:
    24        matrix:
    25          go:
    26            - "1.13"
    27            - "1.14"
    28            - "1.15"
    29            - "1.16"
    30      name: Test with Go ${{ matrix.go }}
    31      runs-on: ubuntu-latest
    32      steps:
    33        - uses: actions/checkout@v2
    34        - uses: actions/cache@v2
    35          with:
    36            path: ~/go/pkg/mod
    37            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    38            restore-keys: |
    39              ${{ runner.os }}-go-
    40        - uses: actions/setup-go@v2
    41          with:
    42            go-version: ${{ matrix.go }}
    43        - name: Test
    44          run: go test -v -race ./...
    45  
    46    coverage:
    47      name: Coverage
    48      runs-on: ubuntu-latest
    49      steps:
    50        - uses: actions/checkout@v2
    51        - uses: actions/cache@v2
    52          with:
    53            path: ~/go/pkg/mod
    54            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    55            restore-keys: |
    56              ${{ runner.os }}-go-
    57        - uses: actions/setup-go@v2
    58          with:
    59            go-version: "1.16"
    60        - name: Generate coverage report
    61          run: |
    62            go test -coverprofile=coverage.txt -covermode=atomic ./...
    63        - name: Upload coverage to Codecov
    64          uses: codecov/codecov-action@v1
    65          with:
    66            files: ./coverage.txt
    67            flags: unittests
    68            fail_ci_if_error: true
    69            verbose: true