こんにちは、GitLab CIを活用しGitLabにプッシュした際に自動でビルドやユニットテストを行う環境を構築しようとしている者です。
ジョブは開始するものの、ビルド(リントチェック)段階で下記のエラーが発生して失敗するという状況を解消できません
Project 'hoge' not found in root project 'androidtraining'.
該当のソースコード
**.gitlab-ci.yml** image: openjdk:8-jdk variables: ANDROID_COMPILE_SDK: "28" ANDROID_BUILD_TOOLS: "28.0.2" ANDROID_SDK_TOOLS: "4333796" before_script: - apt-get --quiet update --yes - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip - unzip -d android-sdk-linux android-sdk.zip - echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null - echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null - echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null - export ANDROID_HOME=$PWD/android-sdk-linux - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/ - chmod +x ./hoge/gradlew # temporarily disable checking for EPIPE error and use yes to accept all licenses - set +o pipefail - yes | android-sdk-linux/tools/bin/sdkmanager --licenses - set -o pipefail stages: - build - test lintDebug: stage: build script: - ./hoge/gradlew -Pci --console=plain :hoge:app:lintDebug -PbuildDir=lint assembleDebug: stage: build script: - ./hoge/gradlew :hoge:assembleDebug artifacts: paths: - ./hoge/app/build/outputs/ debugTests: stage: test script: - ./hoge/gradlew -Pci --console=plain :hoge:app:testDebug
**ログ(文字数の関係で全文載せられなかったので一部抜粋)** FAILURE: Build failed with an exception. * What went wrong: Project 'hoge' not found in root project 'androidtraining'. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 10s Cleaning up project directory and file based variables
また、hoge以下のディレクトリ構造は以下のようになっています。
2021/09/29 10:24 <DIR> . 2021/09/29 10:24 <DIR> .. 2021/09/28 12:04 236 .gitignore 2021/09/28 13:22 <DIR> app 2021/09/17 12:58 530 build.gradle 2021/09/22 11:47 <DIR> gradle 2021/09/17 12:58 1,093 gradle.properties 2021/09/29 10:13 5,470 gradlew 2021/09/28 10:58 2,176 gradlew.bat 2021/09/17 12:58 2,176 gradlew.bat~ 2021/09/28 10:33 5,296 gradlew~ 2021/09/17 12:58 56 README.md 2021/09/17 12:58 44 settings.gradle
試したこと
hogeフォルダの外にすべてのファイル・フォルダを出し以下の.gitlab-ci.ymlで行ったところビルドもユニットテストも問題なく行えました。
image: openjdk:8-jdk variables: ANDROID_COMPILE_SDK: "28" ANDROID_BUILD_TOOLS: "28.0.2" ANDROID_SDK_TOOLS: "4333796" before_script: - apt-get --quiet update --yes - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip - unzip -d android-sdk-linux android-sdk.zip - echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null - echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null - echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null - export ANDROID_HOME=$PWD/android-sdk-linux - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/ - chmod +x ./gradlew # temporarily disable checking for EPIPE error and use yes to accept all licenses - set +o pipefail - yes | android-sdk-linux/tools/bin/sdkmanager --licenses - set -o pipefail stages: - build - test lintDebug: stage: build script: - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint assembleDebug: stage: build script: - ./gradlew :assembleDebug artifacts: paths: - ./app/build/outputs/ debugTests: stage: test script: - ./gradlew -Pci --console=plain :app:testDebug
この問題の解決方法をご存じの方がいらっしゃいましたらご教授ください。
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。