Skip to content

Feat/add UI tests

Feat/add UI tests #22

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [24.x]
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Vitest
run: npm run test:ci
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage
# Leer coverage-summary.json y extraer lineas
- id: coverage
run: |
coverage=$(node -pe "JSON.parse(require('fs').readFileSync('coverage/coverage-final.json')).total.lines.pct")
echo "coverage=$coverage" >> $GITHUB_ENV
# Crear badge dinámico con shields.io
- name: Create badge
run: |
curl -o coverage-badge.svg \
"https://img.shields.io/badge/coverage-${{ env.coverage }}%25-brightgreen.svg"
# Guardar artifact
- uses: actions/upload-artifact@v4
with:
name: coverage-badge
path: coverage-badge.svg
# coverage:
# name: coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@master
# - uses: actions/setup-node@master
# with:
# node-version: '20'
# - run: npm ci
# - uses: paambaati/codeclimate-action@v2.6.0
# env:
# CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
# with:
# coverageCommand: npm test -- --coverage
# coverageLocations: |
# ${{github.workspace}}/coverage/lcov.info:lcov