Added more actions (#28) #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run UI Tests macOS | |
on: | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
branches: [ "main" ] | |
env: | |
BUILD_CONFIGURATION: Release | |
CSPROJ_TO_BUILD: samples/Plugin.Maui.UITestHelpers.Sample/Plugin.Maui.UITestHelpers.Sample.csproj | |
APP_TO_TEST: samples/Plugin.Maui.UITestHelpers.Sample/bin/Release/net8.0-maccatalyst/maccatalyst-arm64/Plugin.Maui.UITestHelpers.Sample.app | |
CSPROJ_TO_TEST: samples/UITests.macOS/UITests.macOS.csproj | |
APP_ID: com.companyname.uitesthelperssample | |
TARGET_FRAMEWORK: net8.0-maccatalyst | |
XCODE_VERSION: 15.2 | |
SCREENCAPTURE_FOLDER: samples/UITests.macOS/bin/Debug/net8.0 | |
ARTIFACTS_PATH: ${{ github.workspace }}/output | |
jobs: | |
ui-test-macos: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Select Xcode version | |
run: sudo xcode-select -s '/Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer' | |
- name: Restore Workload | |
run: dotnet workload restore --project ${{ env.CSPROJ_TO_BUILD }} | |
- name: Build App | |
run: dotnet build ${{ env.CSPROJ_TO_BUILD }} -f ${{ env.TARGET_FRAMEWORK }} -c ${{ env.BUILD_CONFIGURATION }} | |
- name: Install Appium | |
run: | | |
npm install -g appium | |
appium driver install mac2 | |
- name: Install App | |
# Deploy the app by running it on this Mac | |
run: dotnet build ${{ env.CSPROJ_TO_BUILD }} -t:Run -f ${{ env.TARGET_FRAMEWORK }} -c ${{ env.BUILD_CONFIGURATION }} | |
- name: Run UI Tests | |
run: | | |
dotnet test ${{ env.CSPROJ_TO_TEST }} --environment APPIUM_LOG_FILE=${{ env.ARTIFACTS_PATH }}/appium-logs/appium.log --environment APPID="${{ env.APP_ID }}" | |
- name: Publish Artifacts | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: logs-and-screenshots | |
path: | | |
${{ env.ARTIFACTS_PATH }}/**/*.* | |
${{ env.SCREENCAPTURE_FOLDER }}/*.png |