我试图遵循 Github 的一个示例,用 Github 操作测试我的构建,然后压缩测试结果并将它们作为工件上传。 Https://help.github.com/en/actions/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts#uploading-build-and-test-artifacts
不过,如果我的测试失败了,我就不知道该怎么办了。这是我的行动。当我的测试通过所有的工作时,我的结果被压缩为一个工件,但是如果我的测试失败了,它将停止工作中的其余步骤,所以我的结果永远不会被发布。
我试着添加了 Continu- on-error: true < a href = “ https://help. github.com/en/actions/Automating-your-works-with-github-actions/working-sem- for-github-actions # jobjob _ idstep/Contin- on-error”rel = “ norefrer”> 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