From a2fcd14ed74471663280637b356dbb92ae40d992 Mon Sep 17 00:00:00 2001 From: Martin Medek Date: Tue, 12 Nov 2024 14:34:40 +0100 Subject: [PATCH] fixed xbk project path in example appsettingsd --- .github/workflows/ci.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a42e259..4905ca0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,8 @@ on: - "**.sln" env: - XBK_DIR: "${{ github.workspace }}\\..\\xbk" + XBK_DIR: "${{ github.workspace }}\\xbk" + UMT_DIR: "${{ github.workspace }}\\umt" DB_USER: "kentico" DB_PASSWORD: "Asdfg12345!@#$%" XBK_ADMIN_PASSWORD: "admin" @@ -43,13 +44,16 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + with: + path: ${{ env.UMT_DIR }} - name: Setup .NET uses: actions/setup-dotnet@v4 with: - global-json-file: global.json + global-json-file: "${{ env.UMT_DIR}}\\global.json" - name: Install dependencies and build + working-directory: ${{ env.UMT_DIR }} run: | dotnet restore --locked-mode dotnet tool restore @@ -71,12 +75,10 @@ jobs: sqlcmd -Q "sp_addsrvrolemember '${{ env.DB_USER}}', 'sysadmin'; GO" - # TODO remove kentico user after fix - name: Enable SQL authentication run: | Write-Output "SQL Server: Setting Mixed Mode Authentication." New-ItemProperty 'HKLM:\Software\Microsoft\Microsoft SQL Server\MSSQL16.SQLEXPRESS\MSSQLServer\' -Name 'LoginMode' -Value 2 -Force - Write-Output "SQL Server: Forcing Restart of Instance." Restart-Service -Force 'MSSQL$SQLEXPRESS' @@ -89,9 +91,9 @@ jobs: sqlcmd -S "${{ env.SQLSERVER_NAME}}" -U '${{ env.DB_USER}}' -P '${{ env.DB_PASSWORD }}' -Q "SELECT 'Login successful' AS Message" - name: Install kentico templates + working-directory: ${{ env.UMT_DIR }} run: | $XBK_CORE_VERSION = Select-String -Path "Directory.Packages.props" -Pattern ' ${{ env.LICENCE_FILE }} - Write-Output "SQL_SERVER_CONNECTION_STRING: $env:SQL_SERVER_CONNECTION_STRING" dotnet kentico-xperience-dbmanager -- -s "${{ env.SQLSERVER_NAME}}" -d "pwtest" -u "${{ env.DB_USER }}" -p "${{ env.DB_PASSWORD }}" -a "${{ env.XBK_ADMIN_PASSWORD }}" --license-file "${{ env.LICENCE_FILE }}" --use-existing-database --hash-string-salt "" - sqlcmd -S "${{ env.SQLSERVER_NAME}}" -U 'kentico' -P '${{ env.DB_PASSWORD }}' -d "pwtest" -Q "SELECT * FROM CMS_User" - name: Prepare appsettings.json for migration + working-directory: ${{ env.UMT_DIR }} run: | $EXAMPLE_APPSETTINGS = "examples/Kentico.Xperience.UMT.Example.Console/appsettings.json" $CMS_CONNECTION_STRING = (Get-Content "${{ env.XBK_DIR }}/appsettings.json" | ConvertFrom-Json).ConnectionStrings.CMSConnectionString - $appsettings = Get-Content $EXAMPLE_APPSETTINGS | ConvertFrom-Json $appsettings.ConnectionStrings.CMSConnectionString = $CMS_CONNECTION_STRING - $appsettings.WebApplicationPhysicalPath = "${{ env.XBK_DIR }}" + + $appsettings.WebApplicationPhysicalPath = (Get-Item -Path ${{ github.workspace }}).Parent.FullName + "\\xbk" $appsettings | ConvertTo-Json -Compress | Set-Content $EXAMPLE_APPSETTINGS Get-Content $EXAMPLE_APPSETTINGS @@ -135,6 +136,7 @@ jobs: bin\Debug\net8.0\playwright.ps1 install --with-deps - name: Prepare test.runsettings + working-directory: ${{ env.UMT_DIR }} run: | Get-Content "${{ env.XBK_DIR }}\Properties\launchSettings.json" $url = (Get-Content "${{ env.XBK_DIR }}\Properties\launchSettings.json" | ConvertFrom-Json).profiles.kentico_boilerplate.applicationUrl @@ -143,7 +145,6 @@ jobs: Write-Output "Setting XbK URL for tests: $url" (Get-Content test.runsettings) -replace "([^<]*)", "$url" | Set-Content test.runsettings (Get-Content test.runsettings) -replace "([^<]*)", "${{ env.XBK_ADMIN_PASSWORD}}" | Set-Content test.runsettings - (Get-Content test.runsettings) -replace "([^<]*)", "${{ github.workspace}}\\reports" | Set-Content test.runsettings Get-Content test.runsettings - name: Start xbk and run tests @@ -151,12 +152,10 @@ jobs: cd ${{ env.XBK_DIR }} Start-Job -ScriptBlock { dotnet run --project "${{ env.XBK_DIR }}\kentico-boilerplate.csproj" } -Name "XbK" Write-Output "XbK starting..." - $timeout = 100 $elapsed = 0 $url = (Get-Content "${{ env.XBK_DIR }}/Properties/launchSettings.json" | ConvertFrom-Json).profiles.kentico_boilerplate.applicationUrl $url = $url + "/admin" - while ($elapsed -lt $timeout) { try { $response = Invoke-WebRequest -Uri $url -UseBasicParsing @@ -173,7 +172,6 @@ jobs: Start-Sleep -Seconds 5 $elapsed += 5 } - cd ${{ github.workspace }} Write-Output "Running tests..." mkdir reports