Skip to content

feat!: update to .net 10 and MongoDB CS Driver 3.6 #603

feat!: update to .net 10 and MongoDB CS Driver 3.6

feat!: update to .net 10 and MongoDB CS Driver 3.6 #603

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
pull_request:
concurrency:
group: '${{github.workflow}} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
env:
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending .NET CLI telemetry to Microsoft.
DOTNET_CLI_TELEMETRY_OPTOUT: true
BUILD_ARTIFACT_PATH: ${{github.workspace}}/build-artifacts
jobs:
build:
name: Build (${{matrix.os}}, MongoDB ${{matrix.mongodb}})
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [windows-latest, macOS-latest]
mongodb: ['7.0', '8.0']
include:
- os: ubuntu-latest
mongodb: '7.0'
ubuntu: 'jammy'
- os: ubuntu-latest
mongodb: '8.0'
ubuntu: 'jammy'
steps:
- name: Configure MongoDB (MacOS)
if: matrix.os == 'macOS-latest'
run: |
brew tap mongodb/brew
brew update
brew install mongodb-community@${{matrix.mongodb}}
brew services start mongodb-community@${{matrix.mongodb}}
- name: Configure MongoDB (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
wget -qO - https://www.mongodb.org/static/pgp/server-${{matrix.mongodb}}.asc | gpg --dearmor | sudo tee /usr/share/keyrings/mongodb.gpg > /dev/null
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb.gpg ] https://repo.mongodb.org/apt/ubuntu ${{matrix.ubuntu}}/mongodb-org/${{matrix.mongodb}} multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-${{matrix.mongodb}}.list
sudo apt update
sudo apt install mongodb-org
sudo systemctl start mongod
- name: Configure MongoDB (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: |
choco uninstall mongodb mongodb.install
$latestPackageVersion = Get-LatestChocoPackageVersion -TargetVersion ${{matrix.mongodb}} -PackageName "mongodb.install"
choco install mongodb.portable --version=$latestPackageVersion
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test with Coverage
run: dotnet test --no-restore --logger trx --results-directory ${{env.BUILD_ARTIFACT_PATH}}/coverage --collect "XPlat Code Coverage" --settings CodeCoverage.runsettings
- name: Pack
run: dotnet pack --no-build -c Release /p:PackageOutputPath=${{env.BUILD_ARTIFACT_PATH}}
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.os}}-mongo${{matrix.mongodb}}
path: ${{env.BUILD_ARTIFACT_PATH}}
coverage:
name: Process code coverage
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download coverage reports
uses: actions/download-artifact@v4
- name: Install ReportGenerator tool
run: dotnet tool install -g dotnet-reportgenerator-globaltool
- name: Prepare coverage reports
run: reportgenerator -reports:*/coverage/*/coverage.cobertura.xml -targetdir:./ -reporttypes:Cobertura
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
file: Cobertura.xml
fail_ci_if_error: false
- name: Save combined coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: Cobertura.xml