chore: include test results as pr comments (#374) #404
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: .NET CI Build | |
# https://github.com/adrienverge/yamllint/issues/430 | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- master | |
permissions: | |
contents: read | |
pull-requests: write | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- job: | |
os: windows-latest | |
push: true | |
- job: | |
os: macos-latest | |
- job: | |
os: ubuntu-latest | |
runs-on: ${{ matrix.job.os }} | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
config-file: global.json | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build packages | |
run: dotnet build --no-restore | |
- name: Run tests | |
run: dotnet test --no-build --verbosity normal --logger trx --collect:"XPlat Code Coverage" | |
- name: Generate test report | |
uses: bibipkins/[email protected] | |
if: ${{ always() }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
comment-title: 'Test Results' | |
results-path: tests/FMData.Rest.Tests/**/*.trx | |
coverage-path: tests/FMData.Rest.Tests/**/*.cobertura.xml | |
coverage-type: cobertura | |
coverage-threshold: 70 | |
- name: Push to MyGet | |
env: | |
API_KEY: ${{ secrets.MYGET_FILEMAKER_FEED_API_TOKEN }} | |
if: ${{ matrix.job.push && env.API_KEY != '' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }} | |
run: | | |
dotnet nuget push src/**/*.nupkg --source https://www.myget.org/F/filemaker/api/v2/package --api-key ${{ env.API_KEY }} | |
- name: Tag to Nuget | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_PUSH_API_KEY }} | |
if: ${{ matrix.job.push && env.NUGET_API_KEY != '' && startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
dotnet nuget push src/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ env.NUGET_API_KEY }} |