Skip to content

update to .net 8

update to .net 8 #67

Workflow file for this run

name: .NET Core
on:
push:
tags:
- '**'
branches:
- main
pull_request:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Dump globals
run: |
echo "github=$GLOBAL_GITHUB"
echo "job=$GLOBAL_JOB"
echo "steps=$GLOBAL_STEPS"
env:
GLOBAL_GITHUB: ${{ toJson(github) }}
GLOBAL_JOB: ${{ toJson(job) }}
GLOBAL_STEPS: ${{ toJson(steps) }}
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.12.0'
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/[email protected]
- uses: actions/setup-java@v3
with:
distribution: 'microsoft' # See 'Supported distributions' for available options
java-version: '11'
- name: Setup SonarScanner
run: dotnet tool install --tool-path tools dotnet-sonarscanner
- name: Setup ReportGenerator
run: dotnet tool install --tool-path tools dotnet-reportgenerator-globaltool
- name: SonarScanner begin
run: tools/dotnet-sonarscanner begin /k:"SqlBackupTools" /o:"lucca" /v:${{ env.GitVersion_FullSemVer }} /d:sonar.login=${{ secrets.SONAR_TOKEN }} /d:sonar.host.url="https://sonarcloud.io/" /d:sonar.coverageReportPaths="./sonarCoverage/SonarQube.xml"
- name: LocalDB
run: |
Write-Host "Downloading"
Import-Module BitsTransfer
Start-BitsTransfer -Source https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SqlLocalDB.msi -Destination SqlLocalDB.msi
Write-Host "Installing"
Start-Process -FilePath "SqlLocalDB.msi" -Wait -ArgumentList "/qn", "/norestart", "/l*v SqlLocalDBInstall.log", "IACCEPTSQLLOCALDBLICENSETERMS=YES";
Write-Host "Checking"
sqlcmd -l 60 -S "(localdb)\MSSQLLocalDB" -Q "SELECT @@VERSION;"
Write-Host "SqlLocalDB 2019 installed and accessible at (localdb)\MSSQLLocalDB"
- name: Test
run: dotnet test --configuration Release /p:CollectCoverage=true --collect:"XPlat Code Coverage" --settings coverlet.runsettings --results-directory:./coverage
env:
TEST_SQL_INSTANCE: (localdb)\MSSQLLocalDB
- name: Merge coverages
run: tools/reportgenerator -reports:./coverage/*/*.xml -targetdir:./sonarCoverage -reporttypes:SonarQube
- name: SonarScanner end
run: tools/dotnet-sonarscanner end /d:sonar.login=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Pack
if: startsWith(github.ref, 'refs/tags/')
run: dotnet publish src\SqlBackupTools\SqlBackupTools.csproj -c Release -o published -r win10-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:VersionPrefix="${{ env.GitVersion_SemVer }}" /p:AssemblyVersion="${{ env.GitVersion_AssemblySemVer }}"
- name: Zip
if: startsWith(github.ref, 'refs/tags/')
run: |
Remove-Item "artifact" -Recurse -ErrorAction Ignore
New-Item -Name "artifact" -ItemType Directory
Compress-Archive -Path published\* -DestinationPath artifact\SqlBackupTools-${{ env.GitVersion_SemVer }}.zip
shell: powershell
- name: Get release
if: startsWith(github.ref, 'refs/tags/')
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Asset
if: startsWith(github.ref, 'refs/tags/')
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: artifact\SqlBackupTools-${{ env.GitVersion_SemVer }}.zip
asset_name: SqlBackupTools-${{ env.GitVersion_SemVer }}.zip
asset_content_type: application/zip