Files
meeting-assistant/.gitea/workflows/pr-push-build-and-test.yaml
T

172 lines
6.3 KiB
YAML

name: PR and Push Build/Test
on:
pull_request:
push:
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
DOTNET_NOLOGO: "1"
WINEDEBUG: "-all"
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"
- name: Install Wine
run: |
export DEBIAN_FRONTEND=noninteractive
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y --no-install-recommends wine64 wine32 winbind unzip
if [ -d /usr/lib/wine ]; then
echo "/usr/lib/wine" >> "${GITHUB_PATH}"
export PATH="${PATH}:/usr/lib/wine"
fi
if command -v wine >/dev/null 2>&1; then
WINE_BIN="$(command -v wine)"
elif command -v wine64 >/dev/null 2>&1; then
WINE_BIN="$(command -v wine64)"
elif [ -x /usr/lib/wine/wine64 ]; then
WINE_BIN="/usr/lib/wine/wine64"
elif [ -x /usr/lib/wine/wine ]; then
WINE_BIN="/usr/lib/wine/wine"
else
echo "No wine binary found after installation."
ls -la /usr/lib/wine || true
exit 1
fi
echo "WINE_BIN=${WINE_BIN}" >> "${GITHUB_ENV}"
"${WINE_BIN}" --version
- name: Restore (portable tests for Windows/Wine)
run: |
dotnet restore MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
-p:EnableWindowsTargeting=true \
-r win-x64
- name: Build (portable tests for Windows/Wine)
run: |
dotnet build MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
-c Release \
--no-restore \
-p:EnableWindowsTargeting=true \
-p:RuntimeIdentifier=win-x64 \
--nologo
- name: Install Windows .NET SDK for Wine
run: |
SDK_VERSION="$(dotnet --version)"
WIN_DOTNET_DIR="${RUNNER_TEMP}/dotnet-win"
WIN_DOTNET_ZIP="${RUNNER_TEMP}/dotnet-sdk-win-x64.zip"
echo "Using SDK version: ${SDK_VERSION}"
curl -fSL "https://builds.dotnet.microsoft.com/dotnet/Sdk/${SDK_VERSION}/dotnet-sdk-${SDK_VERSION}-win-x64.zip" -o "${WIN_DOTNET_ZIP}"
rm -rf "${WIN_DOTNET_DIR}"
mkdir -p "${WIN_DOTNET_DIR}"
unzip -oq "${WIN_DOTNET_ZIP}" -d "${WIN_DOTNET_DIR}"
echo "WIN_DOTNET_DIR=${WIN_DOTNET_DIR}" >> "${GITHUB_ENV}"
"${WINE_BIN}" "${WIN_DOTNET_DIR}/dotnet.exe" --info
- name: Diagnose Windows SDK targeting-pack resolution
run: |
find "${WIN_DOTNET_DIR}/packs" -maxdepth 4 -name PackageOverrides.txt -print
"${WINE_BIN}" "${WIN_DOTNET_DIR}/dotnet.exe" msbuild MeetingAssistant/MeetingAssistant.csproj \
-p:EnableWindowsTargeting=true \
-p:TargetFramework=net10.0 \
-getProperty:NetCoreRoot,NetCoreTargetingPackRoot,PrunePackageDataRoot,PrunePackageTargetingPackRoots,MSBuildSDKsPath,DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR
"${WINE_BIN}" "${WIN_DOTNET_DIR}/dotnet.exe" msbuild MeetingAssistant/MeetingAssistant.csproj \
-p:EnableWindowsTargeting=true \
-p:TargetFramework=net10.0 \
-t:AddPrunePackageReferences \
-v:normal
- name: Build Windows desktop target via Wine
run: |
rm -f MeetingAssistant/bin/Release/net10.0-windows10.0.19041.0/win-x64/MeetingAssistant.dll
"${WINE_BIN}" "${WIN_DOTNET_DIR}/dotnet.exe" build MeetingAssistant/MeetingAssistant.csproj \
-c Release \
-f net10.0-windows10.0.19041.0 \
-r win-x64 \
-p:EnableWindowsTargeting=true \
--nologo
test -s MeetingAssistant/bin/Release/net10.0-windows10.0.19041.0/win-x64/MeetingAssistant.dll
- name: Run tests via Wine (Windows dotnet host)
run: |
rm -f artifacts/tests/wine.trx
"${WINE_BIN}" "${WIN_DOTNET_DIR}/dotnet.exe" test MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
-c Release \
-r win-x64 \
--no-build \
--logger "trx;LogFileName=wine.trx" \
--results-directory artifacts/tests \
--nologo
test -s artifacts/tests/wine.trx
- name: Show test output folder on failure
if: failure()
run: |
find artifacts/tests -type f -print || true
find MeetingAssistant.Tests -type d -name TestResults -print || true
find MeetingAssistant.Tests -type f -path "*/TestResults/*" -maxdepth 5 -print || true
portable-build-and-test:
runs-on: ubuntu-latest
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
DOTNET_NOLOGO: "1"
TZ: "Europe/Berlin"
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"
- name: Restore (portable target)
run: |
dotnet restore MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
-p:EnableWindowsTargeting=true
- name: Build (portable target including macOS managed adapters)
run: |
dotnet build MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
-c Release \
-f net10.0 \
--no-restore \
-p:EnableWindowsTargeting=true \
--nologo
- name: Run portable and macOS managed behavior tests on Ubuntu
run: |
rm -f artifacts/tests/portable.trx
dotnet test MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
-c Release \
-f net10.0 \
--no-build \
-p:EnableWindowsTargeting=true \
--logger "trx;LogFileName=portable.trx" \
--results-directory artifacts/tests \
--nologo
test -s artifacts/tests/portable.trx
- name: Show test output folder on failure
if: failure()
run: |
find artifacts/tests -type f -print || true
find MeetingAssistant.Tests -type d -name TestResults -print || true
find MeetingAssistant.Tests -type f -path "*/TestResults/*" -maxdepth 5 -print || true