Just using coverage upload, manual coverage report #24
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Node.js CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout repository | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Set up Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: 'yarn' | |
cache-dependency-path: 'yarn.lock' | |
# Install dependencies | |
- name: Install dependencies | |
run: yarn install | |
# Create required directories | |
- name: Create directories | |
run: mkdir -p reports dist docs test-results | |
# Run Mocha tests | |
- name: Run tests with Mocha | |
run: | | |
export TS_NODE_COMPILER_OPTIONS="{\"module\":\"commonjs\"}" | |
./node_modules/.bin/nyc ./node_modules/.bin/mocha --import=tsx --recursive --timeout=10000 --exit --reporter json --reporter-option output=test-results.json | |
# Upload test results to Code Climate | |
- uses: dorny/test-reporter@v1 | |
with: | |
name: Test Reporter | |
path: test-results.json | |
reporter: mocha-json | |
# Run ESLint | |
- name: Run ESLint | |
run: | | |
./node_modules/.bin/eslint ./src --format junit --output-file ./reports/eslint/eslint.xml | |
# Generate code coverage report and upload to Code Climate | |
- name: Create Code Coverage Report | |
run: | | |
./node_modules/.bin/nyc report --reporter=text-lcov > lcov.info | |
- name: Upload Code Coverage Report | |
uses: paambaati/[email protected] | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
with: | |
coverageLocations: '${{github.workspace}}/lcov.info' | |
- name: Commit and Push Dist Folder | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
uses: actions4git/add-commit-push@v1 | |
with: | |
commit-message: '[skip ci] Add dist folder' | |
add-pathspec: 'dist/*' |