这是我CI/CD的.yaml文件。我使用patrol包来编写测试用例。https://patrol.leancode.co/getting-started/getting-started
workflows:
android_dev_workflow:
name: workflow for integration testing
instance_type: mac_mini_m1
environment:
groups:
- google_credentials
flutter: 3.7.3
xcode: 14.2
cocoapods: default
vars:
FIREBASE_DEV_PROJECT: "hlp-dev"
scripts:
- name: get flutter packages
script: |
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs
dart pub global activate patrol_cli
- name: create debug and test apk
script: |
patrol build android --target integration_test/hlp_test/hlp_test.dart --flavor dev
- name: Run Firebase Test Lab Tests
script: |
set -ex
echo $GCLOUD_DEV_KEY_FILE | base64 --decode > ./gcloud_dev_key_file.json
gcloud auth activate-service-account --key-file=gcloud_dev_key_file.json
gcloud --quite config set project $FIREBASE_DEV_PROJECT
gcloud firebase test android run \
--type instrumentation \
--app build/app/outputs/apk/debug/app-debug.apk \
--test build/app/outputs/apk/androidTest/debug/app-debug-androidTest.apk
artifacts:
- build/**/outputs/**/*.apk
- build/**/outputs/**/*.aab
- build/**/outputs/**/mapping.txt
- flutter_drive.log
publishing:
email:
recipients:
- yogesh@pietechsolution.com
我在这行遇到了错误patrol build android --target integration_test/hlp_test/hlp_test.dart --flavor dev.
这是我的输出日志
已启用详细模式。将打印更多日志。
收到的测试目标:/Users/builder/clone/integration_test/hlp_test/hlp_test.dart
Android flavor:发展
收到5 --dart-define(s)(0 custom,5 internal)
已接收内部--dart-define:PATROL_WAIT=0
收到的内部--dart-define:网站MapAPP_PACKAGE_NAME=com.hlp.user.dev
收到的内部--dart-define:PATROL_ANDROID_APP_NAME=HLP Dev
已接收内部--dart-define:PATROL_TEST_LABEL=hlp_test.dart
收到的内部--dart-define:INTEGRATION_TEST_SHOULD_REPORT_RESULTS_TO_NATIVE=false
·构建apk与入口点hlp_test. dart.
$ ./gradlew:app:assembleDevDebug -Ptarget=/Users/builder/clone/integration_test/hlp_test/hlp_test。dart -Pdart-defines=UEFUUk9MX1dBSVQ9MA==,UEFUUk9MX0FQUF9QQUNLQUdFX05BTUU9Y29tLmhscC51c2VyLmRldg ==,UEFUUK9MX0FORFJPSURFQVBQX05BTUU9SExQIERldg==,UEFUUk9MX1RFU1RfTEFCRUw9aGxwX3Rlc3QuZGFydA==,SU5URUdSQVRJT05fVEVTVF9TSE9VTERfUKVQT1JUX1JFU1VMVFNfVE9fTkFUSVZFPWZhbH@l
/bin/sh:./gradlew:没有这样的文件或目录使用入口点hlp_test.dart构建apk失败(Gradle构建失败,代码127)(9 ms)
异常:Gradle构建失败,代码为127
0 AndroidTestBackend.build.(package:patrol_cli/src/android/android_test_backend.dart:67:9)
1 DisposeScope.run(package:dispose_scope/src/dispose_scope.dart:44:7)
2 AndroidTestBackend.build(package:patrol_cli/src/android/android_test_backend.dart:42:5)
3 BuildAndroidCommand.run(package:patrol_cli/src/commands/build_android.dart:117:7)
4 CommandRunner.runCommand(package:args/command_runner.dart:212:13)
5 PatrolCommandRunner.runCommand(package:patrol_cli/src/runner/patrol_command_runner.dart:311:18)
6 PatrolCommandRunner.run(package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)
7 patrolCommandRunner(package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)
8 main(file:/Users/builder/. pub-cache/hosted/pub.dev/patrol_cli-1.1.11/bin/main.dart:6:20)
查看上面的日志以了解发生了什么。还可以考虑使用--verbose运行。如果日志仍然没有用,那么这是一个错误-请报告它。
异常:Gradle构建失败,代码为127
0 AndroidTestBackend.build.(package:patrol_cli/src/android/android_test_backend.dart:67:9)
1 DisposeScope.run(package:dispose_scope/src/dispose_scope.dart:44:7)
2 AndroidTestBackend.build(package:patrol_cli/src/android/android_test_backend.dart:42:5)
3 BuildAndroidCommand.run(package:patrol_cli/src/commands/build_android.dart:117:7)
4 CommandRunner.runCommand(package:args/command_runner.dart:212:13)
5 PatrolCommandRunner.runCommand(package:patrol_cli/src/runner/patrol_command_runner.dart:311:18)
6 PatrolCommandRunner.run(package:patrol_cli/src/runner/patrol_command_runner.dart:255:18)
7 patrolCommandRunner(package:patrol_cli/src/runner/patrol_command_runner.dart:65:20)
8 main(file:/Users/builder/. pub-cache/hosted/pub.dev/patrol_cli-1.1.11/bin/main.dart:6:20)
构建失败:|
步骤4脚本create debug and test apk
退出,状态代码为% 1
1条答案
按热度按时间np8igboo1#
解决方案是生成
gradlew
。你可以先试着构建你的flutter应用程序(它会生成这个文件),例如。flutter build apk || true
。