continuous-integration - 在 github 操作中重试失败的作业

标签 continuous-integration github-actions

我正在尝试使用 GitHub Actions对于 CI 测试,到目前为止,我的测试工作流程如下:

name: test

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: npm install
      - name: test
        run: |
          npm run lint
          npm test
        env:
          CI: true

.github/workflows/test.yml

它工作正常,除了我想重试 test如果测试失败,则单步(或整个工作)一次。

基本上,您使用 travis-retry 获得的行为相同:
script:
  - npm run lint
  - travis_retry npm test

或使用 Gitlab CI:
test:
  stage: test
  retry: 1
  script:
    - npm run lint
    - npm test

不确定是否有解决此问题的方法或相当简单的解决方法

最佳答案

对于您的特定用例,只需执行以下操作:

npm test || npm test

关于continuous-integration - 在 github 操作中重试失败的作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59356518/

相关文章:

github-actions - 我可以有多个 GitHub Actions 工作流程文件吗?

linux - golang.org/x/sys/unix 缺少函数体的问题

ios - Xcode 机器人服务器持续集成卡在 "Getting sources..."

continuous-integration - "Trigger on changes in snapshot dependencies"好像没有正常工作

使用 ImageMagick 的 GitHub Action : Create a PNG and commit it to the repo

.net - 带有 dotnet 代码检查的 Github 操作

github-actions - 如何将带有空格的字符串值传递给github actions env

使用 bazel 运行 java_test 时的 java.io.tmpdir

git - Jitterbit 项目 + Git + 持续集成

php - 为azure windows web应用程序terraform设置php版本时出错