circleci 上的 CI 测试正在下降

问题描述 投票:0回答:0

我想将 CI 测试连接到我的项目 我的问题是测试失败并给出以下错误

#!/bin/bash --login -eo pipefail
bundle exec danger --danger_id=SwiftLint --dangerfile=".danger/Danger-SwiftLint" --verbose
bundler: failed to load command: danger (/Users/distiller/project/vendor/bundle/ruby/3.0.0/bin/danger
/Users/distiller/project/vendor/bundle/ruby/3.0.0/gems/octokit-4.25.1/lib/octokit/response/raise_error.rb:14:in `on_complete': GET https://api.github.com/repos/***/***/pulls/17: 401 - Bad credentials // See: https://docs.github.com/rest (Octokit::Unauthorized)

我的 ruby 版本是 3.2.2,包版本是 2.4.13 我试图将 ruby 更改为不同的版本,从 2.6.10 -> 3.2.2 我写了 sudo gem update --system also removed Gemfile.lock 并写了 bundle install 和 bundle update 来重新安装 Gemfile.lock 还将 Danger-SwiftLint 文件留空 这是我的 config.yml 文件,也许我在里面弄错了

# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

parameters:
  run_all_tests:
    type: boolean
    default: false

# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:

  lint-build-test:
    macos:
      xcode: 14.2.0
    steps:
      - checkout

      - run: gem install bundler:2.3.12

      - restore_cache:
          name: Restore cache [Gems]
          key: v1-gems-{{ checksum "Gemfile.lock" }}
      - run:
          name: Install Gems (if needed)
          command: |
            bundle config path vendor/bundle
            bundle check || bundle install --path vendor/bundle --clean
      - save_cache:
          name: Save cache [Gems]
          key: v1-gems-{{ checksum "Gemfile.lock" }}
          paths:
            - vendor/bundle

      - run:
          name: Run Danger-SwiftLint
          command: bundle exec danger --danger_id=SwiftLint --dangerfile=".danger/Danger-SwiftLint" --verbose
          
          # DANGER_GITHUB_API_TOKEN - PAT of bot account is added to environment variables

      - run:
          name: Run Tests
          command: bundle exec fastlane all_tests --verbose
          # environment:
          #   SCAN_DEVICE: iPhone 8
          #   SCAN_SCHEME: CircleCI
      - store_artifacts:
          path: "./fastlane/test_output"
          destination: scan-test-output
      - store_artifacts:
          path: ~/Library/Logs/scan
          destination: scan-logs
      - store_test_results:
          path: "./fastlane/test_output"

      - run:
          name: Run Danger-XCOV
          command: bundle exec danger --danger_id=xcov --dangerfile=".danger/Danger-XCOV" --verbose
          when: always
          environment:
            FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 1200
            FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 10
            # DANGER_GITHUB_API_TOKEN - PAT of bot account is added to environment variables

      - run:
          name: Run Danger-Xcode_Summary
          command: bundle exec danger --danger_id=xcode_summary --dangerfile=".danger/Danger-Xcode_Summary" --verbose
          when: always
          # DANGER_GITHUB_API_TOKEN - PAT of bot account is added to environment variables

  swiftlint:
    docker:
      - image: bytesguy/swiftlint:latest
        # auth:
          # username: mydockerhub-user
          # password: $DOCKERHUB_PASSWORD  # context / project UI env-var reference
    steps:
      - checkout
      - run: swiftlint lint --reporter junit | tee result.xml
      - store_artifacts:
          path: result.xml
      - store_test_results:
          path: result.xml

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:

  test-workflow:
    when:
      or:
        - << pipeline.parameters.run_all_tests >>
        - not:
            equal: [ develop, << pipeline.git.branch >> ]

    jobs:
      # - swiftlint
      - lint-build-test

ios swift circleci circleci-2.0 circleci-workflows
© www.soinside.com 2019 - 2024. All rights reserved.