diff --git a/.github/workflows/make-coverage-html.yml b/.github/workflows/make-coverage-html.yml new file mode 100644 index 00000000..4c0a4107 --- /dev/null +++ b/.github/workflows/make-coverage-html.yml @@ -0,0 +1,57 @@ +# yamllint disable rule:line-length +# This workflow runs make coverage/html and verifies that the coverage HTML report is generated. +# yamllint enable rule:line-length + +--- +name: Make Coverage HTML + +env: + REPORT_DIR: "coverage/lcov-report" + REPORT_FILE: "index.html" + +on: # yamllint disable-line rule:truthy + push: + branches: ["main"] + pull_request: + branches: ["main"] + workflow_dispatch: + +jobs: + make-coverage-html: + name: "Run make coverage/html and verify coverage HTML" + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + - name: Set up Node.js + uses: actions/setup-node@v6 + with: + node-version: 24.x + + - name: Tool test + run: | + echo "Node.js version:" + node --version + echo "GNU make version:" + make --version + + - name: Run coverage HTML target + run: make coverage/html + + - name: Verify coverage HTML artifact + shell: bash + run: | + if [ ! -f $REPORT_DIR/$REPORT_FILE ]; then + echo "Coverage HTML file not found: $REPORT_DIR/$REPORT_FILE" + exit 1 + fi + if [ ! -s $REPORT_DIR/$REPORT_FILE ]; then + echo "Coverage HTML file is empty: $REPORT_DIR/$REPORT_FILE" + exit 1 + fi + + - name: Upload coverage HTML artifact + uses: actions/upload-artifact@v7 + with: + name: coverage-report-html + path: ${{ env.REPORT_DIR }} diff --git a/.github/workflows/node-coverage.js.yml b/.github/workflows/node-coverage.js.yml index f41f8b43..e02dc953 100644 --- a/.github/workflows/node-coverage.js.yml +++ b/.github/workflows/node-coverage.js.yml @@ -24,21 +24,26 @@ jobs: with: node-version: 24.x - - name: Install dependencies - run: npm ci --verbose + - name: Tool test + run: | + echo "Node.js version:" + node --version + echo "GNU make version:" + make --version - - name: Lint - run: npm run lint + - name: Install dependencies + run: make dependencies - - name: Run the tests - run: npm run jest:ci -- --coverage + - name: Run the tests with coverage + run: make coverage # Subir cobertura como artifact para que otros jobs lo usen - name: Upload coverage artifact uses: actions/upload-artifact@v7 + with: name: coverage-report - path: coverage # o la carpeta donde jest genera los reportes + path: coverage codecov: diff --git a/Makefile b/Makefile index d845e45f..8c6d88d7 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,13 @@ test: env dependencies coverage: test coverage/html: coverage - open coverage/lcov-report/index.html + @if [ "$$(uname)" = "Darwin" ]; then \ + open ./coverage/lcov-report/index.htmll; \ + elif [ "$$(uname | tr '[:upper:]' '[:lower:]')" = "mingw32" ] || [ "$$(uname | tr '[:upper:]' '[:lower:]')" = "mingw64" ] || [ "$$(uname | tr '[:upper:]' '[:lower:]')" = "cygwin" ]; then \ + cmd /c start ./coverage/lcov-report/index.htmll; \ + else \ + echo "Coverage HTML generated: ./coverage/lcov-report/index.htmll"; \ + fi outdated: -npm outdated