Created
March 19, 2020 16:37
-
-
Save Grohden/2ea8975d51754117ea15977338d89293 to your computer and use it in GitHub Desktop.
Azure devops detox run tests for ios and android
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
trigger: | |
- none | |
pool: | |
vmImage: 'ubuntu-latest' | |
variables: | |
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn | |
GRADLE_USER_HOME: $(Pipeline.Workspace)/.gradle | |
steps: | |
- task: NodeTool@0 | |
inputs: | |
versionSpec: '12.9.1' | |
displayName: 'Install Node' | |
- task: Cache@2 | |
inputs: | |
key: 'gradle | "$(Agent.OS)"' | |
restoreKeys: gradle | |
path: $(GRADLE_USER_HOME) | |
displayName: 'Gradle build cache' | |
- task: Cache@2 | |
inputs: | |
key: 'yarn | "$(Agent.OS)" | yarn.lock' | |
restoreKeys: | | |
yarn | "$(Agent.OS)" | |
yarn | |
path: $(YARN_CACHE_FOLDER) | |
displayName: 'Cache Yarn packages' | |
- script: yarn --frozen-lockfile | |
displayName: 'Install dependencies' | |
- task: Cache@2 | |
inputs: | |
key: 'AVD_IMAGES_29' | |
path: '$(ANDROID_HOME)/system-images' | |
cacheHitVar: 'AVD_IMAGES_RESTORED' | |
continueOnError: true | |
condition: succeededOrFailed() | |
displayName: 'Caching System Images for AVD' | |
- script: | | |
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install "system-images;android-29;google_apis;x86" | |
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd --force --name emu --device "Nexus 5X" -k 'system-images;android-29;google_apis;x86' | |
$ANDROID_HOME/emulator/emulator -list-avds | |
condition: ne(variables.AVD_IMAGES_RESTORED, 'true') | |
displayName: 'Download Android Emulator Image' | |
- script: yarn detox:build | |
displayName: 'Build detox' | |
- script: | | |
echo "Starting emulator" | |
nohup $ANDROID_HOME/emulator/emulator -avd emu -no-snapshot -no-audio -no-boot-anim -accel auto -gpu auto -qemu -lcd-density 420 > /dev/null 2>&1 & | |
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82' | |
$ANDROID_HOME/platform-tools/adb devices | |
echo "Emulator started" | |
displayName: 'Android Emulator' | |
- script: yarn detox:run | |
displayName: 'Detox test' |
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
trigger: | |
- none | |
pool: | |
vmImage: 'macos-latest' | |
variables: | |
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn | |
steps: | |
- task: NodeTool@0 | |
inputs: | |
versionSpec: '12.9.1' | |
displayName: 'Install Node' | |
- task: Cache@2 | |
inputs: | |
key: 'yarn | "$(Agent.OS)" | yarn.lock' | |
restoreKeys: | | |
yarn | "$(Agent.OS)" | |
yarn | |
path: $(YARN_CACHE_FOLDER) | |
displayName: 'Cache Yarn packages' | |
- script: yarn --frozen-lockfile | |
displayName: 'Install dependencies' | |
- script: | | |
yarn codegen | |
yarn type-check | |
displayName: 'Codegen and type-check' | |
- task: CocoaPods@0 | |
inputs: | |
workingDirectory: 'ios' | |
forceRepoUpdate: false | |
- script: | | |
brew tap wix/brew | |
brew install applesimutils | |
displayName: 'Install Detox Tools' | |
- script: | | |
yarn detox:build | |
displayName: 'Build detox' | |
- script: | | |
yarn detox:test | |
displayName: 'Detox test' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@tomasfly I'm sorry, I'm not using azure since some months after posting this
You can however try to boot the emulator without the nohup part and look at the logs