Show CI pipeline results for master branch only #191
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
# Need pull requests so Coveralls comments get added to pull requests | |
branches: [ master ] | |
# Avoid running the CI on draft PRs (https://github.com/orgs/community/discussions/25722#discussioncomment-3248919) | |
types: [opened, synchronize, reopened, ready_for_review] | |
jobs: | |
build: | |
# Avoid running the CI on draft PRs (https://github.com/orgs/community/discussions/25722#discussioncomment-3248919) | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# Fix for MinVer | |
fetch-depth: 100 | |
# Install all SDK versions targeted in the Test project | |
- name: Setup .NET 5 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.x | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.x | |
- name: Setup .NET 7 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.x | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.x | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
# Test each targeted framework independently to spot errors faster | |
# Generate coverage report for the latest framework only, as coverage on multiple is not supported | |
- name: Test on .NET 8 | |
run: dotnet test --no-restore --verbosity normal --framework net8.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov | |
- name: Test on .NET 7 | |
run: dotnet test --no-restore --verbosity normal --framework net7.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov | |
- name: Test on .NET 6 | |
run: dotnet test --no-restore --verbosity normal --framework net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov | |
- name: Test on .NET 5 | |
run: dotnet test --no-restore --verbosity normal --framework net5.0 | |
- name: Publish coverage report to coveralls.io | |
uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: ./tests/DomainResults.Tests/TestResults/coverage.net7.0.info |