【问题标题】:Simple composer caches failes with bitbucket pipelines简单的作曲家缓存因 bitbucket 管道而失败
【发布时间】:2019-07-06 11:35:30
【问题描述】:

我正在尝试学习管道,我已经构建了一个简单的 2 个步骤。
1. 设置作曲家并缓存它
2. 构建和测试

请注意,我正在构建一个子文件夹

我没有收到任何错误,但它失败了。 这就是构建拆解必须说的:

Searching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.



image: 
 name: php:7.1.1
 run-as-user: 1

pipelines:
  default:
    - step:
        name: setup composer
        caches:
          - composer
        script:
          - apt-get update && apt-get install -y unzip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    - step:
        name: build and test
        caches:
           - composer
        script:
          - composer global require hirak/prestissimo
          - composer install -d cms/content/
          - vendor/bin/phpunit

definitions:
  caches:
    composer: cms/content/

【问题讨论】:

    标签: composer-php bitbucket-pipelines


    【解决方案1】:

    composer缓存只缓存使用composer install下载的依赖,下载的composer将永远被删除以进行下一步。解决此问题的最佳方法是将编写器操作放在您的第一步,保存工件(vendor 目录)以供下一步并在该步骤中测试您的应用程序。

    这看起来像这样:

    image: 
     name: php:7.1.1
     run-as-user: 1
    
    pipelines:
      default:
        - step:
            name: Build
            caches:
              - composer
            script:
              - apt-get update && apt-get install -y unzip
              - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
              - composer global require hirak/prestissimo
              - composer install -d cms/content/
            artifacts:
              - cms/content/vendor/**
        - step:
            name: Test
            script:
              - vendor/bin/phpunit
    
    definitions:
      caches:
        composer: cms/content/
    

    注意:我也认为您的 vendor/bin/phpunit 应该是 cms/content/vendor/bin/phpunit

    【讨论】:

      猜你喜欢
      • 2018-12-19
      • 2020-03-26
      • 2021-05-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-17
      • 2018-05-08
      • 1970-01-01
      • 2022-10-05
      相关资源
      最近更新 更多