I'm trying to cascade a series of tasking using the workflow syntax with circle ci. For some reason, only the build job seems to run - but my other jobs do not.
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
steps:
- checkout
- restore_cache:
keys:
- sfdx-version-41-local
- run:
name: Install SFDX
command: pwd
- save_cache:
key: sfdx-version-41-local
paths:
- node_modules
auth:
steps:
- run:
name: Authenticate
command: ls -a
validate:
steps:
- run:
name: Validate
command: mkdir whocares
clean:
steps:
- run:
name: Remove Server Key
when: always
command: pwd
workflows:
version: 2
authenticate-and-deploy:
jobs:
- build
- auth
- validate
- clean
Ideally, I want to make sure each step finishes with a non zero exit code before moving to next step. But I'm not sure the the subsequent steps after build are not being executed.
Thanks,
If you really wants all of these jobs for some reason, the Workflows config is missing requirements and each job is missing its executor. I also fixed indenting. You can do this:
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
steps:
- checkout
- restore_cache:
keys:
- sfdx-version-41-local
- run:
name: Install SFDX
command: pwd
- save_cache:
key: sfdx-version-41-local
paths:
- node_modules
auth:
docker:
- image: circleci/node:latest
steps:
- run:
name: Authenticate
command: ls -a
validate:
docker:
- image: circleci/node:latest
steps:
- run:
name: Validate
command: mkdir whocares
clean:
docker:
- image: circleci/node:latest
steps:
- run:
name: Remove Server Key
when: always
command: pwd
workflows:
version: 2
authenticate-and-deploy:
jobs:
- build
- auth:
requires: build
- validate:
requires: auth
- clean:
requires: validate
Here is what I ended up doing:
job-definition: &jobdef
docker:
- image: circleci/openjdk:latest-node-browsers
steps:
- checkout
- restore_cache:
keys:
- sfdx-6.8.2-local
- run:
name: Print branch
command: |
echo $CIRCLE_BRANCH
if [[$CIRCLE_BRANCH == 'master']];
then
echo "master";
else
echo "notMaster";
fi
- save_cache:
key: sfdx-6.8.2-local
paths:
- node_modules
- run:
name: "Validate Build"
command: |
#node_modules/sfdx-cli/bin/run force:mdapi:deploy -d src/ -u $USERNAME -c --testlevel RunLocalTests
echo CIRCLE_BRANCH
- run:
name: Push to Codecov.io
command: |
cp ~/tests/apex/test-result-codecoverage.json .
bash <(curl -s https://codecov.io/bash)
- store_artifacts:
path: ~/tests
- store_test_results:
path: ~/tests
version: 2
jobs:
static-analysis:
docker:
- image: circleci/openjdk:latest
steps:
- checkout
- restore_cache:
keys:
- pmd-v6.0.1
- run:
name: Install PMD
command: |
if [ ! -d pmd-bin-6.0.1 ]; then
curl -L "https://github.com/pmd/pmd/releases/download/pmd_releases/6.0.1/pmd-bin-6.0.1.zip" -o pmd-bin-6.0.1.zip
unzip pmd-bin-6.0.1.zip
rm pmd-bin-6.0.1.zip
fi
- save_cache:
key: pmd-v6.0.1
paths:
- pmd-bin-6.0.1
- run:
name: Run Static Analysis
command: |
pmd-bin-6.0.1/bin/run.sh pmd -d ./src/ -R $RULESET -f text -l apex -r static-analysis.txt -no-cache
- store_artifacts:
path: static-analysis.txt
build-enterprise:
<<: *jobdef
environment:
SCRATCH_DEF: workspace-scratch-def.json
URL: https://login.salesforce.com
NAME: $PROD_USERNAME
build-developer:
<<: *jobdef
environment:
SCRATCH_DEF: developer.json
URL: https://test.salesforce.com
NAME: $EVANDEV_USERNAME
workflows:
version: 2
test_and_static:
jobs:
- build-enterprise
#- build-developer
#- static-analysis
Two other thing I'm trying to do:
1. paramterize the build
2. run build on a PR
Related
I have a setup that used to work for at least a couple of years without any issues. In my latest update, all of a sudden I am getting the following error:
#!/bin/bash -eo pipefail
./grailsw compile
You must be connected to the internet the first time you use the Grails wrapper
org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 3; The element type "hr" must be terminated by the matching end-tag "</hr>".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1473)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1749)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
at grails.init.Start.getVersion(Start.java:36)
at grails.init.Start.main(Start.java:83)
Exited with code exit status 1
CircleCI received exit code 1
And basically, I am getting the same error for any grailsw command.
Here is my config file:
version: 2.0
references:
defaults: &defaults
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/priz-be
remote_docker: &remote_docker
setup_remote_docker:
docker_layer_caching: false
assemble_prod: &assemble_prod
run:
name: Assemble
command: ./gradlew -Dgrails.env=prod assemble
build_and_push_docker_image: &build_and_push_docker_image
run:
name: Build docker image
command: |
sudo apt-get update --fix-missing
sudo apt-get install python-pip python-dev
sudo pip install awscli
cp -p build/libs/priz-be-0.1.war docker/app.war
aws ecr get-login --no-include-email --region us-west-2 | sh
docker build -t priz-be docker
docker tag priz-be:latest 922556357703.dkr.ecr.us-west-2.amazonaws.com/priz-be:prod-$CIRCLE_SHA1
docker push 922556357703.dkr.ecr.us-west-2.amazonaws.com/priz-be:prod-$CIRCLE_SHA1
jobs:
checkout_code:
<<: *defaults
steps:
- checkout
- run:
name: Show current branch
command: echo ${CIRCLE_BRANCH}
- save_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/priz-be
compile:
<<: *defaults
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Compile the project
command: ./grailsw compile
# Cache local dependencies if they don't exist
- save_cache:
paths:
- ~/.gradle
key: v1-dependencies-{{ checksum "build.gradle" }}
test_and_check:
<<: *defaults
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Testing
command: ./grailsw test-app
- run:
name: Executing stylecheck
command: ./gradlew check
- store_artifacts:
path: ./build/reports/codenarc
destination: codenarc-report
- store_test_results:
path: ./build/test-results/test
- store_artifacts:
path: ./build/reports/tests
destination: test-report
deploy_to_prod:
<<: *defaults
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- *assemble_prod
- *remote_docker
- *build_and_push_docker_image
- add_ssh_keys:
fingerprints:
- "9c:0c:ce:67:62:74:f1:d7:aa:b4:46:55:56:51:e5:f7"
- run:
name: Deploy
command: |
sudo apt-get update
sudo apt-get -y install gettext-base
sudo apt-get clean
envsubst < docker/deploy-prod.sh.template > docker/deploy-prod.sh
ssh -v -o StrictHostKeyChecking=no root#178.128.78.7 "bash -s" -- < ./docker/deploy-prod.sh
workflows:
version: 2
build-and-test:
jobs:
- checkout_code
- compile:
requires:
- checkout_code
- test_and_check:
requires:
- compile
- deploy_to_prod:
requires:
- test_and_check
filters:
branches:
only: master
If I log in with SSH, and trying to execute the same thing by hand, I am getting the same error. Also, checked if there is a network connection. All good...
What can be the reason for this error?
This is caused by a problem with the Artifactory instance. More information is available at github.com/grails/grails-wrapper/issues/7 and github.com/grails/grails-core/issues/11825.
The Grails Repository has been moved to an artifactory instance and the paths have changed.
You may have to update your maven repository url in build.gradle:
# Old repository url
maven { url "https://repo.grails.org/grails/core" }
# New url
maven { url "https://repo.grails.org/artifactory/core/" }
The only official information I found about this change was Important Information Regarding Grails and Bintray.
You can find all available repositories here. (In case you need the plugins repository or anything else.)
I hope that fixes your problem.
Regards
I am building my React Native iOS app with circleci 2.0, my build is stuck at Signing for about 40 minutes and not moving ahead.
I have my apple id with 2FA so have added FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD in environment variables.
My github id is also having 2FA and have deployed adhoc certificates on git with GH_TOKEN in circle ci env. variables.
My Fastlane file looks like this -
update_fastlane
default_platform(:ios)
platform :ios do
before_all do
setup_circle_ci
end
desc "Push a new beta build to TestFlight"
lane :beta do
increment_build_number(xcodeproj: "xxxApp.xcodeproj")
match(type:'adhoc')
gym(export_method: "ad-hoc")
build_app(workspace: "xxxApp.xcworkspace", scheme: "xxxApp")
# upload_to_testflight
end
end
My circle ci config.yml looks like this
version: 2
jobs:
node:
working_directory: ~/sekuraRN
docker:
- image: circleci/node:10.16.0
steps:
- checkout
- run:
name: set Ruby version
command: echo "ruby-2.4" > ~/.ruby-version
- run: npm install
- persist_to_workspace:
root: ~/xxxApp
paths:
- node_modules
ios:
macos:
xcode: '11.2.1'
resource_class: large
working_directory: ~/xxxApp
shell: /bin/bash --login -o pipefail
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "XXXXXXXX"
- run:
name: set Ruby version
command: echo 'chruby ruby-2.5.7' >> ~/.bash_profile
- run:
name: Update Bundler version
command: sudo gem install bundler:2.1.1
- restore_cache:
key: npm-v1-{{ checksum "package-lock.json" }}-{{ arch }}
- restore_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
- run: npm install
- save_cache:
key: npm-v1-{{ checksum "package-lock.json" }}-{{ arch }}
paths:
- ~/.cache/npm
- save_cache:
key: bundle-v1-{{ checksum "ios/Podfile.lock" }}
paths:
- ./Pods
- save_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
paths:
- node_modules
- run:
command: bundle install
working_directory: ios
- save_cache:
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}
paths:
- vendor/bundle
- run:
name: Setup MFSDK Configuration
command: echo -e "machine repo.active.ai\nlogin docs#active.ai\npassword docs#123" > ~/.netrc
- run:
name: Uninstall Cocoapods
command: gem uninstall cocoapods
- run:
name: Install Cocoapods
command: gem install -n /usr/local/bin cocoapods
- run:
name: Pod Install
command: pod install
working_directory: ios
- run:
name: update fastlane
command: bundle update fastlane
working_directory: ios
- run:
name: Building IPA
no_output_timeout: 30m
command: bundle exec fastlane beta
working_directory: ios
- store_artifacts:
path: ios/xxx_app
destination: ipa/
workflows:
version: 2
node-android-ios:
jobs:
- node
- ios:
filters:
branches:
only:
- master
requires:
- node
Output from CircleCI -
[07:47:40]: ▸ the transform cache was reset.
[07:49:45]: ▸ Touching xxxApp.app
[07:49:45]: ▸ Signing /Users/distiller/Library/Developer/Xcode/DerivedData/…
It doesn't move ahead and stuck at this for 40 mins
I'm using the ecr orb to build and push my image to the registry however, the circleci env vars are not available in the build process for some reason.
Here's my config.yml
( i've commented out some of the steps to troubleshoot )
version: 2.1
orbs:
aws-ecr: circleci/aws-ecr#3.1.0
aws-ecs: circleci/aws-ecs#0.0.8
jobs:
build:
docker:
- image: circleci/python:3.7
steps:
- checkout
- restore_cache:
keys:
- cache-{{ checksum "Pipfile.lock" }}
- cache-
- run:
name: Install dependencies
command: pipenv sync --dev
- save_cache:
key: cache-{{ checksum "Pipfile.lock" }}
paths:
- ~/.local
- ~/.cache
- run:
name: 'Lint Flake8'
command: pipenv run flake8
# - run:
# name: 'Test'
# command: |
# ENVIRONMENT=development pipenv run python src/manage.py test --noinput
workflows:
build-and-deploy:
jobs:
- build
- aws-ecr/build_and_push_image:
account-url: AWS_ECR_ACCOUNT_URL
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
repo: "dev-portal"
region: AWS_DEFAULT_REGION
tag: "${CIRCLE_SHA1}"
requires:
- build
filters:
branches:
only: circleci/aws-ecs-deploy
# - aws-ecs/deploy-service-update:
# requires:
# - aws-ecr/build_and_push_image
# filters:
# branches:
# only: circleci/aws-ecs-deploy
# aws-region: AWS_DEFAULT_REGION
# family: "${AWS_RESOURCE_NAME_PREFIX}-service"
# cluster-name: "${AWS_RESOURCE_NAME_PREFIX}-cluster"
# container-image-name-updates: "container=${AWS_RESOURCE_NAME_PREFIX}-service,image-and-tag=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/nginx-portal:${CIRCLE_SHA1}"
# verify-revision-is-deployed: true
# post-steps:
# - run:
# name: Test the deployment
# command: |
# TARGET_GROUP_ARN=$(aws ecs describe-services --cluster ${AWS_RESOURCE_NAME_PREFIX}-cluster --services ${AWS_RESOURCE_NAME_PREFIX}-service | jq -r '.services[0].loadBalancers[0].targetGroupArn')
# ELB_ARN=$(aws elbv2 describe-target-groups --target-group-arns $TARGET_GROUP_ARN | jq -r '.TargetGroups[0].LoadBalancerArns[0]')
# ELB_DNS_NAME=$(aws elbv2 describe-load-balancers --load-balancer-arns $ELB_ARN | jq -r '.LoadBalancers[0].DNSName')
What do i not understand about the orbs context / circleci's env vars?
Thanks y'all!
I am a CircleCI user, and I am setting up an integration with Heroku.
I want to do the following, and setup security with integrations with dockerHub and also to Heroku from the CircleCI portal page, using this config.yml file.
The problem is that CircleCI doesn't seem to know what these variables should be set to, and instead just echos.
${HEROKU_API_KEY} ${HEROKU_APP}
config.yml
version: 2
jobs:
build:
working_directory: ~/springboot_swagger_example-master-cassandra
docker:
- image: circleci/openjdk:8-jdk-browsers
steps:
- checkout
- restore_cache:
key: springboot_swagger_example-master-cassandra-{{ checksum "pom.xml" }}
- run: mvn dependency:go-offline
- save_cache:
paths:
- ~/.m2
key: springboot_swagger_example-master-cassandra-{{ checksum "pom.xml" }}
- type: add-ssh-keys
- type: deploy
name: "Deploy to Heroku"
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
# Install Heroku fingerprint (this is heroku's own key, NOT any of your private or public keys)
echo 'heroku.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAu8erSx6jh+8ztsfHwkNeFr/SZaSOcvoa8AyMpaerGIPZDB2TKNgNkMSYTLYGDK2ivsqXopo2W7dpQRBIVF80q9mNXy5tbt1WE04gbOBB26Wn2hF4bk3Tu+BNMFbvMjPbkVlC2hcFuQJdH4T2i/dtauyTpJbD/6ExHR9XYVhdhdMs0JsjP/Q5FNoWh2ff9YbZVpDQSTPvusUp4liLjPfa/i0t+2LpNCeWy8Y+V9gUlDWiyYwrfMVI0UwNCZZKHs1Unpc11/4HLitQRtvuk0Ot5qwwBxbmtvCDKZvj1aFBid71/mYdGRPYZMIxq1zgP1acePC1zfTG/lvuQ7d0Pe0kaw==' >> ~/.ssh/known_hosts
# git push git#heroku.com:yourproject.git $CIRCLE_SHA1:refs/heads/master
# Optional post-deploy commands
# heroku run python manage.py migrate --app=my-heroku-project
fi
- run: mvn package
- run:
name: Install Docker client
command: |
set -x
VER="17.03.0-ce"
curl -L -o /tmp/docker-$VER.tgz https://get.docker.com/builds/Linux/x86_64/docker-$VER.tgz
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
mv /tmp/docker/* /usr/bin
- run:
name: Build Docker image
command: docker build -t joethecoder2/spring-boot-web:$CIRCLE_SHA1 .
- run:
name: Push to DockerHub
command: |
docker login -u$DOCKERHUB_LOGIN -p$DOCKERHUB_PASSWORD
docker push joethecoder2/spring-boot-web:$CIRCLE_SHA1
- run:
name: Setup Heroku
command: |
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
chmod +x .circleci/setup-heroku.sh
.circleci/setup-heroku.sh
- run:
name: Deploy to Heroku
command: |
mkdir app
cd app/
heroku create
# git push https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP.git master
echo ${HEROKU_API_KEY}
echo ${HEROKU_APP}
git push https://heroku:${HEROKU_API_KEY}#git.heroku.com/${HEROKU_APP}.git master
- store_test_results:
path: target/surefire-reports
- store_artifacts:
path: target/spring-boot-web-0.0.1-SNAPSHOT.jar
The problem is that CircleCI doesn't seem to know what these variables should be set to, and instead just echos.
${HEROKU_API_KEY}
${HEROKU_APP}
The question, and problem is why aren't these settings being detected automatically?
You need to set the value for the variables: https://circleci.com/docs/2.0/env-vars/
They are being echo'd because you're echoing them.
echo ${HEROKU_API_KEY}
echo ${HEROKU_APP}
Are Instrumentation tests for Android Espresso available on CircleCI 2.0?
If yes, can anybody, please, help to configure config.yml file for me?
I’ve made thousand attempts and no luck. I can run unit tests, but not Instrumentation.
Thanks
The answer for this question is: yes. Instrumentation tests are possible for CircleCi. This is the configuration I have:
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-25-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
command: sudo chmod +x ./gradlew
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Setup emulator
command: sdkmanager "system-images;android-25;google_apis;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-25;google_apis;armeabi-v7a"
- run:
name: Launch emulator
command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
background: true
- run:
name: Wait emulator
command: |
# wait for it to have booted
circle-android wait-for-boot
# unlock the emulator screen
sleep 30
adb shell input keyevent 82
- run:
name: Run Tests
command: ./gradlew connectedAndroidTest
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
The only problem with this configuration that it doesn't lead to successfull build because of not enough memory error. If somebody has better configuration, please, share.
I am running Android UI tests on CircleCI MacOS executor.
Here is my configuration:
version: 2
reference:
## Constants
gradle_cache_path: &gradle_cache_path
gradle_cache-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
workspace: &workspace
~/src
## Configurations
android_config: &android_config
working_directory: *workspace
macos:
xcode: "9.4.0"
shell: /bin/bash --login -eo pipefail
environment:
TERM: dumb
JVM_OPTS: -Xmx3200m
## Cache
restore_gradle_cache: &restore_gradle_cache
restore_cache:
key: *gradle_cache_path
save_gradle_cache: &save_gradle_cache
save_cache:
key: *gradle_cache_path
paths:
- ~/.gradle
## Dependency Downloads
download_android_dependencies: &download_android_dependencies
run:
name: Download Android Dependencies
command: ./gradlew androidDependencies
jobs:
ui_test:
<<: *android_config
steps:
- checkout
- run:
name: Setup environment variables
command: |
echo 'export PATH="$PATH:/usr/local/opt/node#8/bin:${HOME}/.yarn/bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin:/usr/local/share/android-sdk/tools/bin"' >> $BASH_ENV
echo 'export ANDROID_HOME="/usr/local/share/android-sdk"' >> $BASH_ENV
echo 'export ANDROID_SDK_HOME="/usr/local/share/android-sdk"' >> $BASH_ENV
echo 'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"' >> $BASH_ENV
echo 'export QEMU_AUDIO_DRV=none' >> $BASH_ENV
echo 'export JAVA_HOME=/Library/Java/Home' >> $BASH_ENV
- run:
name: Install Android sdk
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew tap homebrew/cask
HOMEBREW_NO_AUTO_UPDATE=1 brew cask install android-sdk
- run:
name: Install emulator dependencies
command: (yes | sdkmanager "platform-tools" "platforms;android-26" "extras;intel;Hardware_Accelerated_Execution_Manager" "build-tools;26.0.0" "system-images;android-26;google_apis;x86" "emulator" --verbose) || true
- *restore_gradle_cache
- *download_android_dependencies
- *save_gradle_cache
- run: avdmanager create avd -n Pixel_2_API_26 -k "system-images;android-26;google_apis;x86" -g google_apis -d "Nexus 5"
- run:
name: Run emulator in background
command: /usr/local/share/android-sdk/tools/emulator #Pixel_2_API_26 -skin 1080x2066 -memory 2048 -noaudio
background: true
- run:
name: Run Tests
command: ./gradlew app:connectedAndroidTest
https://gist.github.com/DoguD/58b4b86a5d892130af84074078581b87
I hope it helps