如何将日志文件从 Travis CI 导出到 GitHub?

ram*_*omu 5 github travis-ci

我正在使用 Travis CI.org(公共存储库)来执行我的构建,并且日志正在 Travis 主页(日志文件)上打印。我想提取日志文件/将日志文件发送到 Git HUB 或任何其他外部开源工具以访问它。

你能告诉我们如何实现这一目标吗?

ram*_*omu 3

我们可以将构建工件部署到S3:如果您使用 github 和 S3,请将以下代码粘贴到 .travis.yml 文件中。

after_failure:

addons:
  artifacts:
    paths:
       - $(git ls-files -o | tr "\n" ":")

deploy:

- provider: s3
- access_key_id: $ARTIFACTS_KEY
- secret_access_key: $ARTIFACTS_SECRET
- bucket: $ARTIFACTS_BUCKET
- skip_cleanup: true
- acl: public_read
Run Code Online (Sandbox Code Playgroud)

另外,如果您想向其发送免费的开源工具,您可以使用 chunk.io。将以下代码放入 shell 脚本中,并从 .travis.yml 文件的 after_failure 部分调用此代码:

cd path/to/directory/where/untracked files store/

count=$(git ls-files -o | wc -l)

git ls-files -o

echo ">>>>>>>>> CONTAINERS LOG FILES <<<<<<<<<<<<"

for (( i=1; i<"$count";i++ ))

do

file=$(echo $(git ls-files -o | sed "${i}q;d"))

echo "$file"

cat $file | curl -sT - chunk.io

done

echo " >>>>> testsummary log file <<<< "

cat testsummary.log | curl -sT - chunk.io
Run Code Online (Sandbox Code Playgroud)