laravel - 使用 CircleCI 和 Laravel 6 Composer 安装失败
问题描述
为了学习 CI,我在 Homestead 中启动了一个新的 Laravel 项目。
我的circleci config.yml 如下所示
# PHP CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-php/ for more details
#
version: 2
jobs:
build:
docker:
# Specify the version you desire here
- image: circleci/php:7.3-stretch-node-browsers
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# Using the RAM variation mitigates I/O contention
# for database intensive operations.
# - image: circleci/mysql:5.7-ram
#
# - image: redis:3
steps:
- checkout
- run: sudo apt update && sudo apt install zlib1g-dev libsqlite3-dev
- run: sudo docker-php-ext-install zip
# Download and cache dependencies
# composer cache
- restore_cache:
keys:
# "composer.lock" can be used if it is committed to the repo
- v1-dependencies-{{ checksum "composer.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: composer install -n --prefer-dist
- save_cache:
key: composer-v1-{{ checksum "composer.lock" }}
paths:
- vendor
# node cache
- restore_cache:
keys:
- node-v4-{{ checksum "package.json" }}
- node-v4-
- run: npm install
- save_cache:
key: node-v4-{{ checksum "package.json" }}
paths:
- node_modules
- ~/.yarn
# prepare the database
- run: touch storage/testing.sqlite
- run: php artisan migrate --env=testing --database=sqlite_testing --force
# run tests with phpunit or codecept
#- run: ./vendor/bin/phpunit
# this example uses codecept but you're not limited to it
- run: ./vendor/bin/codecept build
- run: ./vendor/bin/codecept run --xml result.xml
- store_test_results:
path: tests/_output
- store_artifacts:
path: tests/_output
当 CircleCI 到达
- run: composer install -n --prefer-dist
尝试更新丢失的软件包仍然不起作用。
添加所需的存储库ppa:ondrej/php 会产生更多错误。
在本地,Laravel 位于 Homestead 内,带有 PHP 版本的PHP 7.3.2-3
我的问题是,我该如何解决这个问题,以及如何将我自己的 config.yml 文件放在一起,以用于我的特定项目?
解决方案
尝试添加- run: sudo docker-php-ext-install bcmath && sudo docker-php-ext-enable bcmath
到您的 CircleCI 配置中。
像这样:
steps:
- checkout
- run: sudo apt update && sudo apt install zlib1g-dev libsqlite3-dev
- run: sudo docker-php-ext-install zip
- run: sudo docker-php-ext-install bcmath && sudo docker-php-ext-enable bcmath
作曲家错误消息是说您的系统中缺少 bcmath 扩展,因此添加该行将在 CircleCI 工作程序上安装 PHP 扩展。
推荐阅读
- node.js - 找不到模块“C:\Users\8fwbu\Desktop\CodeTProj\test.js”
- mfc - MFC:应用程序的注册表项添加了随机 GUID 项,并添加了一个名为“Untitled”的空白 REG_SZ 值?
- qt - Qt Grid Layout 让小部件不移动,忽略对齐
- generics - Rust:泛型参数可以有引用其他参数的界限吗?
- r - 使用迁移助手从 Intel 迁移到 Apple Silicon M1 后使用 R 返回错误:Bad CPU type in executable and Undefined error: 0
- c# - 在异步任务中并行使用 WebView2
- jquery - 如何销毁 ASP.net MVC 视图上的现有 jQuery 表,然后重建它?
- python - 输入图像错误中的通道数无效?
- javascript - Bash 将 SIGINT 路由到从 Bash 脚本启动的文件/进程
- java - 我使用布尔错误吗?