Skip to content

Commit

Permalink
Run iOS tests on CI (#2405)
Browse files Browse the repository at this point in the history
* Added building ios tests

* First ios run attempt

* First ios run attempt - 0

* Check iphoneToSimulate value

* Check iphoneToSimulate value - 0

* Removed toString from runtimeId

* Properly handled promises

* Check command

* Fixed string for commands

* Fixed string for commands - 0

* Fixed string for commands - 1

* Try to get output out of bash command

* action/exec has a broken parser, fall back to default one

* Fixed UUID generation

* Try to create ios simulator

* Fixed path to Test.iOS.app

* Changed runtime format for simctl

* Try to run ios sim

* Fixed regexp

* Add a bunch of console writelines

* Fix for simulator that wasn't starting

* Fixed merge issue

* Fix again parameter passing for simulator

* Cleanup for review

* More cleanup

* Forgotten await

* Fix uninfered id in simulator command

* Revert console writelines

* Ready for review

* PR feedback

* Fixed test name

* Removed unused import from action

* Minor fix

* Forgotten part of the minor fix

* More PR feedback

* Final PR feedback

* Removed local action and set the template to point to remote action

* First test with remote custom js GH action

Co-authored-by: Nikola Irinchev <[email protected]>
  • Loading branch information
LaPeste and nirinchev authored Jun 25, 2021
1 parent 20d63c4 commit bf5187b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
18 changes: 17 additions & 1 deletion .github/templates/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,22 @@ jobs:
- name: Run the tests
run: #@ "Tests/Tests.XamarinMac/bin/" + configuration + "/Tests.XamarinMac.app/Contents/MacOS/Tests.XamarinMac --headless --labels=All --result=${{ github.workspace }}/TestResults.macOS.xml"
- #@ publishTestsResults("TestResults.macOS.xml", "Xamarin.macOS")
run-tests-xamarin-ios:
runs-on: macos-latest
name: Test Xamarin.iOS
needs: build-packages
steps:
- #@ template.replace(checkoutCode())
- #@ template.replace(fetchPackageArtifacts())
- #@ msbuild("Tests/Tests.iOS", TargetFrameworkVersion="v1.0", Platform="iPhoneSimulator", RestoreConfigFile="Tests/Test.NuGet.Config", UseRealmNupkgsWithVersion="${{ needs.build-packages.outputs.package_version }}")
- name: Run the tests
uses: realm/ci-actions/run-ios-simulator@v1
with:
appPath: 'Tests/Tests.iOS/bin/iPhoneSimulator/Release/Tests.iOS.app'
bundleId: 'io.realm.dotnettests'
iphoneToSimulate: 'iPhone-8'
arguments: '--headless --resultpath ${{ github.workspace }}/TestResults.iOS.xml'
- #@ publishTestsResults("TestResults.iOS.xml", "Xamarin.iOS")
run-tests-weaver:
runs-on: windows-latest
name: Test Weaver
Expand All @@ -384,7 +400,7 @@ jobs:
run-cleanup:
runs-on: ubuntu-latest
name: Workflow cleanup
needs: [ run-tests-net-framework, run-tests-uwp, run-tests-netcore-net5, run-tests-xamarin-macos, run-tests-weaver, build-packages ]
needs: [ run-tests-net-framework, run-tests-uwp, run-tests-netcore-net5, run-tests-xamarin-macos, run-tests-xamarin-ios, run-tests-weaver, build-packages ]
if: always()
steps:
- #@ template.replace(deleteWrapperBinaries())
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,45 @@ jobs:
files: TestResults.macOS.xml
comment_mode: "off"
check_name: Results Xamarin.macOS
run-tests-xamarin-ios:
runs-on: macos-latest
name: Test Xamarin.iOS
needs: build-packages
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: recursive
- name: Register csc problem matcher
run: echo "::add-matcher::.github/problem-matchers/csc.json"
- name: Register msvc problem matcher
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
- name: Fetch Realm
uses: actions/download-artifact@v2
with:
name: Realm.${{ needs.build-packages.outputs.package_version }}.nupkg
path: ${{ github.workspace }}/Realm/packages/
- name: Fetch Realm.Fody
uses: actions/download-artifact@v2
with:
name: Realm.Fody.${{ needs.build-packages.outputs.package_version }}.nupkg
path: ${{ github.workspace }}/Realm/packages/
- name: Build Tests/Tests.iOS
run: msbuild Tests/Tests.iOS -p:Configuration=Release -restore -p:TargetFrameworkVersion=v1.0 -p:Platform=iPhoneSimulator -p:RestoreConfigFile=Tests/Test.NuGet.Config -p:UseRealmNupkgsWithVersion=${{ needs.build-packages.outputs.package_version }}
- name: Run the tests
uses: realm/ci-actions/run-ios-simulator@v1
with:
appPath: Tests/Tests.iOS/bin/iPhoneSimulator/Release/Tests.iOS.app
bundleId: io.realm.dotnettests
iphoneToSimulate: iPhone-8
arguments: --headless --resultpath ${{ github.workspace }}/TestResults.iOS.xml
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v1
if: always()
with:
files: TestResults.iOS.xml
comment_mode: "off"
check_name: Results Xamarin.iOS
run-tests-weaver:
runs-on: windows-latest
name: Test Weaver
Expand Down Expand Up @@ -579,6 +618,7 @@ jobs:
- run-tests-uwp
- run-tests-netcore-net5
- run-tests-xamarin-macos
- run-tests-xamarin-ios
- run-tests-weaver
- build-packages
if: always()
Expand Down
2 changes: 1 addition & 1 deletion Tests/Tests.iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary
var arguments = NSProcessInfo.ProcessInfo.Arguments
.Select(a => a.Replace("-app-arg=", string.Empty))
.ToArray();

if (arguments.Any("--headless".Equals))
{
options.AutoRun = true;
Expand Down Expand Up @@ -75,7 +76,6 @@ public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary

return Task.CompletedTask;
};

}

nunit.Options = options;
Expand Down

0 comments on commit bf5187b

Please sign in to comment.