Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test coverage #6

Merged
merged 8 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 38 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,52 @@
name: CI

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
types:
- opened
- synchronize
- reopened

jobs:
build:

build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Check out code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install

- name: Run Code Climate Test Reporter before-build
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Run tests with coverage
run: npm run coverage

- name: Install dependencies
run: yarn install
- name: Format coverage report for Code Climate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
./cc-test-reporter format-coverage coverage/lcov.info \
--input-type lcov \
--output coverage/codeclimate.json

- name: Run tests
run: yarn test
- name: Upload coverage to Code Climate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
./cc-test-reporter upload-coverage \
--input coverage/codeclimate.json
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"dev": "tsc-watch --onSuccess 'node dist/index.js'",
"test": "jest",
"test:watch": "jest --watch",
"prebuild": "rimraf ./dist"
"prebuild": "rimraf ./dist",
"coverage": "jest --coverage"
},
"files": [
"dist"
Expand Down