Skip to content

Speed optimization for .NET 9.0+ through System.Threading.Lock #2414

Speed optimization for .NET 9.0+ through System.Threading.Lock

Speed optimization for .NET 9.0+ through System.Threading.Lock #2414

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: ${{ matrix.framework }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
checks: write
strategy:
fail-fast: false
matrix:
include:
# Windows
- os: windows-latest
framework: net48
coverage: false
results: results4.trx
artifact: test-results-win48
std: false
flag: net48
publish_nuget: true
- os: windows-latest
framework: netcoreapp3.1
coverage: true
results: results3.trx
artifact: test-results-win3
std: false
flag: win3
publish_nuget: false
- os: windows-latest
framework: net6.0
coverage: true
results: results6.trx
artifact: test-results-win6
std: true
flag: win6
publish_nuget: false
- os: windows-latest
framework: net9.0
coverage: true
results: results9.trx
artifact: test-results-win9
std: true
flag: win9
publish_nuget: false
# macOS
- os: macos-latest
framework: net6.0
coverage: true
results: results.trx
artifact: test-results-mac
std: true
flag: mac
publish_nuget: false
# Linux
- os: ubuntu-latest
framework: net6.0
coverage: true
results: results.trx
artifact: test-results-linux
std: true
flag: linux
publish_nuget: false
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
6.0.x
8.0.x
9.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: |
dotnet test --no-restore --verbosity normal -f ${{ matrix.framework }} \
${{ matrix.coverage && '-p:CollectCoverage=true' || '' }} \
${{ matrix.coverage && '-p:CoverletOutput=TestResults/' || '' }} \
${{ matrix.coverage && '-p:CoverletOutputFormat=lcov' || '' }} \
--logger "trx;LogFileName=${{ matrix.results }}"
shell: bash
- name: Upload test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: ${{ matrix.artifact }}
path: BitFaster.Caching.UnitTests/TestResults/${{ matrix.results }}
- name: Upload test results (.NET Std)
if: ${{ matrix.std }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}-std
path: BitFaster.Caching.UnitTests.Std/TestResults/${{ matrix.results }}
- name: Publish coverage report to coveralls.io
if: ${{ matrix.coverage && matrix.flag != '' }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.${{ matrix.framework }}.info
flag-name: ${{ matrix.flag }}
parallel: true
- name: Publish NuGet artifacts
if: ${{ matrix.publish_nuget }}
uses: actions/upload-artifact@v4
with:
name: NuGet package
path: BitFaster.Caching/bin/Release/
coverage:
name: Coveralls Finished
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true