Skip to content

feat(workflow): improve test coverage validation for Node.js CI workflow #5

feat(workflow): improve test coverage validation for Node.js CI workflow

feat(workflow): improve test coverage validation for Node.js CI workflow #5

Workflow file for this run

name: Coverage
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: bitnami/postgresql:13.16.0
env:
POSTGRES_USER: docker
POSTGRES_PASSWORD: docker
POSTGRES_DB: event-booster-test
ports:
- 5433:5432
redis:
image: bitnami/redis:latest
env:
REDIS_PASSWORD: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- name: Install Bun
run: |
curl -fsSL https://bun.sh/install | bash
echo "$HOME/.bun/bin" >> $GITHUB_PATH
- name: Install dependencies
run: bun install
- name: Run migrations
run: bun run pretest
- name: Execute test coverage
run: bun run test:coverage
- name: Check code coverage
run: |
COVERAGE=$(grep 'Lines' ./coverage/lcov.info | sed 's/[^0-9]*//g')
echo "Line coverage is $COVERAGE%"
if [ "$COVERAGE" -lt 90 ]; then
echo "Test coverage is below 90%"
exit 1
fi