forked from Manuel/meeting-assistant
151 lines
5.1 KiB
YAML
151 lines
5.1 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 (Windows target)
|
|
run: |
|
|
dotnet restore MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
|
|
-p:EnableWindowsTargeting=true \
|
|
-r win-x64
|
|
|
|
- name: Build (Windows target)
|
|
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: Run tests via Wine (Windows dotnet host)
|
|
run: |
|
|
"${WINE_BIN}" "${WIN_DOTNET_DIR}/dotnet.exe" test MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
|
|
-c Release \
|
|
-r win-x64 \
|
|
--no-build \
|
|
--nologo
|
|
|
|
- name: Show test output folder on failure
|
|
if: failure()
|
|
run: |
|
|
find MeetingAssistant.Tests -type d -name TestResults -print || true
|
|
find MeetingAssistant.Tests -type f -path "*/TestResults/*" -maxdepth 5 -print || true
|
|
|
|
macos-build-and-test:
|
|
runs-on: macos
|
|
env:
|
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "1"
|
|
DOTNET_NOLOGO: "1"
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Verify native macOS runner
|
|
run: |
|
|
if [ "$(uname -s)" != "Darwin" ]; then
|
|
echo "The macos job requires a native Gitea runner registered with the macos:host label."
|
|
exit 1
|
|
fi
|
|
|
|
- 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 and macOS helpers)
|
|
run: |
|
|
dotnet build MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
|
|
-c Release \
|
|
-f net10.0 \
|
|
--no-restore \
|
|
-p:EnableWindowsTargeting=true \
|
|
--nologo
|
|
|
|
- name: Verify macOS native helpers
|
|
run: |
|
|
test -x MeetingAssistant/bin/Release/net10.0/Native/MeetingAssistantAudioCapture.app/Contents/MacOS/macos-meeting-audio-capture
|
|
test -x MeetingAssistant/bin/Release/net10.0/Native/macos-desktop-controls
|
|
test -x MeetingAssistant/bin/Release/net10.0/Native/macos-meeting-integrations
|
|
test -x MeetingAssistant/bin/Release/net10.0/Native/macos-meeting-assistant-launcher
|
|
|
|
- name: Run tests on macOS
|
|
run: |
|
|
dotnet test MeetingAssistant.Tests/MeetingAssistant.Tests.csproj \
|
|
-c Release \
|
|
-f net10.0 \
|
|
--no-build \
|
|
-p:EnableWindowsTargeting=true \
|
|
--nologo
|
|
|
|
- name: Show test output folder on failure
|
|
if: failure()
|
|
run: |
|
|
find MeetingAssistant.Tests -type d -name TestResults -print || true
|
|
find MeetingAssistant.Tests -type f -path "*/TestResults/*" -maxdepth 5 -print || true
|