github.com/hedzr/evendeep@v0.4.8/.github/workflows/go.yml (about)

     1  name: Go
     2  
     3  on:
     4    push:
     5      branches: [ master ]
     6      # Sequence of patterns matched against refs/tags
     7      tags:
     8        - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
     9    pull_request:
    10      branches: [ master ]
    11      # types: [assigned, opened, synchronize, reopened]
    12  
    13  #on: [push, pull_request]
    14  
    15  jobs:
    16  
    17    test:
    18      strategy:
    19        matrix:
    20          go-version: [ 1.11.x, 1.13.x, 1.17.x, 1.19.x ]
    21          #os: [ubuntu-latest, macos-latest, windows-latest]
    22          os: [ ubuntu-latest ]
    23        fail-fast: false
    24      runs-on: ${{ matrix.os }}
    25      steps:
    26        - name: Install Go
    27          uses: actions/setup-go@v2
    28          with:
    29            go-version: ${{ matrix.go-version }}
    30        - name: Checkout code
    31          uses: actions/checkout@v2
    32        - uses: actions/cache@v2
    33          with:
    34            path: ~/go/pkg/mod
    35            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    36            restore-keys: |
    37              ${{ runner.os }}-go-
    38        - name: Test
    39          run: |
    40            for GOOS in $(go tool dist list|awk -F'/' '{print $1}'|sort -u); do
    41              echo -e "\n\nTESTING FOR $GOOS ...\n"
    42              go test ./...
    43            done
    44  
    45    coverage:
    46      #needs: test
    47      env:
    48        COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
    49        CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
    50      runs-on: ubuntu-latest
    51      steps:
    52        - name: Install Go
    53          uses: actions/setup-go@v2
    54          with:
    55            go-version: 1.19.x
    56        - name: Checkout code
    57          uses: actions/checkout@v2
    58          #with:
    59          #  path: ./src/github.com/${{ github.repository }}
    60        - uses: actions/cache@v2
    61          with:
    62            path: ~/go/pkg/mod
    63            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    64            restore-keys: |
    65              ${{ runner.os }}-go-
    66        - name: Test & Coverage
    67          run: go test -v -coverprofile=profile.cov ./...
    68        - name: Send coverage
    69          uses: shogo82148/actions-goveralls@v1
    70          with:
    71            path-to-profile: profile.cov
    72            parallel: true
    73  
    74    # notifies coveralls that all test jobs are finished
    75    finish-coverage:
    76      name: Finish Coverage
    77      needs: coverage
    78      runs-on: ubuntu-latest
    79      steps:
    80        - uses: shogo82148/actions-goveralls@v1
    81          with:
    82            parallel-finished: true
    83  
    84    do-release:
    85      runs-on: ubuntu-latest
    86      needs: coverage
    87      steps:
    88        - name: Checkout
    89          uses: actions/checkout@v2
    90        - name: Release
    91          uses: softprops/action-gh-release@v1
    92          if: startsWith(github.ref, 'refs/tags/')
    93  
    94  
    95  
    96  
    97  
    98  
    99