How do you mark a step as optional?

In Travis-CI, commands in the after_success: step can fail but the build as a whole is still counted successful. In AppVeyor, I use:

cmake --build . --target test & exit 0

So that my tests can fail but the job is still successful.

How do you do this in GitHub Actions?

Please use ‘jobs.<job_id>.steps.continue-on-error’ for your test step. Code sample as below:

name: step optional
on: [push]
    runs-on: [ubuntu-latest]
      - name: fail step
        continue-on-error: true
        run: |
          error code
      - name: check step
        if: success()
        run: echo passed!


Or use “||” to make the step to succeed, code sample as below:

run: |
          error code || echo pass1