Skip to content

Commit

Permalink
test: Test published applications
Browse files Browse the repository at this point in the history
  • Loading branch information
VMelnalksnis committed Feb 13, 2024
1 parent 918124b commit 602a8fd
Show file tree
Hide file tree
Showing 8 changed files with 1,044 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,44 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

test-published:
name: Test published applications
strategy:
matrix:
include:
- os: ubuntu-latest
command: ./deployment/test-published.sh "Gnomeshade.WebApi.Tests.Integration.Sqlite" "linux-x64" "${{ github.run_number }}"
- os: windows-latest
command: ./deployment/test-published.ps1 "Gnomeshade.Desktop.Tests" "win-x64" "${{ github.run_number }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'source/Gnomeshade.WebApi/Node/package-lock.json'

- name: Cache NuGet packages
uses: actions/[email protected]
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}

- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-${{ runner.os }}-${{ hashFiles('**/WebserverSetup.cs') }}

- run: ${{ matrix.command }}
env:
Admin__Password: ${{ secrets.DEMO_ADMIN_PASSWORD }}
Nordigen__SecretId: ${{ secrets.NORDIGEN_SECRET_ID }}
Nordigen__SecretKey: ${{ secrets.NORDIGEN_SECRET_KEY }}
Serilog__MinimumLevel: Warning

build-deb:
name: Build debian package
runs-on: ubuntu-20.04
Expand Down
36 changes: 36 additions & 0 deletions deployment/test-published.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
param (
[Parameter(Mandatory = $true, Position = 0)]
[System.String]
$Project,
[Parameter(Mandatory = $true, Position = 1)]
[System.String]
$Runtime,
[Parameter(Mandatory = $true, Position = 2)]
[System.Int32]
$RunNumber,
[Parameter(Position = 3)]
[System.String]
$Tag
)

$version = Get-Content version

$dotnetArgs = @()
$dotnetArgs = $dotnetArgs + "publish"
$dotnetArgs = $dotnetArgs + ".\tests\$Project\$Project.csproj"
$dotnetArgs = $dotnetArgs + "--runtime" + $Runtime
$dotnetArgs = $dotnetArgs + "--configuration" + "Release"
$dotnetArgs = $dotnetArgs + "--self-contained"
$dotnetArgs = $dotnetArgs + "-p:AssemblyVersion=$version.$RunNumber"
$dotnetArgs = $dotnetArgs + "-p:InformationalVersion=$version$Tag+$Runtime"
$dotnetArgs = $dotnetArgs + "-p:PublishSingleFile=false"
$dotnetArgs = $dotnetArgs + "/warnAsError"
$dotnetArgs = $dotnetArgs + "/nologo"

& dotnet $dotnetArgs

$testArgs = @()
$testArgs = $testArgs + "test"
$testArgs = $testArgs + ".\tests\$Project\bin\Release\net8.0\$Runtime\$Project.dll"

& dotnet $testArgs
20 changes: 20 additions & 0 deletions deployment/test-published.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
set -e

version=$(tr -d '[:space:]' <version)

./deployment/restore.sh

dotnet publish \
./tests/"$1"/"$1".csproj \
--runtime "$2" \
--configuration Release \
--self-contained \
--no-restore \
-p:AssemblyVersion="$version.$3" \
-p:InformationalVersion="$version$4$2" \
-p:PublishSingleFile=false \
/warnAsError \
/nologo

dotnet test ./tests/"$1"/bin/Release/net8.0/"$2"/publish/"$1".dll
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup Condition="'$(ContinuousIntegrationBuild)' != 'true'">
Expand Down
14 changes: 14 additions & 0 deletions tests/Gnomeshade.TestingHelpers/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,20 @@
"System.Text.Json": "5.0.2"
}
}
},
"net8.0/linux-x64": {
"System.Security.Cryptography.ProtectedData": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
}
},
"net8.0/win-x64": {
"System.Security.Cryptography.ProtectedData": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog=="
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Gnomeshade.WebApi.Tests.Integration</RootNamespace>
<JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault>
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 602a8fd

Please sign in to comment.