我正在尝试遵循Github的示例,该示例使用github动作测试我的构建,然后压缩测试结果并将其作为工件上传。 https://help.github.com/en/actions/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts#uploading-build-and-test-artifacts
但是,当我的测试失败时,我该怎么办。这是我的行动。当我的测试通过时,一切工作正常,我的结果将被压缩为导出的工件,但是如果我的测试失败,它将停止工作的其余步骤,因此我的结果永远不会发布。
我尝试添加错误继续:true https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
这样可以使其在失败后继续并上传我的测试结果。但即使我的测试步骤失败,该作业也会被标记为通过。即使某个步骤失败,也可以通过某种方式使其上传我的工件,同时仍将整个作业标记为失败?
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Test App
run: ./gradlew test
- name: Archive Rest Results
uses: actions/upload-artifact@v1
with:
name: test-results
path: app/build/reports/tests
答案 0 :(得分:2)