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]
jobs:
   stepcheck:
    runs-on: [ubuntu-latest]
    steps:
      - name: fail step
        continue-on-error: true
        run: |
          error code
      - name: check step
        if: success()
        run: echo passed!

Option1.png

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

run: |
          error code || echo pass1