Run Native Pipeline #530
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 Native Pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
mendix_version: | |
description: "Provide the SP version to be used (e.g., 10.14.0.43709) - has to be a released version (Default: latest from Mendix versions.json)" | |
required: false | |
default: "" | |
nt_branch: | |
description: "Native Template branch to use (Default: master)" | |
default: "master" | |
required: false | |
type: string | |
workspace: | |
description: "Select a widget to test (Default will run all)" | |
required: true | |
default: "*-native" | |
type: choice | |
options: | |
- "*-native" | |
- accordion-native | |
- activity-indicator-native | |
- animation-native | |
- app-events-native | |
- background-gradient-native | |
- background-image-native | |
- badge-native | |
- bar-chart-native | |
- barcode-scanner-native | |
- bottom-sheet-native | |
- carousel-native | |
- color-picker-native | |
- column-chart-native | |
- feedback-native | |
- floating-action-button-native | |
- gallery-native | |
- gallery-text-filter-native | |
- image-native | |
- intro-screen-native | |
- line-chart-native | |
- listview-swipe-native | |
- maps-native | |
- notifications-native | |
- pie-doughnut-chart-native | |
- popup-menu-native | |
- progress-bar-native | |
- qr-code-native | |
- radio-buttons-native | |
- range-slider-native | |
- rating-native | |
- repeater-native | |
- safe-area-view-native | |
- signature-native | |
- slider-native | |
- switch-native | |
- toggle-buttons-native | |
- video-player-native | |
- web-view-native | |
# Disable trigger on every push to pull request for now | |
# pull_request: | |
# # branches: [master] | |
permissions: | |
packages: write | |
jobs: | |
scope: | |
runs-on: ubuntu-latest | |
outputs: | |
scope: ${{ steps.scope.outputs.scope }} | |
steps: | |
- name: "Determine scope" | |
id: scope | |
run: | | |
if [ -n "${{ github.event.inputs.workspace }}" ] && [ "${{ github.event.inputs.workspace }}" != "*-native" ]; then | |
selected_workspaces=$(echo "${{ github.event.inputs.workspace }}" | sed 's/,/ /g') | |
echo "scope=--all --include '${selected_workspaces}'" >> $GITHUB_OUTPUT | |
else | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
echo "scope=--since --include '*-native'" >> $GITHUB_OUTPUT | |
else | |
echo "scope=--all--include '*-native'" >> $GITHUB_OUTPUT | |
fi | |
fi | |
- name: "Debug Scope Output" | |
run: | | |
echo "Scope is: ${{ steps.scope.outputs.scope }}" | |
mendix-version: | |
runs-on: ubuntu-22.04 | |
outputs: | |
mendix_version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }} | |
steps: | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
- name: "Get Mendix version from JSON" | |
id: get-mendix-version | |
uses: notiz-dev/github-action-json-property@7a701887f4b568b23eb7b78bb0fc49aaeb1b68d3 # v0.2.0 | |
with: | |
path: configs/e2e/mendix-versions.json | |
prop_path: latest | |
- name: Set Mendix version | |
id: set-mendix-version | |
run: | | |
if [[ -n "${{ github.event.inputs.mendix_version }}" ]]; then | |
echo "MENDIX_VERSION=${{ github.event.inputs.mendix_version }}" >> $GITHUB_OUTPUT | |
else | |
echo "MENDIX_VERSION=${{ steps.get-mendix-version.outputs.prop }}" >> $GITHUB_OUTPUT | |
fi | |
- name: "Debug Mendix Version" | |
run: | | |
echo "Mendix Version: ${{ steps.set-mendix-version.outputs.MENDIX_VERSION }}" | |
docker-images: | |
needs: mendix-version | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Login to GitHub Container Registry" | |
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
- name: "Check if docker image already exists" | |
run: | | |
docker manifest inspect ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }} || EXIT_CODE=$? | |
echo "IMAGE_MISSING=$EXIT_CODE" >> $GITHUB_ENV | |
- name: "Build mxbuild image" | |
# if: ${{ env.IMAGE_MISSING != 0 }} | |
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | |
with: | |
file: ./.github/scripts/mxbuild.Dockerfile | |
context: ./.github/scripts | |
build-args: | | |
MENDIX_VERSION=${{ needs.mendix-version.outputs.mendix_version }} | |
push: true | |
tags: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }} | |
resources: | |
needs: [scope, mendix-version] | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: read | |
contents: read | |
steps: | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
with: | |
fetch-depth: 0 | |
- name: "Set up node" | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 | |
with: | |
node-version-file: .nvmrc | |
cache: yarn | |
- name: "Install dependencies" | |
run: yarn install --immutable | |
- name: "Force rebuild resources" | |
run: | | |
yarn workspaces foreach ${{ needs.scope.outputs.scope }} run build # Ensure all resources are rebuilt | |
- name: "Unit test" | |
run: yarn workspaces foreach ${{ needs.scope.outputs.scope }} run test | |
- name: "Run build for development" | |
run: yarn workspaces foreach ${{ needs.scope.outputs.scope }} run build | |
env: | |
NODE_OPTIONS: --max_old_space_size=6144 | |
- name: "Upload resources artifact" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: resources | |
path: | | |
packages/pluggableWidgets/**/dist/*/*.mpk | |
packages/jsActions/mobile-resources-native/dist/**/* | |
packages/jsActions/nanoflow-actions-native/dist/**/* | |
project: | |
needs: [resources, mendix-version] | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }} | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: "Make sure curl is installed" | |
run: | | |
apt update && apt upgrade -y | |
apt install curl -y | |
- name: "Download test project" | |
run: curl -L -o project.zip https://github.com/mendix/Native-Mobile-Resources/archive/refs/heads/main.zip | |
- name: "Extract test project" | |
uses: montudor/action-zip@0852c26906e00f8a315c704958823928d8018b28 # v1.0.0 | |
with: | |
args: unzip -qq project.zip -d . | |
- name: "Download resources artifact" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: resources | |
path: resources | |
- name: "List resources" | |
run: ls -R resources | |
- name: "Move widgets" | |
shell: bash | |
run: | | |
if compgen -G 'resources/pluggableWidgets/**/dist/*/*.mpk' > /dev/null; then | |
for oldPath in resources/pluggableWidgets/**/dist/*/*.mpk; do | |
newPath=Native-Mobile-Resources-main/widgets/$(basename $oldPath) | |
mv -f $oldPath $newPath | |
done | |
mx update-widgets --loose-version-check Native-Mobile-Resources-main/NativeComponentsTestProject.mpr | |
fi | |
- name: "Move mobile-resources" | |
shell: bash | |
run: | | |
if compgen -G 'resources/jsActions/mobile-resources-native/*' > /dev/null; then | |
mv -f resources/jsActions/mobile-resources-native/* Native-Mobile-Resources-main/javascriptsource/nativemobileresources/actions/ | |
fi | |
- name: "Move nanoflow-actions" | |
shell: bash | |
run: | | |
if compgen -G 'resources/jsActions/mobile-resources-native/*' > /dev/null; then | |
mv -f resources/jsActions/nanoflow-actions-native/* Native-Mobile-Resources-main/javascriptsource/nanoflowcommons/actions/ | |
fi | |
- name: "Force rebuild test project" | |
run: | | |
mxbuild -o automation.mda --loose-version-check Native-Mobile-Resources-main/NativeComponentsTestProject.mpr # Ensure the project is rebuilt | |
- name: "Upload MDA" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: mda | |
path: automation.mda | |
android-bundle: | |
needs: [project, mendix-version] | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }} | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
- name: "Download deployment package" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: mda | |
- name: "Create Android bundle" | |
uses: ./.github/actions/create-native-bundle | |
with: | |
platform: android | |
mda-file: automation.mda | |
ios-bundle: | |
needs: [project, mendix-version] | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/mendix/native-widgets/mxbuild:${{ needs.mendix-version.outputs.mendix_version }} | |
credentials: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
- name: "Download project MDA file" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: mda | |
- name: "Create iOS bundle" | |
uses: ./.github/actions/create-native-bundle | |
with: | |
platform: ios | |
mda-file: automation.mda | |
android-app: | |
needs: [android-bundle] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Check out Native Template for Native Components Test Project" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
with: | |
repository: mendix/native-template | |
ref: ${{ github.event.inputs.nt_branch || 'master' }} | |
path: native-template | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
with: | |
path: native-widgets | |
- name: "Download Android bundle and assets" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: android-bundle | |
path: bundles/android | |
- name: "Set up Node" | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 | |
with: | |
node-version-file: native-template/.nvmrc | |
cache: npm | |
cache-dependency-path: native-template/package-lock.json | |
- name: "Copy files to the right location" | |
run: | | |
mv bundles/android/index.android.bundle native-template/android/app/src/main/assets/index.android.bundle | |
cp -r bundles/android/assets/* native-template/android/app/src/main/res/ | |
mv native-widgets/configs/e2e/config.json native-template | |
mv native-widgets/configs/e2e/google-services.json native-template/android/app | |
node native-widgets/scripts/test/add-native-dependencies.js | |
- name: "Install dependencies" | |
working-directory: native-template | |
run: npm i | |
- name: "Setup JDK " | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: gradle | |
# - name: "Check Java Version" | |
# run: java -version | |
# - name: "Check JAVA_HOME" | |
# run: echo $JAVA_HOME | |
- name: "Build Android app" | |
working-directory: native-template/android | |
run: | | |
./gradlew assembleAppstoreDebug assembleAppstoreDebugAndroidTest | |
if [ $? -ne 0 ]; then | |
echo "Build failed!" | |
exit 1 | |
fi | |
- name: "List APK files" | |
run: | | |
echo "Listing APK files in the output directory:" | |
ls -R native-template/android/app/build/outputs/apk/ | |
- name: "Archive Android app" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: android-app | |
path: native-template/android/app/build/outputs/apk/**/*.apk | |
ios-app: | |
needs: [ios-bundle] | |
runs-on: macos-13 | |
steps: | |
- name: "Check out Native Template for Native Components Test Project" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
with: | |
repository: mendix/native-template | |
ref: ${{ github.event.inputs.nt_branch || 'master' }} | |
path: native-template | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
with: | |
path: native-widgets | |
- name: "Download iOS bundle and assets" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: ios-bundle | |
path: bundles/ios | |
- name: "Set up Node" | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 | |
with: | |
node-version-file: native-template/.nvmrc | |
cache: npm | |
cache-dependency-path: native-template/package-lock.json | |
- name: "Copy files to the right location" | |
run: | | |
mv bundles/ios/index.ios.bundle native-template/ios/Bundle/index.ios.bundle | |
mv bundles/ios/assets/assets native-template/ios/Bundle/ | |
mv native-widgets/configs/e2e/config.json native-template | |
node native-widgets/scripts/test/add-native-dependencies.js | |
- name: "Install Node dependencies" | |
working-directory: native-template | |
run: npm i | |
- name: "Setup Pods cache" | |
uses: actions/cache@v3 | |
with: | |
path: native-template/Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: "Install Pod dependencies" | |
working-directory: native-template/ios | |
run: pod install | |
- name: "Build iOS app" | |
working-directory: native-template/ios | |
run: xcodebuild -workspace NativeTemplate.xcworkspace -scheme nativeTemplate -configuration Debug -sdk iphonesimulator -derivedDataPath build ONLY_ACTIVE_ARCH=YES VALID_ARCHS="i386 x86_64" | |
- name: "Archive iOS app" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: ios-app | |
path: native-template/ios/build/Build/Products/**/*.app | |
android-avd: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
- name: "Setup AVD cache" | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
/Users/runner/.android/avd/* | |
/Users/runner/.android/adb* | |
/Users/runner/Library/Android/sdk/system-images/**/* | |
key: new_avd_default_3core_and_system_images | |
# - name: "Kill existing emulator instances" | |
# run: | | |
# adb devices | grep emulator | awk '{print $1}' | xargs -r adb -s kill-server | |
- name: "Create AVD and generate snapshot for caching" | |
# if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/[email protected] | |
with: | |
api-level: 34 | |
target: default | |
arch: x86_64 | |
profile: pixel | |
cores: 3 | |
ram-size: 4096M | |
heap-size: 1024M | |
avd-name: NATIVE_pixel_34 | |
force-avd-creation: true | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: | | |
echo "AVD created" | |
sleep 5 | |
# - name: "List available AVDs" | |
# run: | | |
# echo "Available AVDs:" | |
# emulator -list-avds | |
# - name: "Check AVD logs" | |
# run: | | |
# echo "AVD logs:" | |
# cat /Users/runner/.android/avd/NATIVE_pixel_34.avd/*.log || echo "No logs found" | |
android-tests: | |
needs: [scope, mendix-version, project, android-app, android-avd] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
with: | |
fetch-depth: 0 | |
- name: "Set up node" | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 | |
with: | |
node-version-file: .nvmrc | |
cache: yarn | |
- name: "Install dependencies" | |
run: yarn install --immutable | |
- name: "Download project MDA file" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: mda | |
- name: "List contents of working directory before downloading Android app" | |
run: ls -R | |
- name: "Download Android app" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: android-app | |
path: android-app | |
- name: "List contents of android-app directory after download" | |
run: ls -R android-app | |
- name: "Check if Android app APK exists" | |
run: | | |
if [ ! -f "android-app/appstore/debug/app-appstore-debug.apk" ]; then | |
echo "Error: Android app APK not found at path: android-app/appstore/debug/app-appstore-debug.apk" | |
exit 1 | |
fi | |
- name: "Start runtime" | |
uses: ./.github/actions/start-runtime | |
with: | |
mda-file: automation.mda | |
mendix-version: ${{ needs.mendix-version.outputs.mendix_version }} | |
- name: "Move android apps to correct location" | |
run: | | |
mkdir -p detox/apps | |
find android-app -type f -iname "*.apk" -exec mv {} detox/apps/ \; | |
- name: "Check if APK files are present" | |
run: | | |
echo "Listing APK files in detox/apps directory:" | |
ls -R detox/apps | |
# - name: "Setup AVD cache" | |
# uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # v2 | |
# id: avd-cache | |
# with: | |
# path: | | |
# /Users/runner/.android/avd/* | |
# /Users/runner/.android/adb* | |
# /Users/runner/Library/Android/sdk/system-images/**/* | |
# key: new_avd_default_3core_and_system_images | |
- name: "Run tests" | |
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1 | |
with: | |
api-level: 34 | |
target: default | |
arch: x86_64 | |
profile: pixel | |
cores: 3 | |
ram-size: 4096M | |
heap-size: 1024M | |
avd-name: NATIVE_pixel_34 | |
force-avd-creation: true | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: | | |
adb shell "rm -fr /data/local/tmp/detox" | |
adb shell "mkdir -p /data/local/tmp/detox" | |
adb push "detox/apps/app-appstore-debug.apk" "/data/local/tmp/detox/Application.apk" | |
adb push "detox/apps/app-appstore-debug-androidTest.apk" "/data/local/tmp/detox/Test.apk" | |
adb shell pm install -r -g -t /data/local/tmp/detox/Application.apk 2>/dev/null | |
adb shell pm install -r -g -t /data/local/tmp/detox/Test.apk 2>/dev/null | |
- name: "Install Maestro" | |
run: | | |
curl -Ls "https://get.maestro.dev" | bash | |
- name: "Make run_maestro.sh Executable" | |
run: chmod +x maestro/run_maestro.sh | |
- name: "Run Maestro Script" | |
run: maestro/run_maestro.sh android | |
- name: "Archive runtime logs" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: always() | |
with: | |
name: android-runtime-logs | |
path: log/*.log | |
if-no-files-found: ignore | |
- name: "Archive test screenshot diff results" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: failure() | |
with: | |
name: android-screenshot-results | |
path: | | |
${{ github.workspace }}/packages/**/e2e/images/diffs/**/*.png | |
${{ github.workspace }}/packages/**/e2e/images/actual/**/*.png | |
if-no-files-found: ignore | |
- name: "Archive artifacts" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: always() | |
with: | |
name: android-artifacts | |
path: packages/pluggableWidgets/**/artifacts/ | |
if-no-files-found: ignore | |
ios-tests: | |
needs: [scope, mendix-version, project, ios-app] | |
runs-on: macos-13 | |
steps: | |
- name: "Check out code" | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 | |
with: | |
fetch-depth: 0 | |
- name: "Set up node" | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 | |
with: | |
node-version-file: .nvmrc | |
cache: yarn | |
- name: "Install dependencies" | |
run: yarn install --immutable | |
- name: "Download project MDA file" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: mda | |
# - name: "Clean detox framework cache" | |
# run: npx detox clean-framework-cache | |
# - name: "Build detox framework cache" | |
# run: npx detox build-framework-cache | |
- name: "Start runtime" | |
uses: ./.github/actions/start-runtime | |
with: | |
mda-file: automation.mda | |
mendix-version: ${{ needs.mendix-version.outputs.mendix_version }} | |
- name: "Download iOS app" | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: ios-app | |
path: ios-app | |
- name: "List contents of ios-app directory" | |
run: | | |
echo "Listing contents of ios-app directory:" | |
ls -R ios-app | |
- name: "Move iOS app to correct location" | |
run: | | |
mkdir -p detox/apps | |
find ios-app -type d -iname "*.app" -exec cp -R {} detox/apps/ \; | |
- name: "List contents of apps directory" | |
run: | | |
echo "Listing contents of detox/apps directory:" | |
ls -R detox/apps | |
- name: Install Detox Dependencies | |
run: | | |
brew tap wix/brew | |
brew install applesimutils | |
# - name: Check available runtimes | |
# run: xcrun simctl list runtimes | |
# - name: Check available device types | |
# run: xcrun simctl list devicetypes | |
- name: Create iOS 16.4 simulator for iPhone 14 | |
run: xcrun simctl create "iPhone 14" com.apple.CoreSimulator.SimDeviceType.iPhone-14 com.apple.CoreSimulator.SimRuntime.iOS-16-4 | |
# - name: List supported iOS devices | |
# run: applesimutils --list | |
- name: Boot Simulator | |
run: xcrun simctl boot "iPhone 14" | |
- name: Wait for Simulator to Boot | |
run: | | |
while ! xcrun simctl list | grep "Booted"; do | |
echo "Waiting for simulator to boot..." | |
sleep 5 | |
done | |
- name: "Check if simulator is booted" | |
run: | | |
if ! xcrun simctl list | grep -q "Booted"; then | |
echo "Simulator is not booted!" | |
exit 1 | |
fi | |
# - name: "List installed apps" | |
# run: xcrun simctl listapps "iPhone 15" | |
- name: "Check if iOS app exists in detox/apps" | |
run: | | |
APP_PATH="detox/apps/NativeTemplate.app" | |
if [ ! -d "$APP_PATH" ]; then | |
echo "App not found at path: $APP_PATH" | |
else | |
echo "App found at path: $APP_PATH" | |
fi | |
- name: "Check if iOS app exists in full BINARY_PATH" | |
run: | | |
BINARY_PATH="/Users/runner/work/native-widgets/native-widgets/detox/apps/NativeTemplate.app" | |
if [ ! -d "$BINARY_PATH" ]; then | |
echo "App not found at path: $BINARY_PATH" | |
echo "Listing contents of the apps directory:" | |
ls -R /Users/runner/work/native-widgets/native-widgets/detox/apps # List contents of the apps directory for debugging | |
else | |
echo "App found at path: $BINARY_PATH" | |
fi | |
# - name: "Install app on simulator" | |
# run: | | |
# SIMULATOR_ID=$(xcrun simctl list devices | grep "iPhone 15" | grep "Booted" | awk -F '[()]' '{print $2}') | |
# if [ -z "$SIMULATOR_ID" ]; then | |
# echo "No booted simulator found for iPhone 15." | |
# exit 1 | |
# fi | |
# echo "Checking if app exists at path: $BINARY_PATH" | |
# if [ ! -d "$BINARY_PATH" ]; then | |
# echo "Error: App not found at path: $BINARY_PATH" | |
# echo "Listing contents of the directory:" | |
# ls -R "$(dirname "$BINARY_PATH")" # List contents of the parent directory | |
# exit 1 | |
# fi | |
# echo "Installing app on simulator with ID: $SIMULATOR_ID" | |
# xcrun simctl install "$SIMULATOR_ID" "$BINARY_PATH" | |
- name: "Install Maestro" | |
run: | | |
curl -Ls "https://get.maestro.dev" | bash | |
- name: "Wait for app to be ready" | |
run: sleep 10 | |
- name: "Make run_maestro.sh Executable" | |
run: chmod +x maestro/run_maestro.sh | |
- name: "Run Maestro Script" | |
run: maestro/run_maestro.sh ios | |
- name: "Archive runtime logs" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: always() | |
with: | |
name: ios-runtime-logs | |
path: log/*.log | |
if-no-files-found: ignore | |
- name: "Archive test screenshot diff results" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: failure() | |
with: | |
name: ios-screenshot-results | |
path: | | |
${{ github.workspace }}/packages/**/e2e/images/diffs/**/*.png | |
${{ github.workspace }}/packages/**/e2e/images/actual/**/*.png | |
if-no-files-found: ignore | |
- name: "Archive artifacts" | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
if: always() | |
with: | |
name: ios-artifacts | |
path: packages/pluggableWidgets/**/artifacts/ | |
if-no-files-found: ignore |