我对CircleCI有一个问题,我无法开始工作,因为我的gradlew文件不在我的存储库的根目录中。由于我的仓库被剥夺,这里是他的架构的摘要:
root
-----> app_folder
------------> some folders
------------> some files
------------> gradlew
------> some files and folders
------> circle.yml
我尝试使用cd命令进入app_folder文件夹并更改路径变量,但没有任何工作
circle.yml
#
# Build configuration for Circle CI
#
machine:
environment:
PATH: "~/$CIRCLE_PROJECT_REPONAME/app_folder:$PATH"
ANDROID_HOME: /usr/local/android-sdk-linux
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
ADB_INSTALL_TIMEOUT: "10"
ANDROID_API_LEVEL: 25
ANDROID_BUILD_TOOLS_VERSION: 25.0.2
java:
version: oraclejdk7
dependencies:
cache_directories:
- ~/.gradle
- ~/.android
- /usr/local/android-sdk-linux/extras
pre:
- if [ ! -d "$ANDROID_HOME/tools" ]; then echo y | android update sdk --no-ui --all --filter "tools"; fi
- if [ ! -d "$ANDROID_HOME/platforms/android-$ANDROID_API_LEVEL" ]; then echo y | android update sdk --no-ui --all --filter "android-$ANDROID_API_LEVEL"; fi
- if [ ! -d "$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION" ]; then echo y | android update sdk --no-ui --all --filter "build-tools-$ANDROID_BUILD_TOOLS_VERSION"; fi
- if [ ! -d "$ANDROID_HOME/add-ons/addon-google_apis-google-$ANDROID_API_LEVEL" ]; then echo y | android update sdk --no-ui --all --filter "addon-google_apis-google-$ANDROID_API_LEVEL"; fi
- echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"
- echo y | android update sdk --no-ui --all --filter "extra-google-google_play_services"
- echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"
test:
override:
# start the emulator
- emulator -avd circleci-android24 -no-audio -no-window:
background: true
parallel: true
# wait for it to have booted
- circle-android wait-for-boot
# unlock the emulator screen
- sleep 30
- adb shell input keyevent 82
# run tests against the emulator.
- echo $PATH
- cd app_folder && .\gradlew connectedAndroidTest -PdisablePreDex
- .\\app_folder\\gradlew connectedAndroidTest -PdisablePreDex
- .\app_folder\\gradlew connectedAndroidTest -PdisablePreDex
- .\gradlew connectedAndroidTest -PdisablePreDex ~/github_name/app_folder
# copy the build outputs to artifacts
- cp -r app_folder/app/build/outputs $CIRCLE_ARTIFACTS
# copy the test results to the test results directory.
- cp -r app_folder/app/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS
答案 0 :(得分:1)
您只需将其添加到顶部:
general:
build_dir: your_folder
答案 1 :(得分:0)
这里有两种选择。最快的是指定custom build directory。使用您的示例,这将是:
general:
build_dir: app_folder
这是因为每个CircleCI文档:
CircleCI将运行其推理以及来自的所有构建命令 那个目录。
第二种选择是完全不依赖于CircleCI的推理命令而是运行所有内容,例如Gradle自己。您已经覆盖test
阶段,因此您也需要覆盖dependencies
阶段并自行运行gradle dependencies
。
例如:
dependencies:
override:
- gradle --project-dir app_folder dependencies
-Ricardo N Feliciano
开发者传播者,CircleCI