Skip to content

chore: CI workflow to only upload report if CODACY_PROJECT_TOKEN is set #193

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

Merged
merged 2 commits into from
May 28, 2020
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
22 changes: 0 additions & 22 deletions .github/workflows/codacy-coverage-reporter.yml

This file was deleted.

42 changes: 39 additions & 3 deletions .github/workflows/nodejs-ci-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,55 @@ on:

jobs:
build:

name: Build and test
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- name: Test on Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

coverage:
name: Code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Generate coverage report
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm ci
- run: npm run build --if-present
- run: npm run coverage
- name: Upload coverage report to storage
uses: actions/upload-artifact@v1
with:
name: coverage
path: coverage/lcov.info

publish:
name: Publish code coverage report
needs: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download coverage report from storage
uses: actions/download-artifact@v1
with:
name: coverage
- name: Upload coverage report to codacy
uses: actions/setup-node@v1
with:
node-version: 12.x
- run: |
( [[ "${CODACY_PROJECT_TOKEN}" != "" ]] && npm run coverage-publish ) || echo "Coverage report not published"
env:
CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"pretest": "npm run lint",
"test": "mocha test/**/*.js",
"coverage": "nyc --reporter=lcov --reporter=text npm run test",
"precoverage-publish": "npm run coverage",
"coverage-publish": "wget -qO - https://coverage.codacy.com/get.sh | bash -s report -l JavaScript -r coverage/lcov.info",
"generate-docs": "jsdoc --configure .jsdoc.json --verbose",
"release": "standard-version"
Expand Down