github.com/yaoapp/kun@v0.9.0/.github/workflows/unit-test.yml (about)

     1  name: UnitTest
     2  
     3  on:
     4    push:
     5      branches: [main]
     6    pull_request:
     7      branches: [main]
     8  
     9  jobs:
    10    unit-test:
    11      runs-on: ubuntu-latest
    12      strategy:
    13        matrix:
    14          go: [1.13, 1.17]
    15      steps:
    16        - name: Setup Cache
    17          uses: actions/cache@v2
    18          with:
    19            path: |
    20              ~/.cache/go-build
    21              ~/go/pkg/mod
    22            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    23            restore-keys: |
    24              ${{ runner.os }}-go-
    25  
    26        - name: Checkout Code
    27          uses: actions/checkout@v2
    28  
    29        - name: Setup Go ${{ matrix.go }}
    30          uses: actions/setup-go@v2
    31          with:
    32            go-version: ${{ matrix.go }}
    33  
    34        - name: Setup Go Tools
    35          run: |
    36            if [[ "${GO111MODULE}" = "on" ]]; then go mod download; fi
    37            if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
    38            if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
    39  
    40        - name: Run Test
    41          run: |
    42            make vet
    43            make fmt-check
    44            make misspell-check
    45            make test
    46  
    47        - name: Codecov Report
    48          uses: codecov/codecov-action@v2