Skip to content
Closed
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
68 changes: 68 additions & 0 deletions .github/workflows/pullrequest_unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build & Test Pull Requests Unit Tests

on:
pull_request:
branches:
- main

env:
DOTNET_NOLOGO: true # Disable the .NET logo
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry

jobs:
unit-tests :
runs-on: ubuntu-latest
name: Unit Tests
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install KVM and Android SDK (x86)
run: |
# Set up environment variables
export ANDROID_SDK_ROOT=$HOME/android-sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/emulator:$PATH

# Create necessary directories
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools

# Download and install command-line tools
wget -q https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip
unzip -q commandlinetools-linux-*.zip -d $ANDROID_SDK_ROOT/cmdline-tools
mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/latest
chmod +x $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager

# Accept licenses and install required components
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
# Install Android API level 34 and necessary system images
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "platform-tools" "emulator" "platforms;android-34" "system-images;android-34;google_apis;x86_64"

# Export paths for future steps
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
echo "ANDROID_HOME=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
echo "PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/emulator:$PATH" >> $GITHUB_ENV

- name: Install Android Build Tools
run: |
echo "Installing Android Build Tools..."
sdkmanager "build-tools;34.0.0" # Updated to use Android 34 build tools
sdkmanager --update

- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Install MAUI Workloads
run: dotnet workload install maui-android

- name: Restore Dependencies
run: dotnet restore TransactionMobile.Maui.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json

- name: Build Code
run: dotnet build TransactionMobile.Maui/TransactionMobile.Maui.csproj -c Release -f net8.0-android --no-restore

- name: Run Unit Tests
run: dotnet test TransactionMobile.Maui.BusinessLogic.Tests/TransactionMobile.Maui.BusinessLogic.Tests.csproj -c Release -f net8.0-android --no-restore
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android</TargetFrameworks>

<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">
$(TargetFrameworks);net8.0-windows10.0.19041.0
</TargetFrameworks>

<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('osx'))">
$(TargetFrameworks);net8.0-ios;net8.0-maccatalyst
</TargetFrameworks>
<!--<TargetFrameworks>net8.0-android;net8.0-ios;net8.0;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>-->
<TargetFrameworks>net8.0</TargetFrameworks>
<UseMaui>true</UseMaui>
<DebugType>None</DebugType>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!--<TargetFrameworks>net8.0-android;net8.0-ios;net8.0;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>-->
<TargetFrameworks>net8.0-android</TargetFrameworks>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!--<TargetFrameworks>net8.0-android</TargetFrameworks>

<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">
$(TargetFrameworks);net8.0-windows10.0.19041.0
</TargetFrameworks>

<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('osx'))">
$(TargetFrameworks);net8.0-ios;net8.0-maccatalyst
</TargetFrameworks>
</TargetFrameworks>-->

<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
Expand Down
Loading