chore(deps): update all microsoft dependencies to v9 (major) #1120
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 Core | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: windows-2022 | |
outputs: | |
nbgv: ${{ steps.nbgv.outputs.SemVer2 }} | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
DOTNET_GENERATE_ASPNET_CERTIFICATE: false | |
solutionpath: src\Dhgms.Nucleotide.sln | |
unittestprojectpath: src\Dhgms.Nucleotide.UnitTests\Dhgms.Nucleotide.UnitTests.csproj | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# java is used by sonar scanner | |
- name: Setup Java 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '17' | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: NBGV | |
id: nbgv | |
uses: dotnet/nbgv@master | |
with: | |
setAllVars: true | |
- name: Install dotnet tools | |
run: | | |
dotnet tool install --global dotMorten.OmdGenerator | |
dotnet tool install --global ConfigValidate | |
dotnet tool install --global dotnet-outdated-tool | |
dotnet tool install --global snitch | |
dotnet tool install --global dotnet-sonarscanner | |
- name: Prepare Artifact Directory | |
run: | | |
mkdir artifacts | |
mkdir artifacts\nupkg | |
mkdir artifacts\outdated | |
mkdir artifacts\snitch | |
mkdir artifacts\omd | |
mkdir artifacts\docfx | |
- name: Restore Packages | |
run: | | |
dotnet restore ${{ env.solutionpath }} /bl:artifacts\\binlog\\restore.binlog | |
- name: Run Sonar Scanner begin | |
if: env.SONAR_TOKEN != '' && env.SONAR_PROJECT_KEY != '' && env.SONAR_ORGANISATION_KEY != '' | |
run: | | |
dotnet sonarscanner begin /k:"${{ env.SONAR_PROJECT_KEY }}" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /o:"${{ env.SONAR_ORGANISATION_KEY }}" /d:sonar.cs.opencover.reportsPaths="artifacts/opencover/**/*.xml" | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} | |
SONAR_ORGANISATION_KEY: ${{ secrets.SONAR_ORGANISATION_KEY }} | |
- name: Run Build | |
run: | | |
dotnet build ${{ env.solutionpath }} --configuration Release --no-restore /bl:artifacts\\binlog\\build.binlog /p:ContinuousIntegrationBuild=true | |
- name: Run Unit Tests | |
run: | | |
dotnet test ${{ env.unittestprojectpath }} --configuration Release --no-build /bl:artifacts\\binlog\\unittest.binlog --nologo --logger GitHubActions --blame-hang-timeout 60000 --results-directory artifacts\opencover --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover | |
- name: Run Sonar Scanner end | |
if: env.SONAR_TOKEN != '' && env.SONAR_PROJECT_KEY != '' && env.SONAR_ORGANISATION_KEY != '' | |
run: | | |
dotnet sonarscanner end /d:sonar.login="${{ env.SONAR_TOKEN }}" | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} | |
SONAR_ORGANISATION_KEY: ${{ secrets.SONAR_ORGANISATION_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Code Coverage | |
shell: bash | |
run: | | |
echo $PWD | |
bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -t ${{ env.CODECOV_TOKEN }} -s '$PWD/artifacts/opencover' -f '*.xml' | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Produce Nuget Packages | |
run: | | |
dotnet pack ${{ env.solutionpath }} --configuration Release --no-build /bl:artifacts\\binlog\\pack.binlog --nologo /p:PackageOutputPath=..\..\artifacts\nuget /p:ContinuousIntegrationBuild=true | |
- name: List outdated packages | |
run: | | |
dotnet outdated -o artifacts\outdated\outdated.json src | |
# - name: XSLT Resharper Duplicate Code Finder output | |
# - name: Output dupfinder to PR comment | |
# only store binlog on failure | |
- name: store binlogs | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binlogs | |
path: artifacts/binlog | |
- name: store docfx | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docfx | |
path: artifacts/docfx | |
- name: store nuget packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget | |
path: artifacts/nuget | |
- name: store omd | |
uses: actions/upload-artifact@v4 | |
with: | |
name: omd | |
path: artifacts/omd | |
- name: store outdated | |
uses: actions/upload-artifact@v4 | |
with: | |
name: outdated | |
path: artifacts/outdated | |
- name: store snitch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: snitch | |
path: artifacts/snitch | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
DOTNET_GENERATE_ASPNET_CERTIFICATE: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download NuGet Packages | |
uses: actions/[email protected] | |
with: | |
name: nuget | |
- name: Changelog | |
uses: glennawatson/ChangeLog@v1 | |
id: changelog | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ needs.build.outputs.nbgv }} | |
release_name: ${{ needs.build.outputs.nbgv }} | |
body: | | |
${{ steps.changelog.outputs.commitLog }} | |
- name: NuGet Push | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }} | |
SOURCE_URL: https://api.nuget.org/v3/index.json | |
run: | | |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg |