From 98f071f44cae6bd9d30ceac75f27498121e9b0ef Mon Sep 17 00:00:00 2001 From: sanua356 Date: Sun, 26 Oct 2025 17:40:14 +0300 Subject: [PATCH] fix windows pipeline --- .github/workflows/testing_changes.yml | 15 +++++--- ci-scripts/create_sysdba_user_windows.ps1 | 3 ++ ci-scripts/download_firebird_windows.ps1 | 43 +++++++++++++++++++++++ 3 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 ci-scripts/create_sysdba_user_windows.ps1 create mode 100644 ci-scripts/download_firebird_windows.ps1 diff --git a/.github/workflows/testing_changes.yml b/.github/workflows/testing_changes.yml index c87a9bd..a0c2137 100644 --- a/.github/workflows/testing_changes.yml +++ b/.github/workflows/testing_changes.yml @@ -142,10 +142,15 @@ jobs: firebird_password: "test_password" isc_password: "masterkey" + - name: Checkout sources + uses: actions/checkout@v4 + - name: Setup FirebirdSQL ${{ matrix.firebird }} on Windows if: matrix.plataform == 'windows' + shell: pwsh run: | - choco install firebird -params '/SuperClassic' + Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force + ./ci-scripts/download_firebird_windows.ps1 - name: Setup FirebirdSQL ${{ matrix.firebird }} on MacOSX if: matrix.plataform == 'macos' @@ -175,6 +180,7 @@ jobs: $found = Get-ChildItem -File -Recurse -Path $folder -Include $FileName -ea 0 Foreach ($source in $found) { echo " - $source" + Copy-Item -Path $source } } } @@ -183,9 +189,6 @@ jobs: Search-Common-Folders -FileName "fbclient_ms.lib" Search-Common-Folders -FileName "isql.exe" - - name: Checkout sources - uses: actions/checkout@v2 - - name: Create a alias to test.fdb on fb v2 if: matrix.firebird == 'v2' run: | @@ -209,7 +212,9 @@ jobs: - name: Create database test.fdb in fb ${{ matrix.firebird }} on Windows if: matrix.plataform == 'windows' run: | - echo "CREATE DATABASE 'localhost:test.fdb';" | & "C:\Program Files\Firebird\Firebird_5_0\isql.exe" -bail -quiet -z -user SYSDBA -password masterkey + Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force + ./ci-scripts/create_sysdba_user_windows.ps1 + echo "CREATE DATABASE 'localhost:test.fdb';" | & "C:\Program Files\Firebird\isql.exe" -bail -quiet -z -user SYSDBA -password masterkey - name: Create database test.fdb in fb ${{ matrix.firebird }} on MacOSX if: matrix.plataform == 'macos' diff --git a/ci-scripts/create_sysdba_user_windows.ps1 b/ci-scripts/create_sysdba_user_windows.ps1 new file mode 100644 index 0000000..b380184 --- /dev/null +++ b/ci-scripts/create_sysdba_user_windows.ps1 @@ -0,0 +1,3 @@ + Stop-Service -Name 'FirebirdServerDefaultInstance' -Force + cmd /c "echo create user SYSDBA password 'masterkey'; exit; | ""C:\Program Files\Firebird\isql.exe"" -user sysdba employee" + Start-Service -Name 'FirebirdServerDefaultInstance' diff --git a/ci-scripts/download_firebird_windows.ps1 b/ci-scripts/download_firebird_windows.ps1 new file mode 100644 index 0000000..953f154 --- /dev/null +++ b/ci-scripts/download_firebird_windows.ps1 @@ -0,0 +1,43 @@ +$repoApiUrl = "https://api.github.com/repos/FirebirdSQL/firebird/releases/latest" +$outputFolder = "C:\Program Files\Firebird" +$assetNamePattern = "*-windows-x64.zip" + +New-Item -Path $outputFolder -ItemType "Directory" + +try { + $release = Invoke-RestMethod -Uri $repoApiUrl +} catch { + Write-Error "Error get releases: $_" + exit +} + +$asset = $release.assets | Where-Object { $_.name -like $assetNamePattern } | Select-Object -First 1 + +if (-not $asset) { + Write-Host "File by asset '$assetNamePattern' not found." + exit +} + +$downloadUrl = $asset.browser_download_url +$outputPath = Join-Path $outputFolder $asset.name + +Write-Host "Download $($asset.name)..." +try { + Invoke-WebRequest -Uri $downloadUrl -OutFile $outputPath + Write-Host "File successfully written: $outputPath" +} catch { + Write-Error "Error download file: $_" +} + +Expand-Archive -Path $outputPath -DestinationPath $outputFolder -Force + +Remove-Item $outputPath + +Set-Location -Path $outputFolder + +$currentPath = Get-Location + +$runServiceFilename = "./install_service.bat" +& "$runServiceFilename" + +Set-Location $currentPath