github.com/creativeprojects/go-selfupdate@v1.2.0/.github/workflows/build.yml (about)

     1  name: Build
     2  
     3  on:
     4    push:
     5      branches: [ main ]
     6    pull_request:
     7      branches: [ main ]
     8  
     9  jobs:
    10  
    11    build:
    12      name: Build and test
    13      runs-on: ${{ matrix.os }}
    14      strategy:
    15        matrix:
    16          go_version: ['1.21', '1.22']
    17          os: [ubuntu-latest, windows-latest, macos-14]
    18  
    19      steps:
    20  
    21      - name: Check out code into the Go module directory
    22        uses: actions/checkout@v4
    23  
    24      - name: Set up Go ${{ matrix.go_version }}
    25        uses: actions/setup-go@v5
    26        with:
    27          go-version: ${{ matrix.go_version }}
    28          check-latest: true
    29          cache: true
    30  
    31      - name: Get dependencies
    32        run: |
    33          go mod download
    34  
    35      - name: Build
    36        run: go build -v ./...
    37  
    38      - name: Test
    39        shell: bash
    40        run: |
    41          if [[ "${GITHUB_TOKEN}" != "" ]]; then
    42            go test -v -race -coverprofile=coverage.txt . ./update
    43          else
    44            go test -v -race -short -coverprofile=coverage.txt . ./update
    45          fi
    46  
    47      - name: Code coverage with codecov
    48        uses: codecov/codecov-action@v4