Skip to content

Update node-ci-workflow.yml #39

Update node-ci-workflow.yml

Update node-ci-workflow.yml #39

# This workflow will build and test a Node.js project
name: Deploy to Firebase Functions via github action
on:
push:
branches: ["feature/*"]
pull_request:
branches: ["feature/*", "main"]
workflow_call:
jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up Node v18
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
working-directory: .
run: find ./* -maxdepth 2 -name package.json -execdir npm ci \;
- name: Lint with ESLint
run: DEBUG=eslint:cli-engine npx eslint .
- name: Test with 'ava' and 'nyc'
id: unit-tests-step
run: find ./* -maxdepth 2 -name ava.config.js -print0 | xargs --null -I {} npx nyc ava --tap | npx tap-junit > test.xml
- name: Publish test report
uses: mikepenz/action-junit-report@v4
if: success() || failure()
with:
report_paths: 'test.xml'
check_name: 'Test report'
require_passed_tests: true
detailed_summary: true
include_passed: true
- name: Generate test coverage report
id: unit-tests-cov-step
run: find ./* -maxdepth 1 -name package.json -print0 | xargs --null -I {} npx nyc report --reporter json-summary --reporter cobertura
- name: Publish test coverage report
uses: sidx1024/[email protected]
with:
coverage_file: "coverage/coverage-summary.json"
- name: Code Coverage Summary Report
uses: irongut/[email protected]
id: cov-report
with:
filename: coverage/cobertura-coverage.xml
badge: true
format: markdown
indicators: true
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
# if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Add Coverage
id: test-id
run: |
cat code-coverage-results.md
- name: Add Coverage check
uses: LouisBrunner/[email protected]
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: Test coveragec
conclusion: ${{ job.status }}
output: |
{"summary":"${ cat code-coverage-results.md }"}