Skip to content

[MOB-11389] add-tests #8

[MOB-11389] add-tests

[MOB-11389] add-tests #8

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
types:
- checks_requested
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Lint files
run: yarn lint
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Run unit tests with coverage
run: yarn test:coverage --maxWorkers=2
- name: Check coverage thresholds
run: |
COVERAGE_THRESHOLD=80
COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct')
if (( $(echo "$COVERAGE < $COVERAGE_THRESHOLD" | bc -l) )); then
echo "Coverage ($COVERAGE%) is below threshold ($COVERAGE_THRESHOLD%)"
exit 1
fi
echo "Coverage ($COVERAGE%) is above threshold ($COVERAGE_THRESHOLD%)"
- name: Upload coverage to Code Climate
uses: paambaati/codeclimate-action@v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_KEY }}
with:
coverageCommand: yarn test:coverage --coverageReporters lcov
coverageLocations: |
${{github.workspace}}/coverage/lcov.info:lcov
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# directory: ./coverage/
# flags: unittests
# name: codecov-umbrella
# fail_ci_if_error: true
test-comment:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Run tests
run: |
yarn test:coverage --coverageReporters json-summary
- name: Test coverage comment
id: coverageComment
uses: MishaKav/jest-coverage-comment@main
with:
hide-comment: false
coverage-summary-path: ./coverage/coverage-summary.json
build-library:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Build package
run: yarn prepare
misspell:
name: runner / misspell
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: misspell
uses: reviewdog/action-misspell@9daa94af4357dddb6fd3775de806bc0a8e98d3e4 # v1.26.3
with:
github_token: ${{ secrets.github_token }}
locale: 'US'