fix: Net8 upgrade #29
Workflow file for this run
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: π οΈ Building library | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- develop | |
- feature/* | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
build: | |
name: π οΈ Build and test | |
runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# dotnet-version: ['3.0', '3.1.x', '5.0.x' ] | |
steps: | |
- name: π¨βπ» Check-out code | |
uses: actions/checkout@v3 | |
- name: π¨βπ§ Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.x | |
8.x | |
- name: π Enable problem matchers | |
run: echo "::add-matcher::.github/matchers/dotnet.json" | |
- name: π¦ΈββοΈ Restore steriods | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: π Load packages | |
run: dotnet restore | |
- name: π οΈ Build code | |
run: dotnet build --configuration Release --no-restore | |
- name: π«£ Testing code | |
run: | | |
echo "## β Test results" >> $GITHUB_STEP_SUMMARY | |
dotnet test --configuration Release -v minimal --no-build --logger GitHubActions '/p:CollectCoverage=true;CoverletOutputFormat="json,lcov,cobertura";MergeWith=${{github.workspace}}/coverage.json;CoverletOutput=${{github.workspace}}/coverage' tests/Sonos.Base.Tests -- RunConfiguration.CollectSourceInformation=true | |
dotnet test --configuration Release -v minimal --no-build --logger GitHubActions '/p:CollectCoverage=true;CoverletOutputFormat="json,lcov,cobertura";MergeWith=${{github.workspace}}/coverage.json;CoverletOutput=${{github.workspace}}/coverage' tests/Sonos.Base.Events.Http.Tests -- RunConfiguration.CollectSourceInformation=true | |
- name: π Code Coverage report | |
run: | | |
dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.1.23 | |
reportgenerator -reports:${{github.workspace}}/coverage.cobertura.xml -targetdir:${{github.workspace}}/report -reporttypes:MarkdownSummaryGithub "-filefilters:-*.g.cs;-*.gen.cs" -verbosity:Warning | |
sed -i 's/# Summary/## π Code Coverage/g' ${{github.workspace}}/report/SummaryGithub.md | |
sed -i 's/## Coverage/### Code Coverage details/g' ${{github.workspace}}/report/SummaryGithub.md | |
cat ${{github.workspace}}/report/*.md >> $GITHUB_STEP_SUMMARY | |
publish: | |
name: π¦ Publish nuget library | |
runs-on: ubuntu-latest | |
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') && github.event_name == 'push' | |
needs: [build] | |
steps: | |
- name: π¨βπ» Check-out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: π¨βπ§ Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.x | |
8.x | |
- name: π Enable problem matchers | |
run: echo "::add-matcher::.github/matchers/dotnet.json" | |
- name: π¦ΈββοΈ Restore steriods | |
uses: actions/cache@v3 | |
with: | |
path: ~/.nuget/packages | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget | |
- name: π οΈ Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.15 | |
with: | |
versionSpec: '5.x' | |
- name: π΅οΈ Determine Version | |
uses: gittools/actions/gitversion/execute@v0.9.15 | |
with: | |
useConfigFile: true | |
additionalArguments: /updateprojectfiles | |
- name: π Load packages | |
run: dotnet restore | |
- name: π οΈ Build code | |
run: dotnet build --configuration Release --no-restore | |
- name: π¦ Pack Sonos.Base | |
run: dotnet pack --configuration Release --no-build --no-restore ./src/Sonos.Base/Sonos.Base.csproj | |
- name: βοΈ Publish Sonos.Base to nuget.org | |
run: dotnet nuget push ./src/Sonos.Base/bin/Release/Sonos.Base.*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
- name: π¦ Pack Sonos.Base.Events.Http | |
run: dotnet pack --configuration Release --no-build --no-restore ./src/Sonos.Base.Events.Http/Sonos.Base.Events.Http.csproj | |
- name: βοΈ Publish Sonos.Base.Events.Http to nuget.org | |
run: dotnet nuget push ./src/Sonos.Base.Events.Http/bin/Release/Sonos.Base.*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} |