Skip to content

fixed gitlab testing pipeline #30

fixed gitlab testing pipeline

fixed gitlab testing pipeline #30

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Coverage
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
outputs:
coverageJson: ${{ steps.getJson.outputs.coverageJson }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run test:coverage
- id: getJson
run: |
content=`cat coverage/coverage-summary.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=coverageJson::$content"
badge_job:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coverage badge
uses: RubbaBoy/[email protected]
with:
NAME: coverage
LABEL: 'Coverage'
ICON: 'github'
STATUS: '${{ fromJSON(needs.build.outputs.coverageJson).total.statements.pct }} %'
COLOR: green
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}