Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .github/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ runs:
with:
python-version: 3.11.5

- name: Setup .NET
- name: Setup .NET 8.0.203
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.203

- name: Setup .NET 7.0.306
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.306
80 changes: 80 additions & 0 deletions .github/workflows/nunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Run NUnit tests

on:
workflow_dispatch:
inputs:
iris_mac_unity_url:
description: iris url'
required: true
type: string

fully_qualified_name:
description: fully qualified name (Agora.Rtc, Agora.Rtm)'
required: true
type: string

jobs:
NUnit-Test:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup
uses: ./.github/setup

- name: Download and extract Iris Mac Unity package
run: |
# Create temporary directory for download
mkdir -p temp_download
cd temp_download
# Download zip file
curl -L "${{ inputs.iris_mac_unity_url }}" -o iris_mac_unity.zip
# Extract to project root directory
unzip -o iris_mac_unity.zip -d $GITHUB_WORKSPACE
# Clean up temporary directory
cd $GITHUB_WORKSPACE
rm -rf temp_download
echo "Successfully downloaded and extracted Iris Mac Unity package to project root directory"
- name: Run NUnit tests
run: |
# Find directory starting with iris and store in variable
IRIS_DIR=$(find $GITHUB_WORKSPACE -type d -name "iris*" | head -n 1)
if [ -z "$IRIS_DIR" ]; then
echo "Error: No directory starting with iris found"
exit 1
else
echo "Found Iris directory: $IRIS_DIR"
fi
# Check if IRIS_DIR name contains DCG
if [[ "$IRIS_DIR" == *"DCG"* ]]; then
echo "IRIS Type is DCG"
AGORA_LIB_NAME=$IRIS_DIR/Debugger/MAC/IrisDebugger.framework/Versions/A/IrisDebugger
DEBUG_LIB_NAME=$IRIS_DIR/Debugger/MAC/IrisDebugger.framework/Versions/A/IrisDebugger
sh terra/nunit_run.sh $AGORA_LIB_NAME $DEBUG_LIB_NAME ${{ inputs.fully_qualified_name }}
else
echo "IRIS Type is RTM"
AGORA_LIB_NAME=$IRIS_DIR/Debugger/MAC/IrisDebugger.framework/Versions/A/IrisDebugger
DEBUG_LIB_NAME=$IRIS_DIR/Debugger/MAC/IrisDebugger.framework/Versions/A/IrisDebugger
sh terra/nunit_run.sh $AGORA_LIB_NAME $DEBUG_LIB_NAME ${{ inputs.fully_qualified_name }}
fi
echo "NUnit tests completed"
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: nunit-test-results
path: ${{ github.workspace }}/testResults.xml
if-no-files-found: error
retention-days: 7
52 changes: 52 additions & 0 deletions terra/nunit_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

AGORA_LIB_NAME=$1
DEBUG_LIB_NAME=$2
FULLY_QUALIFIED_NAME=$3

MY_PATH=$(realpath $(dirname "$0"))
PROJECT_ROOT=$(realpath ${MY_PATH}/..)

UT_CSPROJ_PATH=${PROJECT_ROOT}/Agora-C_Sharp_RTC-SDK_UT/ut/ut.csproj

if [ -f "$UT_CSPROJ_PATH" ]; then
sed -i '' 's/<TargetFramework>.*<\/TargetFramework>/<TargetFramework>net7.0<\/TargetFramework>/g' "$UT_CSPROJ_PATH"
echo "TargetFramework has been updated to net7.0"
else
echo "Error: ut.csproj file not found: $UT_CSPROJ_PATH"
exit 1
fi

AGORA_RTC_CS=${PROJECT_ROOT}/Agora-C_Sharp-RTC-SDK/Code/Rtc/Impl/Private/Native/AgoraRtcApiNative.cs
AGORA_RTM_CS=${PROJECT_ROOT}/Agora-C_Sharp-RTC-SDK/Code/Rtm/Internal/Impl/Private/Native/AgoraRtmApiNative.cs

if [ -f "$AGORA_RTC_CS" ]; then
perl -i -pe 's|"AgoraRtcWrapper"|"'$AGORA_LIB_NAME'"|g' "$AGORA_RTC_CS"
# 设置变量以便后续使用
AGORA_RTC_LIB_NAME=$AGORA_LIB_NAME
echo "AgoraRtcLibName in AgoraRtcApiNative.cs has been updated to $AGORA_RTC_LIB_NAME"
else
echo "Error: AgoraRtcApiNative.cs file not found: $AGORA_RTC_CS"
exit 1
fi

if [ -f "$AGORA_RTM_CS" ]; then
perl -i -pe 's|"AgoraRtmWrapper"|"'$AGORA_LIB_NAME'"|g' "$AGORA_RTM_CS"
echo "AgoraRtmLibName in AgoraRtmApiNative.cs has been updated to $DEBUG_LIB_NAME"
else
echo "Error: AgoraRtmApiNative.cs file not found: $AGORA_RTM_CS"
exit 1
fi

DLL_CS=${PROJECT_ROOT}/Agora-C_Sharp_RTC-SDK_UT/ut/Tool/DLLHelper.cs
if [ -f "$DLL_CS" ]; then
perl -i -pe 's|"libName"|"'$DEBUG_LIB_NAME'"|g' "$DLL_CS"
echo "DebugLibName in DLLHelper.cs has been updated to $DEBUG_LIB_NAME"
else
echo "Error: DLLHelper.cs file not found: $DLL_CS"
exit 1
fi

echo "All files have been updated successfully"

dotnet test ${UT_CSPROJ_PATH} --filter FullyQualifiedName~${FULLY_QUALIFIED_NAME} --logger "trx;LogFileName=${PROJECT_ROOT}/testResults.xml"
Loading