Skip to content

Commit 602a8fd

Browse files
committed
test: Test published applications
1 parent 918124b commit 602a8fd

File tree

8 files changed

+1044
-1
lines changed

8 files changed

+1044
-1
lines changed

.github/workflows/build-and-test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,44 @@ jobs:
5959
token: ${{ secrets.CODECOV_TOKEN }}
6060
fail_ci_if_error: true
6161

62+
test-published:
63+
name: Test published applications
64+
strategy:
65+
matrix:
66+
include:
67+
- os: ubuntu-latest
68+
command: ./deployment/test-published.sh "Gnomeshade.WebApi.Tests.Integration.Sqlite" "linux-x64" "${{ github.run_number }}"
69+
- os: windows-latest
70+
command: ./deployment/test-published.ps1 "Gnomeshade.Desktop.Tests" "win-x64" "${{ github.run_number }}"
71+
runs-on: ${{ matrix.os }}
72+
timeout-minutes: 20
73+
steps:
74+
- uses: actions/checkout@v4.1.1
75+
- uses: actions/setup-dotnet@v4.0.0
76+
- uses: actions/setup-node@v4.0.2
77+
with:
78+
node-version: 18
79+
cache: 'npm'
80+
cache-dependency-path: 'source/Gnomeshade.WebApi/Node/package-lock.json'
81+
82+
- name: Cache NuGet packages
83+
uses: actions/cache@v4.0.0
84+
with:
85+
path: ~/.nuget/packages
86+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
87+
88+
- name: Cache Docker images
89+
uses: ScribeMD/docker-cache@0.3.7
90+
with:
91+
key: docker-${{ runner.os }}-${{ hashFiles('**/WebserverSetup.cs') }}
92+
93+
- run: ${{ matrix.command }}
94+
env:
95+
Admin__Password: ${{ secrets.DEMO_ADMIN_PASSWORD }}
96+
Nordigen__SecretId: ${{ secrets.NORDIGEN_SECRET_ID }}
97+
Nordigen__SecretKey: ${{ secrets.NORDIGEN_SECRET_KEY }}
98+
Serilog__MinimumLevel: Warning
99+
62100
build-deb:
63101
name: Build debian package
64102
runs-on: ubuntu-20.04

deployment/test-published.ps1

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
param (
2+
[Parameter(Mandatory = $true, Position = 0)]
3+
[System.String]
4+
$Project,
5+
[Parameter(Mandatory = $true, Position = 1)]
6+
[System.String]
7+
$Runtime,
8+
[Parameter(Mandatory = $true, Position = 2)]
9+
[System.Int32]
10+
$RunNumber,
11+
[Parameter(Position = 3)]
12+
[System.String]
13+
$Tag
14+
)
15+
16+
$version = Get-Content version
17+
18+
$dotnetArgs = @()
19+
$dotnetArgs = $dotnetArgs + "publish"
20+
$dotnetArgs = $dotnetArgs + ".\tests\$Project\$Project.csproj"
21+
$dotnetArgs = $dotnetArgs + "--runtime" + $Runtime
22+
$dotnetArgs = $dotnetArgs + "--configuration" + "Release"
23+
$dotnetArgs = $dotnetArgs + "--self-contained"
24+
$dotnetArgs = $dotnetArgs + "-p:AssemblyVersion=$version.$RunNumber"
25+
$dotnetArgs = $dotnetArgs + "-p:InformationalVersion=$version$Tag+$Runtime"
26+
$dotnetArgs = $dotnetArgs + "-p:PublishSingleFile=false"
27+
$dotnetArgs = $dotnetArgs + "/warnAsError"
28+
$dotnetArgs = $dotnetArgs + "/nologo"
29+
30+
& dotnet $dotnetArgs
31+
32+
$testArgs = @()
33+
$testArgs = $testArgs + "test"
34+
$testArgs = $testArgs + ".\tests\$Project\bin\Release\net8.0\$Runtime\$Project.dll"
35+
36+
& dotnet $testArgs

deployment/test-published.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
set -e
3+
4+
version=$(tr -d '[:space:]' <version)
5+
6+
./deployment/restore.sh
7+
8+
dotnet publish \
9+
./tests/"$1"/"$1".csproj \
10+
--runtime "$2" \
11+
--configuration Release \
12+
--self-contained \
13+
--no-restore \
14+
-p:AssemblyVersion="$version.$3" \
15+
-p:InformationalVersion="$version$4$2" \
16+
-p:PublishSingleFile=false \
17+
/warnAsError \
18+
/nologo
19+
20+
dotnet test ./tests/"$1"/bin/Release/net8.0/"$2"/publish/"$1".dll

tests/Gnomeshade.TestingHelpers/Gnomeshade.TestingHelpers.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5+
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
56
</PropertyGroup>
67

78
<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' != 'true'">

tests/Gnomeshade.TestingHelpers/packages.lock.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,20 @@
409409
"System.Text.Json": "5.0.2"
410410
}
411411
}
412+
},
413+
"net8.0/linux-x64": {
414+
"System.Security.Cryptography.ProtectedData": {
415+
"type": "Transitive",
416+
"resolved": "4.4.0",
417+
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
418+
}
419+
},
420+
"net8.0/win-x64": {
421+
"System.Security.Cryptography.ProtectedData": {
422+
"type": "Transitive",
423+
"resolved": "4.4.0",
424+
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
425+
}
412426
}
413427
}
414428
}

tests/Gnomeshade.WebApi.Tests.Integration.Sqlite/Gnomeshade.WebApi.Tests.Integration.Sqlite.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<RootNamespace>Gnomeshade.WebApi.Tests.Integration</RootNamespace>
66
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
7+
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
78
</PropertyGroup>
89

910
<ItemGroup>

0 commit comments

Comments
 (0)