Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-111: setting headless mode #12

Merged
merged 24 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4176e98
setting headless mode
dministro Jun 19, 2022
9ce2cab
changing sing to double quotes
dministro Jun 19, 2022
4239408
changing Tests to issue/OSOE-111
dministro Jun 20, 2022
513f533
Merge branch 'dev' of https://github.com/Lombiq/GitHub-Actions into i…
dministro Jun 24, 2022
57dc332
Merge branch 'dev' of https://github.com/Lombiq/GitHub-Actions into i…
dministro Jun 26, 2022
74c0246
adding setup-edge action
dministro Jun 28, 2022
ea2dd0d
fixing typo
dministro Jun 28, 2022
59668f1
fix
dministro Jun 28, 2022
6c6b664
edge version info
dministro Jun 28, 2022
622881e
get edge version again
dministro Jun 28, 2022
90b89d8
test without install
dministro Jun 28, 2022
79d3301
setup edge only on linux
dministro Jun 28, 2022
5d22d1d
fixing typo
dministro Jun 28, 2022
316ff48
fixing variable name
dministro Jun 28, 2022
978bcaf
adding edge to gh path
dministro Jun 28, 2022
139e0ed
comments
dministro Jun 29, 2022
fd40e20
Merge branch 'dev' of https://github.com/Lombiq/GitHub-Actions into i…
dministro Jun 29, 2022
80d5b8b
Update .github/actions/setup-edge-linux/setup-edge.ps1
dministro Jun 29, 2022
d88ad0b
adding conditional setup edge on linux
dministro Jun 29, 2022
9f9b9f2
moving setup edge before test step
dministro Jun 29, 2022
e9831b0
Merge branch 'dev' of https://github.com/Lombiq/GitHub-Actions into i…
dministro Jun 30, 2022
47ba873
docs
dministro Jun 30, 2022
85ecb6b
alphabetical order
dministro Jun 30, 2022
9c579c5
Removing temporary branch references
Piedone Jun 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/actions/setup-edge-linux/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Set up Microsoft Edge on Linux
Piedone marked this conversation as resolved.
Show resolved Hide resolved
description: Sets up Microsoft Edge on Linux.

inputs:
edge-version:
required: false
default: 102.0.1245.39-1
description: Version of Microsoft Edge to set up on Linux.

runs:
using: "composite"
steps:
- name: Set up Microsoft Edge
if: ${{ runner.os == 'Linux' }}
shell: pwsh
run: |
${{ github.action_path }}/setup-edge.ps1 ${{ inputs.edge-version }}
11 changes: 11 additions & 0 deletions .github/actions/setup-edge-linux/setup-edge.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Issue for tool request: https://github.com/actions/virtual-environments/issues/5845.

param(
[string]
$EdgeVersion
)

bash -c "curl -O https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_${EdgeVersion}_amd64.deb"
bash -c "sudo apt install ./microsoft-edge-stable_${EdgeVersion}_amd64.deb"

Write-Output "/opt/microsoft/msedge" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
34 changes: 14 additions & 20 deletions .github/actions/test-dotnet/run-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
param ($Verbosity)

function Configure-Environment($hash) { Set-Item @hash }

# First, we globally set test configurations using environment variables. Then acquire the list of all test projects
# (excluding the two test libraries) and then run each until one fails or all concludes. If a test fails, the output is
# sanitized from unnecessary diagnostics messages from chromedriver if the output doesn't already contain groupings,
# then it wraps them in '::group::<project name>'. If there are already groupings, then it is not possible to nest them
# then it wraps them in "::group::<project name>". If there are already groupings, then it is not possible to nest them
# (https://github.com/actions/runner/issues/802) so that's omitted. The groupings make the output collapsible region on
# the Actions web UI. Note that we use bash to output the log using bash to avoid pwsh wrapping the output to the
# default buffer width.

if ($Env:RUNNER_OS -eq "Windows")
{
Configure-Environment @{
Path = 'Env:\Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate'
Value = 'Server=.\SQLEXPRESS;Database=LombiqUITestingToolbox_{{id}};Integrated Security=True;MultipleActiveResultSets=True;Connection Timeout=60;ConnectRetryCount=15;ConnectRetryInterval=5'
}
$Env:Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate =
"Server=.\SQLEXPRESS;Database=LombiqUITestingToolbox_{{id}};Integrated Security=True;MultipleActiveResultSets=True;Connection Timeout=60;ConnectRetryCount=15;ConnectRetryInterval=5"
}
else
{
Configure-Environment @{
Path = 'Env:\Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate'
Value = 'Server=.;Database=LombiqUITestingToolbox_{{id}};User Id=sa;Password=Password1!;MultipleActiveResultSets=True;Connection Timeout=60;ConnectRetryCount=15;ConnectRetryInterval=5'
}
Configure-Environment @{
Path = 'Env:\Lombiq_Tests_UI__DockerConfiguration__ContainerName'
Value = 'sql2019'
}
$Env:Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate =
"Server=.;Database=LombiqUITestingToolbox_{{id}};User Id=sa;Password=Password1!;MultipleActiveResultSets=True;Connection Timeout=60;ConnectRetryCount=15;ConnectRetryInterval=5"

$Env:Lombiq_Tests_UI__DockerConfiguration__ContainerName = "sql2019"
}

$Env:Lombiq_Tests_UI__BrowserConfiguration__Headless = "true"

$tests = dotnet sln list |
Select-Object -Skip 2 |
Select-String '\.Tests\.' |
Select-String -NotMatch 'Lombiq.Tests.UI.csproj' |
Select-String -NotMatch 'Lombiq.Tests.csproj' |
Select-String "\.Tests\." |
Select-String -NotMatch "Lombiq.Tests.UI.csproj" |
Select-String -NotMatch "Lombiq.Tests.csproj" |
? {
$result = dotnet test --no-restore --list-tests --verbosity $Verbosity $_ 2>&1 | Out-String -Width 9999
-not [string]::IsNullOrEmpty($result) -and $result.Contains('The following Tests are available')
-not [string]::IsNullOrEmpty($result) -and $result.Contains("The following Tests are available")
}

foreach ($test in $tests) {
Expand All @@ -48,7 +42,7 @@ foreach ($test in $tests) {
continue
}

$needsGrouping = (Select-String '::group::' test.out).Length -eq 0
$needsGrouping = (Select-String "::group::" test.out).Length -eq 0

if ($needsGrouping) { echo "::group::Test Failed: $test" }

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/build-and-test-orchard-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ on:
type: number
default: 360
description: Configuration for the timeout-minutes parameter of the workflow. The 360 is GitHub's default.
setup-edge-on-linux:
required: false
type: boolean
default: false
description: Indicates whether to enable setup Edge on Linux.

jobs:
build-and-test:
Expand Down Expand Up @@ -112,6 +117,13 @@ jobs:
with:
location: ${{ inputs.build-directory}}

# Firefox and Chrome browsers are installed by default on ubuntu-latest and windows-latest, and Edge is installed by
# default on windows-latest, so here we install Edge on ubuntu-latest. It seems Linux support is planned here
# (https://github.com/browser-actions/setup-edge), after this completes we can use it.
- name: Set up Edge
uses: Lombiq/GitHub-Actions/.github/actions/setup-edge-linux@dev
if: ${{ inputs.setup-edge-on-linux }}

- name: Tests
uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@dev
with:
Expand Down
5 changes: 3 additions & 2 deletions Docs/Actions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Composite GitHub Actions actions
# Composite GitHub Actions actions



Expand All @@ -11,6 +11,7 @@ In addition to the below short explanations, check out the inline documentation
- `publish-nuget`: Publishes the content of the current directory as a NuGet package.
- `setup-azurite`: Sets up the [Azurite Azure Blob Storage Emulator](https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azurite) via NPM.
- `setup-dotnet`: Sets up the .NET SDK.
- `setup-edge-linux`: Sets up the Microsoft Edge on Linux.
- `setup-sql-server`: Sets up SQL Server with Lombiq-recommended defaults.
- `test-dotnet`: Runs .NET unit and UI tests (with the [Lombiq UI Testing Toolbox for Orchard Core](https://github.com/Lombiq/UI-Testing-Toolbox)), generates a test report, and uploads UI testing failure dumps to artifacts.
- `verify-submodule-pull-request`: Assuming that the current repository is a submodule in another repository, this action verifies that a pull request with a matching issue code has been opened there as well.
- `verify-submodule-pull-request`: Assuming that the current repository is a submodule in another repository, this action verifies that a pull request with a matching issue code has been opened there as well.