essentialkaos / goveralls-action

Action for sending coverage data with goveralls

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Action for sending coverage data with goveralls.

Usage

Basic usage example:

name: CI

on:
  push:
    branches: [master, develop]
  pull_request:
    branches: [master]

jobs:
  Go:
    name: Go
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version: '1.19.x'

      - name: Run tests
        run: go test -race -covermode atomic -coverprofile=covprofile ./...

      - name: Send coverage data
        uses: essentialkaos/goveralls-action@v2
        env:
          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          profile: covprofile

Parallel tests example:

name: CI

on:
  push:
    branches: [master, develop]
  pull_request:
    branches: [master]

jobs:
  Go:
    name: Go
    runs-on: ubuntu-latest

    env:
      SRC_DIR: src/github.com/${{ github.repository }}

    strategy:
      matrix:
        go: [ '1.18.x', '1.19.x', '1.20.x' ]

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          path: ${{env.SRC_DIR}}

      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version: ${{ matrix.go }}

      - name: Run tests
        working-directory: ${{env.SRC_DIR}}
        run: go test -race -covermode atomic -coverprofile=covprofile ./...

      - name: Send coverage data
        uses: essentialkaos/goveralls-action@v2
        env:
          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          version: latest
          path: ${{env.SRC_DIR}}
          profile: covprofile
          parallel: true
          flag-name: linux-${{ matrix.go }}

  SendCoverage:
    name: Send Coverage
    runs-on: ubuntu-latest

    needs: Go

    steps:
      - name: Finish parallel tests
        uses: essentialkaos/goveralls-action@v2
        env:
          COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          version: latest
          parallel-finished: true

Options

Option Description Value
profile Path to coverage profile Path
path Path to directory with sources Path
parallel Submit as parallel Boolean
parallel-finished Mark parallel test as finished Boolean
flag-name Job flag name (will be shown in the Coveralls UI) String
shallow Shallow coveralls internal server errors Boolean
version Aligo version Version in semver notation

License

Apache License, Version 2.0

About

Action for sending coverage data with goveralls

License:Apache License 2.0