composer-php - 简单的作曲家缓存因 bitbucket 管道而失败
问题描述
我正在尝试学习管道,并且我已经建立了一个简单的 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 缓存只缓存使用 下载的依赖项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
推荐阅读
- mfc - 如何捕捉对话框的移动事件?
- javascript - Redux - mapDispatchToProps 不适用于注销功能
- lodash - 如何通过所有属性从对象数组中获取唯一对象?
- ibm-datapower - IBM APIC 2018.1 与 DataPower 7.5.2.0 连接
- angular - 无法将子组件导入父组件
- docker-compose - 在 docker-compose 中发出运行命令
- python - 是否可以将kombu用作activeMQ的客户端库?
- java - 当你可以做一个接口时,抽象类有什么意义
- postgresql - 使用过滤器在数据库中查找表的子元素(DBeaver)
- wso2 - 注册 iOS 设备时发生密钥库错误