Feature: Instead of stopping for CI warnings, continue the workflow and print out all errors #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
pull_request: | |
branches: | |
- main | |
- staging | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./client | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "npm" | |
cache-dependency-path: client/package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
- name: Check formatting | |
id: format | |
run: npx prettier . --check | |
continue-on-error: true | |
- name: Run linter | |
id: lint | |
run: npm run lint | |
continue-on-error: true | |
- name: Run tests | |
id: test | |
run: npm test | |
continue-on-error: true | |
- name: Annotate formatting errors | |
if: steps.format.outcome != 'success' | |
run: echo "::warning file=client::Formatting errors found" | |
- name: Annotate linter errors | |
if: steps.lint.outcome != 'success' | |
run: echo "::warning file=client::Linter errors found" | |
- name: Annotate test errors | |
if: steps.test.outcome != 'success' | |
run: echo "::warning file=client::Test errors found" | |
- name: Fail the job if any checks failed | |
if: steps.format.outcome != 'success' || steps.lint.outcome != 'success' || steps.test.outcome != 'success' | |
run: exit 1 |