Skip to content

Commit

Permalink
chore: init coverage ci with codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunny-unik committed Dec 11, 2023
1 parent b2ceffb commit 6226c6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
32 changes: 12 additions & 20 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,21 @@ jobs:
node: [16, 18]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check-out repository
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2

# Runs a single command using the runners shell
- name: Setup Node.js environment
uses: actions/setup-node@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node-version }}

# Install project
- name: Install project
- name: Install dependencies
run: npm install
- run: npm t

- name: Generate JaCoCo Badge
# if: ${{ github.ref == 'refs/heads/master' }}
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
badges-directory: build/reports/jacoco/test/html/badges
- name: Publish coverage report to GitHub Pages
# if: ${{ github.ref == 'refs/heads/master' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build/reports/jacoco/test/html
- name: Run tests
run: npm t

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"testWatch": "cross-env PORT=5001 NODE_OPTIONS='--experimental-vm-modules'; npx jest --watchAll --testTimeout=10000 --detectOpenHandles",
"test": "cross-env PORT=4001 NODE_OPTIONS='--experimental-vm-modules'; jest --coverage --forceExit"
"test": "cross-env PORT=4001 NODE_OPTIONS='--experimental-vm-modules'; jest --coverage --testTimeout=10000 --forceExit"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 6226c6e

Please sign in to comment.