Skip to content

Update sample

Update sample #93

Workflow file for this run

name: Run code tests
on:
pull_request:
branches:
- master
- develop
push:
branches:
- master
- develop
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Use .NET Core SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.x
source-url: https://nuget.pkg.github.com/Shane32/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: dotnet restore
- name: Build solution [Release]
run: dotnet build --no-restore -c Release
- name: Build solution [Debug]
run: dotnet build --no-restore
- name: Test solution [Debug]
run: dotnet test --no-restore --no-build -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:CoverletOutput=../../${{ matrix.os }}.lcov.info
# ==== code coverage reports (ubuntu-latest only) ====
- name: Convert coverage report to clover & htmlsummary format
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: danielpalme/ReportGenerator-GitHub-Action@4.7.1
with:
reports: '${{ matrix.os }}.lcov.info'
targetdir: '.'
reporttypes: 'Clover;HtmlSummary'
tag: 'test_${{ github.run_number }}'
- name: Convert coverage report to html
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: danielpalme/ReportGenerator-GitHub-Action@4.7.1
with:
reports: '${{ matrix.os }}.lcov.info'
targetdir: './cloverreport'
reporttypes: 'Html'
tag: 'test_${{ github.run_number }}'
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: Code coverage artifacts
path: |
${{ matrix.os }}.lcov.info
Clover.xml
cloverreport/**
summary.html
- name: Monitor coverage
if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }}
uses: slavcodev/coverage-monitor-action@1.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clover_file: "Clover.xml"
threshold_alert: 80
threshold_warning: 90
# https://github.com/marketplace/actions/coveralls-github-action
- name: Upload coverage to Coveralls
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ matrix.os }}.lcov.info
parallel: true
flag-name: ${{ matrix.os }}
- name: Upload coverage to Codecov
if: ${{ 0 == 1 }}
uses: codecov/codecov-action@v1
with:
file: ${{ matrix.os }}.lcov.info
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true