Skip to content

update to xunit 3.0 #414

update to xunit 3.0

update to xunit 3.0 #414

Workflow file for this run

name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
test-and-build:
name: Test And Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup .NET 9.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
- name: Setup .NET 8.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Setup .NET 7.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.x
- name: Setup .NET 6.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x
- name: Prep Auth For NuGet
run: dotnet nuget add source --username ${{secrets.NUGETUSERNAME}} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/dibiancoj/index.json"
- uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Dotnet Format
run: dotnet format --verify-no-changes --no-restore --verbosity d
- name: Test
run: dotnet test --collect "XPlat Code Coverage" --filter FullyQualifiedName!~LibraryCore.IntegrationTests --no-build --verbosity minimal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
#verbosity normal will show all completed tests
env: #the env variables below fixes a .net 7 issue where the code coverage is json and doesn't get outputted right. These can be removed once they make a fix https://github.com/coverlet-coverage/coverlet/issues/1391
CollectCoverage: true
CoverletOutputFormat: opencover
- name: Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true # optional (default = false)
token: ${{ secrets.CODECOVERAGETOKEN }}
integration-tests:
name: Integration Tests
runs-on: ${{ matrix.os }}
needs: test-and-build
strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- name: Setup .NET 9.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
- name: Setup .NET 8.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Prep Auth For NuGet
run: dotnet nuget add source --username ${{secrets.NUGETUSERNAME}} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/dibiancoj/index.json"
- name: Docker Compose Up
working-directory: ./IntegrationTests
run: docker compose up -d --remove-orphans
env:
DB_PW: ${{secrets.IntegrationTestSqlPw}}
- name: Core Integration Tests
run: dotnet test ./IntegrationTests/LibraryCore.IntegrationTests/LibraryCore.IntegrationTests.csproj -f net8.0 -c release
env:
Db_ConnectionString: Data Source=localhost;Initial Catalog=IntegrationTest;User Id=sa;Password=${{secrets.IntegrationTestSqlPw}};trustServerCertificate=true
- name: Mongo Integration Tests
run: dotnet test ./IntegrationTests/LibraryCore.IntegrationTests.Mongo/LibraryCore.IntegrationTests.Mongo.csproj -f net8.0 -c release
env:
Db_ConnectionString: mongodb://root:${{secrets.IntegrationTestSqlPw}}@localhost:27017
- name: Kafka Integration Tests
run: dotnet test ./IntegrationTests/LibraryCore.IntegrationTests.Kafka/LibraryCore.IntegrationTests.Kafka.csproj -f net8.0 -c release
- name: Docker Compose Down
working-directory: ./IntegrationTests
run: docker compose down
publish-nuget-package:
name: Publish Nuget Packages
runs-on: ubuntu-latest
needs: [test-and-build, integration-tests]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Setup .NET 6
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.x
- name: Setup .NET 7
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.x
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x
#broke around 11/16. No changes on my end and after .net 7 came out. This step fixes it which I don't like as much.
- name: Prep Auth For NuGet
run: dotnet nuget add source --username ${{secrets.NUGETUSERNAME}} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/dibiancoj/index.json"
- name: Package The Build
run: dotnet pack --configuration Release
- name: Push The Nuget Build
run: dotnet nuget push "**/*.nupkg" --source "github" --api-key ${GITHUB_TOKEN} --skip-duplicate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}