Travis CI:构建失败,因为 "uncommitted changes"

Travis CI: Build failing because of "uncommitted changes"

我们已经在这个项目上使用 Travis CI 数周没有问题,现在我们的构建突然因为“未提交的更改”而失败。我不知道为什么。

  - Upgrading ramsey/collection (1.1.1 => 1.1.3): Checking out 28a5c4ab2f from cache
  - Upgrading brick/math (0.9.1 => 0.9.2): Checking out dff976c2f3 from cache
  - Upgrading symfony/translation (v5.2.1 => v5.2.5): Checking out 0947ab1e3a from cache
                                                                               
  [RuntimeException]                                                           
  Source directory /home/travis/build/vendor/nesbot/carbon has uncommitted changes.  

奇怪的是我们的 .travis.yml 文件根本没有改变。

language: php

php:
  - 7.3

services:
  - mysql

before_install:
  - mysql -e 'CREATE DATABASE travis_test;'

cache:
  directories:
    - node_modules
    - vendor

before_script:
  - cp .env.travis .env
  - sudo mysql -e 'create database homestead;'
  - composer self-update
  - composer install --prefer-source --no-interaction --dev
  - php artisan key:generate
  - php artisan migrate --no-interaction -vvv
  - php artisan import:required-data

script:
  - php artisan test

notifications:
  email: false

是什么导致了这个“未提交的更改”错误?我该如何解决?

Travis CI 存储供应商文件夹的缓存。有时,如果您在本地执行了 composer update,它可能会导致该缓存文件夹出现一些问题。解决方案是清除缓存并强制 Travis CI 重新构建所有内容。

为此,请转到您在 Travis CI 中的项目,单击 More options > Caches。在该页面上,您可以清除所有缓存。然后请 Travis CI 重建。

第一次会花很多时间,但应该会清除此错误消息。