Skip to content

Enhance error handling #64

Enhance error handling

Enhance error handling #64

Workflow file for this run

name: CI (lint, test, build)
on:
push:
pull_request:
types:
- opened
- reopened
jobs:
ci:
name: Continuous Integration (CI)
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20, 22]
steps:
# https://github.com/marketplace/actions/checkout
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # https://github.com/actions/checkout/releases/tag/v4.2.2
# https://github.com/marketplace/actions/setup-node-js-environment
- name: Setup Node.js
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # https://github.com/actions/setup-node/releases/tag/v4.2.0
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install Dependencies (npm-install)
run: npm ci
- name: Run Linter (npm-lint)
run: npm run lint
- name: Run Tests (unit-test)
run: npm run test:coverage
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow#example
# https://github.com/marketplace/actions/upload-a-build-artifact
- name: Archive Code Coverage Report (Only for Node.js 22)
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # https://github.com/actions/upload-artifact/releases/tag/v4.6.0
if: ${{ matrix.node-version == 22 }}
with:
name: code-coverage-report
path: coverage/
- name: Build the App with No Emit (build-app)
run: npm run build:noEmit
coverage-report:
name: Coverage Report
runs-on: ubuntu-22.04
needs: ci
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # https://github.com/actions/checkout/releases/tag/v4.2.2
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow#downloading-artifacts-during-a-workflow-run
# https://github.com/marketplace/actions/download-a-build-artifact
- name: Download Code Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # https://github.com/actions/download-artifact/releases/tag/v4.1.8
with:
name: code-coverage-report
path: coverage/
# https://github.com/marketplace/actions/codecov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # https://github.com/codecov/codecov-action/releases/tag/v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
# https://github.com/marketplace/actions/codacy-coverage-reporter
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@89d6c85cfafaec52c72b6c5e8b2878d33104c699 # https://github.com/codacy/codacy-coverage-reporter-action/releases/tag/v1.3.0
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/lcov.info