github.com/vnpaycloud-console/gophercloud/v2@v2.0.5/.github/workflows/unit.yaml (about)

     1  on: [push, pull_request]
     2  name: Unit Testing
     3  permissions:
     4    contents: read
     5  
     6  jobs:
     7    test:
     8      permissions:
     9        checks: write  # for coverallsapp/github-action to create a new check based on the results
    10        contents: read  # for actions/checkout to fetch code
    11      runs-on: ubuntu-latest
    12      strategy:
    13        fail-fast: false
    14        matrix:
    15          go-version:
    16            - "1.23.0"
    17            - "1"
    18  
    19      steps:
    20        - name: Setup Go ${{ matrix.go-version }}
    21          uses: actions/setup-go@v5
    22          with:
    23            go-version: ${{ matrix.go-version }}
    24  
    25        - uses: actions/checkout@v4
    26  
    27        - name: Setup environment
    28          run: |
    29            # Changing into a different directory to avoid polluting go.sum with "go get"
    30            cd "$(mktemp -d)"
    31            go mod init unit_tests
    32  
    33            go install github.com/wadey/gocovmerge@master
    34  
    35        - name: Run unit tests
    36          run: |
    37            ./script/coverage
    38            ./script/unittest
    39  
    40        - name: Check coverage
    41          uses: coverallsapp/github-action@v2
    42          with:
    43            file: cover.out
    44            flag-name: Go-${{ matrix.go-version }}
    45            parallel: true
    46  
    47    finish:
    48      permissions:
    49        checks: write  # for coverallsapp/github-action to create a new check based on the results
    50      needs: test
    51      if: ${{ always() }}
    52      runs-on: ubuntu-latest
    53      steps:
    54      - name: Store coverage results
    55        uses: coverallsapp/github-action@v2
    56        with:
    57          parallel-finished: true
    58          carryforward: Go-${{ join(matrix.go-version.*, '-') }}