我正在尝试将代码覆盖率数据从 Heroku-CI 上传到 Code Climate,但遇到了问题。Code Climate 上传者似乎期望该项目是一个 git 存储库,并且 Heroku-CI 以某种方式删除了该.git
文件夹。
当它运行时,我收到此错误:
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Error: exit status 128
任何想法这里的正确解决方案是什么?为什么 .git 文件夹不见了?Code Climate 能否以某种方式发挥作用?
完整的调试输出是:
time="2021-03-09T12:22:51Z" level=debug msg="about to run format-coverage"
time="2021-03-09T12:22:51Z" level=debug msg="searching for a formatter to use"
time="2021-03-09T12:22:51Z" level=debug msg="checking clover formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path build/logs/clover.xml for clover formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path clover.xml for clover formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking cobertura formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path cobertura.xml for cobertura formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking coverage.py formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path coverage.xml for coverage.py formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking gcov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path ./ for GCov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking gocov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path c.out for gocov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking jacoco formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path jacoco.xml for jacoco formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking lcov-json formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking excoveralls formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path cover/excoveralls.json for excoveralls formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking lcov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path coverage/lcov.info for lcov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking simplecov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path coverage/coverage.json for simplecov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="checking search path coverage/.resultset.json for simplecov formatter"
time="2021-03-09T12:22:51Z" level=debug msg="found file coverage/.resultset.json for simplecov formatter"
time="2021-03-09T12:22:52Z" level=debug msg="couldn't load committed at from ENV, trying git..."
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Error: exit status 128
Usage:
cc-test-reporter after-build [flags]
Flags:
-s, --batch-size int batch size for source files (default 500)
-e, --coverage-endpoint string endpoint to upload coverage information to (default "https://api.codeclimate.com/v1/test_reports")
-t, --coverage-input-type string type of input source to use [clover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov]
--exit-code int exit code of the test run
-r, --id string reporter identifier
--insecure send coverage insecurely (without HTTPS)
-p, --prefix string the root directory where the coverage analysis was performed (default "/app")
Global Flags:
-d, --debug run in debug mode
-----> test command `bundle exec rake spec && ls -la && ./cc-test-reporter after-build --exit-code $? --debug` failed with exit status 255
就在此之前,我让我的 CI 运行ls -la
,实际上,没有.git
文件夹:
total 13448
drwx------ 24 u26906 dyno 4096 Mar 9 12:22 .
drwxr-xr-x 11 root root 4096 Feb 24 07:43 ..
drwx------ 11 u26906 dyno 4096 Mar 9 12:19 app
-rw------- 1 u26906 dyno 1092 Mar 9 12:19 app.json
-rw------- 1 u26906 dyno 1661 Mar 9 12:19 babel.config.js
drwx------ 2 u26906 dyno 4096 Mar 9 12:19 bin
-rw------- 1 u26906 dyno 9 Mar 9 12:19 .browserslistrc
drwx------ 2 u26906 dyno 4096 Mar 9 12:19 .bundle
drwx------ 3 u26906 dyno 4096 Mar 9 12:21 .cache
-rwx------ 1 u26906 dyno 13206167 Mar 9 12:20 cc-test-reporter
drwx------ 6 u26906 dyno 4096 Mar 9 12:19 config
-rw------- 1 u26906 dyno 160 Mar 9 12:19 config.ru
drwx------ 3 u26906 dyno 4096 Mar 9 12:22 coverage
drwx------ 3 u26906 dyno 4096 Mar 9 12:19 db
-rw------- 1 u26906 dyno 47 Mar 9 12:19 .env.example
-rw------- 1 u26906 dyno 1843 Mar 9 12:19 Gemfile
-rw------- 1 u26906 dyno 9282 Mar 9 12:19 Gemfile.lock
-rw------- 1 u26906 dyno 327 Mar 9 12:19 .gitattributes
-rw------- 1 u26906 dyno 785 Mar 9 12:19 .gitignore
drwx------ 5 u26906 dyno 4096 Mar 9 12:20 .heroku
drwx------ 5 u26906 dyno 4096 Mar 9 12:19 .idea
drwx------ 4 u26906 dyno 4096 Mar 9 12:19 lib
drwx------ 2 u26906 dyno 4096 Mar 9 12:20 log
drwx------ 812 u26906 dyno 36864 Mar 9 12:21 nod_modules
drwx------ 3 u26906 dyno 4096 Mar 9 12:21 .npm
-rw------- 1 u26906 dyno 564 Mar 9 12:19 package.json
-rw------- 1 u26906 dyno 303 Mar 9 12:19 postcss.config.js
-rw------- 1 u26906 dyno 1 Mar 9 12:19 Procfile
drwx------ 2 u26906 dyno 4096 Mar 9 12:20 .profile.d
drwx------ 4 u26906 dyno 4096 Mar 9 12:22 public
-rw------- 1 u26906 dyno 258 Mar 9 12:19 Rakefile
-rw------- 1 u26906 dyno 67 Mar 9 12:19 README.md
-rw------- 1 u26906 dyno 22 Mar 9 12:19 .rspec
-rw------- 1 u26906 dyno 6 Mar 9 12:19 .ruby-version
drwx------ 11 u26906 dyno 4096 Mar 9 12:19 spec
drwx------ 3 u26906 dyno 4096 Mar 9 12:19 .sprettur
-rw------- 1 u26906 dyno 182 Mar 9 12:19 .standard.yml
drwx------ 2 u26906 dyno 4096 Mar 9 12:19 storage
drwx------ 4 u26906 dyno 4096 Mar 9 12:22 tmp
drwx------ 6 u26906 dyno 4096 Mar 9 12:19 vendor
drwx------ 2 u26906 dyno 4096 Mar 9 12:19 .vscode
drwx------ 3 u26906 dyno 4096 Mar 9 12:20 .yarn
-rw------- 1 u26906 dyno 349818 Mar 9 12:19 yarn.lock