Github操作:尽管已安装xcpretty仍未找到

时间:2020-09-26 14:13:14

标签: ios rubygems github-actions xcodebuild

我正在尝试用Github Actions替换我们iOS项目的糟糕的Jenkins设置。我想我已经准备就绪,但是我遇到了我不明白的失败。在运行xcodebuild来构建和测试应用程序的步骤中,尽管上一步中通过捆绑程序安装了xcpretty,但我收到一个错误消息,即--- name: Build & Test on: # Run tests when a PR merges. push: branches: - develop # Run tests when PRs are created or updated. pull_request: types: [opened, synchronize, reopened] # Allow the workflow to be run manually. workflow_dispatch: env: DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer jobs: test: name: Build & Test runs-on: 'macos-latest' steps: - name: Checkout Project uses: actions/checkout@v2 with: ref: develop - name: Setup Ruby uses: ruby/setup-ruby@v1.46.0 with: ruby-version: 2.7.1 - name: Restore Ruby Cache uses: actions/cache@v1 with: path: vendor/bundle key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} restore-keys: | ${{ runner.os }}-gem- - name: Restore Pod Cache uses: actions/cache@v1 with: path: Pods key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- - name: Bundle Install run: | bundle config path vendor/bundle bundle install --without=documentation --jobs 4 --retry 3 - name: Install Cocoapods run: pod install --repo-update - name: Show Xcode Version run: xcode-select -p - name: Show Build Settings run: xcodebuild -workspace ./MyApp.xcworkspace -scheme 'MyApp-Test' -destination 'platform=iOS Simulator,name=iPhone 11' -showBuildSettings - name: Test MyApp run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace MyApp.xcworkspace -scheme MyApp-Test -destination 'platform=iOS Simulator,name=iPhone 11' -enableCodeCoverage YES -derivedDataPath build/derived-data clean test | xcpretty -s - name: Run Danger env: DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }} run: bundle exec danger 是未知命令。以下是相关文件:

build-and-run.yml

source 'https://rubygems.org'

ruby '2.7.1'

gem 'cocoapods'
gem 'danger'
gem 'fastlane'
gem 'xcpretty'
gem 'danger-slather'
gem 'danger-swiftlint'
gem 'danger-xcode_summary'
gem 'xcpretty-json-formatter'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

Gemfile(我们在动作中不使用fastlane,但现在我必须将其保留在Gemfile中,以免构建在我们的Jenkins盒子上破损):

Bundle Install

Fetching xcpretty 0.3.0 Installing xcpretty 0.3.0 步骤中,正在安装xcpretty gem:

Install Cocoapods

Test MyApp步骤也可以正常工作(可能是因为预装了Cocoapods)。当到达Run set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace MyApp.xcworkspace -scheme MyApp-Test -destination 'platform=iOS Simulator,name=iPhone 11' -enableCodeCoverage YES -derivedDataPath build/derived-data clean test | xcpretty -s /Users/runner/work/_temp/9d3633bf-6dae-45d7-a303-1c68abb63d53.sh: line 1: xcpretty: command not found 步骤时,调用将产生一个错误:

xcpretty

然后工作流挂起了很长时间,因此我通常取消它。知道为什么找不到onTermChange吗?我的想法是,gem的安装目录不在搜索路径中,但是我不确定该怎么做。我敢肯定有一个合理的解决方案,但是我很难找到它,并且讨厌把头撞在墙上。

0 个答案:

没有答案