diff --git a/.gitea/workflows/pr-push-build-and-test.yaml b/.gitea/workflows/pr-push-build-and-test.yaml new file mode 100644 index 0000000..6ede5e2 --- /dev/null +++ b/.gitea/workflows/pr-push-build-and-test.yaml @@ -0,0 +1,92 @@ +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@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + 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