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

Test published applications #1094

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading