Fix an edge case when no backup history is found in msdb #73
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: .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/setup@v1.1.1 | |
with: | |
versionSpec: '5.12.0' | |
- name: Use GitVersion | |
id: gitversion # step id used as reference for output values | |
uses: gittools/actions/gitversion/execute@v1.1.1 | |
- 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" | |
try { | |
Start-Process -FilePath "SqlLocalDB.msi" -Wait -ArgumentList "/qn", "/norestart", "/l*v SqlLocalDBInstall.log", "IACCEPTSQLLOCALDBLICENSETERMS=YES" | |
} | |
catch { | |
Write-Host "Installation failed" | |
Get-Content SqlLocalDBInstall.log | |
throw | |
} | |
Write-Host "Checking" | |
try { | |
sqlcmd -l 60 -S "(localdb)\MSSQLLocalDB" -Q "SELECT @@VERSION;" | |
Write-Host "SqlLocalDB 2019 installed and accessible at (localdb)\MSSQLLocalDB" | |
} | |
catch { | |
Write-Host "Sqlcmd execution failed" | |
throw | |
} | |
- name: Test | |
run: dotnet test --configuration Release | |
env: | |
TEST_SQL_INSTANCE: (localdb)\MSSQLLocalDB | |
- 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/get-release@v1.2.2 | |
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 |