Skip to content

Commit

Permalink
backup init, ci store setup, pipeline for e2e testing preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
jiri-malec committed Oct 22, 2024
1 parent b9f6485 commit db0c0fb
Show file tree
Hide file tree
Showing 1,391 changed files with 30,490 additions and 12 deletions.
114 changes: 104 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: "CI: Build and Test"

on:
push:
branches: [main]
paths:
- "**.cs"
- "**.tsx"
- "**.js"
- "**.csproj"
- "**.props"
- "**.targets"
- "**.sln"
- "**/Client/**/*.json"
branches: [main, feat/automatic_E2E_testing]
# paths:
# - "**.cs"
# - "**.tsx"
# - "**.js"
# - "**.csproj"
# - "**.props"
# - "**.targets"
# - "**.sln"
# - "**/Client/**/*.json"
pull_request:
branches: [main]
paths:
Expand All @@ -35,9 +35,13 @@ jobs:

env:
ASPNETCORE_ENVIRONMENT: CI
DATABASE_BACKUP_FILENAME: ""
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
PROJECT_NAME: DancingGoat
ASPNETCORE_URLS: https://localhost:14070
STATUS_CHECK_URL: https://localhost:14070/status

steps:
- uses: actions/checkout@v4
Expand All @@ -58,9 +62,99 @@ jobs:
--configuration Release `
--no-restore
- name: Get Database Backup Name
run: |
$latestBackup = Get-Content -Path "./database/backups.txt" -TotalCount 1
"DATABASE_BACKUP_FILENAME=$latestBackup" >> $env:GITHUB_ENV
- name: Extract Database Backup
run: |
Expand-Archive `
-Path "./database/${{ env.DATABASE_BACKUP_FILENAME }}.zip" `
-DestinationPath "./database"
- name: Install a SQL Server suite of tools (SQLEngine, SQLPackage)
uses: potatoqualitee/mssqlsuite@9a0136e208df60b8ecb62909f076bc34854fa55a # set as a commit hash for security - v1.7
with:
install: sqlpackage, sqlengine
# TODO: Heslo v otevřené podobě?
sa-password: Pass@12345
version: 2022

- name: Restore Database .bak
# TODO: Heslo v otevřené podobě?
run: |
docker exec sql mkdir /var/opt/mssql/backup
docker cp "./database/${{ env.DATABASE_BACKUP_FILENAME }}" sql:/var/opt/mssql/backup
sqlcmd `
-S localhost `
-d master `
-U "sa" `
-P "Pass@12345" `
-Q "RESTORE DATABASE [XByK_DancingGoat_Zapier] FROM DISK='/var/opt/mssql/backup/${{ env.DATABASE_BACKUP_FILENAME }}' WITH MOVE 'XByK_DancingGoat_Zapier' TO '/var/opt/mssql/data/XByK_DancingGoat_Zapier.mdf', MOVE 'XByK_DancingGoat_Zapier_log' TO '/var/opt/mssql/data/XByK_DancingGoat_Zapier_log.ldf'"
# - name: Restore CI Repository TODO
# working-directory: "./scripts"
# run: |
# ./Restore-CI.ps1

- name: Publish Application
run: |
dotnet publish `
./examples/${{ env.PROJECT_NAME }} `
-c Release `
-o ./publish `
--no-build `
--no-restore
#- name: Install Playwright Dependencies
# TODO: to je blbost
#run: |
# ./test/Kentico.Community.Portal.Web.E2E.Tests/bin/Release/net8.0/playwright.ps1 install

- name: Install Azurite
id: azuright
uses: potatoqualitee/azuright@e56d2754eb15218d507961493bc83ca037216887 # set as a commit hash for security - v1.1


- name: Test Solution
run: |
dotnet test `
--configuration Release `
--no-build `
--no-restore
- name: Run Application and E2E Tests
run: |
# Run the ASP.NET Core app as a background job
cd ./publish
Start-Job -ScriptBlock { dotnet ./${{ env.PROJECT_NAME }}.dll } -Name ${{ env.PROJECT_NAME }}
Receive-Job -Name ${{ env.PROJECT_NAME }}
cd ../
# The ASP.NET Core app can take a few seconds to start, so we delay running tests
# until it is ready, and fail if we go over a maximum wait time
$limit = 15
$attempts = 0
$success = $false
while ($attempts -lt $limit -and -not $success) {
Start-Sleep -Seconds 5
try {
$response = Invoke-WebRequest -Uri ${{ env.STATUS_CHECK_URL }} -Method Get -SkipCertificateCheck
if ($response.StatusCode -eq 200) {
Write-Output "Application is ready."
$success = $true
}
}
catch {
Write-Output "Attempt $attempts - Application not ready yet."
}
$attempts++
}
if (-not $success) {
Write-Output "Application did not respond in time."
exit 1
}
# TODO: Run the E2E tests
# Stop the background ASP.NET Core application
Receive-Job -Name ${{ env.PROJECT_NAME }}
Stop-Job -Name ${{ env.PROJECT_NAME }}
Remove-Job -Name ${{ env.PROJECT_NAME }}
Binary file added database/XByK_DancingGoat_Zapier.bak.zip
Binary file not shown.
1 change: 1 addition & 0 deletions database/backups.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
XByK_DancingGoat_Zapier.bak
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<cms.alternativeform>
<FormClassID>
<CodeName>cms.AlternativeForm</CodeName>
<GUID>7d7cbe11-e101-469f-a4a3-ee452f3982df</GUID>
<ObjectType>cms.class</ObjectType>
</FormClassID>
<FormDefinition>
<form>
<field column="FormID" guid="d65b8a4f-95fb-4a35-9f98-04c2a746f6de" isunique="true" />
<field column="FormDisplayName" columnprecision="0" enabled="true" guid="0be5e0a7-1704-47dc-b063-5e6fb3e91c46" visible="true">
<settings>
<controlname>Kentico.Administration.TextInput</controlname>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.uiforms.FormDisplayName$}</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
</properties>
</field>
<field column="FormName" columnprecision="0" enabled="true" guid="4c90ce6a-e202-4035-a51d-f27469743148" visible="true">
<settings>
<controlname>Kentico.Administration.CodeName</controlname>
<HasAutomaticCodeNameGenerationOption>False</HasAutomaticCodeNameGenerationOption>
<IsCollapsed>True</IsCollapsed>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.uiforms.FormName$}</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
</properties>
</field>
<field column="FormClassID" guid="5a4749e1-d4b8-4753-9b2e-298433d675c6" />
<field column="FormDefinition" guid="a1307cae-635b-48b5-a291-e992f746fc9e" />
<field column="FormGUID" guid="b1ff5048-0f5d-462f-818a-b6c582e45db1" />
<field column="FormLastModified" columnprecision="7" guid="12a04abb-af1c-493c-9350-c8c08f5736ff" />
<field column="FormCoupledClassID" guid="b9cb787e-87b6-4ebe-86ba-71470ae3e698" />
<field column="FormCustomizedColumns" guid="f2d242dd-c4ea-40f3-96f0-cd5ba27c13ce" />
<field column="FormIsCustom" guid="c587b0d7-34e7-4608-8e5e-de0cc240f898" />
</form>
</FormDefinition>
<FormDisplayName>FormEdit</FormDisplayName>
<FormGUID>0a4c1c76-35e4-431d-86a9-bc1ed1f310f8</FormGUID>
<FormIsCustom>False</FormIsCustom>
<FormName>FormEdit</FormName>
</cms.alternativeform>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<cms.alternativeform>
<FormClassID>
<CodeName>CMS.Channel</CodeName>
<GUID>4c9def5a-eaa9-4193-94e6-5fdcae2a4bd9</GUID>
<ObjectType>cms.class</ObjectType>
</FormClassID>
<FormDefinition>
<form>
<field column="ChannelID" guid="33aa7dc4-e6c8-4453-a459-423f92b0e606" enabled="" />
<field column="ChannelDisplayName" enabled="true" guid="81347e19-7cd9-4aa3-9045-73c9b9478783" visible="true">
<settings>
<controlname>Kentico.Administration.TextInput</controlname>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.channels.channel.displayname$}</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
</properties>
</field>
<field column="ChannelName" enabled="true" guid="fc533407-2fa5-4530-a5e2-7f972e0db992" visible="true">
<settings>
<controlname>Kentico.Administration.CodeName</controlname>
<HasAutomaticCodeNameGenerationOption>True</HasAutomaticCodeNameGenerationOption>
<IsCollapsed>True</IsCollapsed>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.channels.channel.codename$}</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
</properties>
</field>
<field column="ChannelType" enabled="true" guid="d4aa1a02-2270-47f0-a44c-e84f8c011591" visible="true">
<settings>
<controlname>Kentico.Administration.DropDownSelector</controlname>
<Options>
<![CDATA[
Website;{$base.channels.channel.website.caption$}
Email;{$base.channels.channel.email.caption$}
Headless;{$base.channels.channel.headless.caption$}
]]>
</Options>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.channels.channel.type$}</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
</properties>
</field>
<field column="ChannelGUID" guid="1e802beb-f06d-4575-b5d0-f66c365fa1e1" enabled="" />
<field column="ChannelSize" enabled="true" guid="cd7665d1-05f5-40e9-a140-da05df9abd83" visible="true">
<settings>
<controlname>Kentico.Administration.DropDownSelector</controlname>
<OptionsValueSeparator>;</OptionsValueSeparator>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.channels.channel.size.label$}</fieldcaption>
<fielddescription>{$base.channels.channel.size.tooltip$}</fielddescription>
<fielddescriptionashtml>True</fielddescriptionashtml>
<defaultvalue />
</properties>
</field>
</form>
</FormDefinition>
<FormDisplayName>Create channel</FormDisplayName>
<FormGUID>9f2f4a51-77ef-4180-b57d-92167b83aadb</FormGUID>
<FormIsCustom>False</FormIsCustom>
<FormName>ChannelCreate</FormName>
</cms.alternativeform>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<cms.alternativeform>
<FormClassID>
<CodeName>CMS.Channel</CodeName>
<GUID>4c9def5a-eaa9-4193-94e6-5fdcae2a4bd9</GUID>
<ObjectType>cms.class</ObjectType>
</FormClassID>
<FormDefinition>
<form>
<field column="ChannelID" guid="33aa7dc4-e6c8-4453-a459-423f92b0e606" enabled="" />
<field column="ChannelDisplayName" enabled="true" guid="81347e19-7cd9-4aa3-9045-73c9b9478783" visible="true">
<settings>
<controlname>Kentico.Administration.TextInput</controlname>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.channels.channel.displayname$}</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
</properties>
</field>
<field column="ChannelName" enabled="true" guid="fc533407-2fa5-4530-a5e2-7f972e0db992" visible="true">
<settings>
<controlname>Kentico.Administration.CodeName</controlname>
<HasAutomaticCodeNameGenerationOption>False</HasAutomaticCodeNameGenerationOption>
<IsCollapsed>True</IsCollapsed>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.channels.channel.codename$}</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
</properties>
</field>
<field column="ChannelType" guid="d4aa1a02-2270-47f0-a44c-e84f8c011591" visible="true" enabled="">
<settings>
<controlname>Kentico.Administration.DropDownSelector</controlname>
<Options>
<![CDATA[
Website;{$base.channels.channel.website.caption$}
Email;{$base.channels.channel.email.caption$}
Headless;{$base.channels.channel.headless.caption$}
]]>
</Options>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.channels.channel.type$}</fieldcaption>
<fielddescriptionashtml>False</fielddescriptionashtml>
</properties>
</field>
<field column="ChannelGUID" guid="1e802beb-f06d-4575-b5d0-f66c365fa1e1" enabled="" />
<field column="ChannelSize" enabled="true" guid="cd7665d1-05f5-40e9-a140-da05df9abd83" visible="true">
<settings>
<controlname>Kentico.Administration.DropDownSelector</controlname>
<Options>
<![CDATA[
Standard;{$base.channels.channel.size.standard$}
Micro;{$base.channels.channel.size.micro$}
]]>
</Options>
<OptionsValueSeparator>;</OptionsValueSeparator>
</settings>
<properties>
<explanationtextashtml>False</explanationtextashtml>
<fieldcaption>{$base.channels.channel.size.label$}</fieldcaption>
<fielddescription>{$base.channels.channel.size.tooltip$}</fielddescription>
<fielddescriptionashtml>True</fielddescriptionashtml>
</properties>
</field>
</form>
</FormDefinition>
<FormDisplayName>Edit channel</FormDisplayName>
<FormGUID>955397a3-6ad5-4032-88da-23f4caf3fa6a</FormGUID>
<FormIsCustom>False</FormIsCustom>
<FormName>ChannelEdit</FormName>
</cms.alternativeform>
Loading

0 comments on commit db0c0fb

Please sign in to comment.