Skip to content

fix error used wrong library #165

fix error used wrong library

fix error used wrong library #165

Workflow file for this run

# SPDX-FileCopyrightText: 2024 Marcellino Palerme <marcellino.palerme@inrae.fr>
#
# SPDX-License-Identifier: MIT
name: Tests Unit
on:
push:
branches: '*'
permissions:
contents: write
pull-requests: write
checks: write
env:
PGPASSWORD: ep2m2
PGUSER: ep2m2
PGPORT: 5432
PGDATABASE: ep2m2db
jobs:
test:
runs-on: ubuntu-latest
services:
service-p2m2tool-api:
image: inraep2m2/service-p2m2tools-api
ports:
- 8080:8080
db:
image: postgres:latest
# Provide the password for postgres
env:
POSTGRES_PASSWORD: ep2m2
POSTGRES_DB: ep2m2db
POSTGRES_USER: ep2m2
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Get repository
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: latest
cache: 'npm'
- name: Installation project s packages
run: npm ci
- name: Configure database
run: node ./db/init.js
- name: Test and Coverage
run: npm run test
- name: Report coverage
if: always()
uses: davelosert/vitest-coverage-report-action@v2
with:
file-coverage-mode: all
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: ⚙️ Generating coverage badges
uses: jpb06/coverage-badges-action@latest
with:
branches: '*'
badges-icon: vitest
- name: Summary Tests
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
./test/results/*.xml
- name: Complet report tests
uses: dorny/test-reporter@v1
if: always()
with:
reporter: "java-junit"
name: Test Unit
path: ./test/results/*.xml
- name: Extract test results
id: extract_results
run: |
node .github/workflows/extractResultsTest.js
- name: Generate Badges fail result global tests
if: steps.extract_results.outputs.successTests == 'false'
uses: jaywcjlove/generated-badges@main
with:
label: Tests
status: Fail
color: 'red'
output: badges/tests-result.svg
- name: Generate Badges pass result global tests
if: steps.extract_results.outputs.successTests == 'true'
uses: jaywcjlove/generated-badges@main
with:
label: Tests
status: Pass
color: 'green'
output: badges/tests-result.svg
- name: Generate Badges number tests
uses: jaywcjlove/generated-badges@main
with:
label: Number of tests
status: ${{ steps.extract_results.outputs.totalTests }}
color: 'black'
output: badges/tests-total.svg
- name: Generate Badges number passed tests
uses: jaywcjlove/generated-badges@main
with:
label: Passed tests
status: ${{ steps.extract_results.outputs.passedTests }}
color: 'green'
output: badges/tests-passed.svg
- name: Generate Badges number failed tests
uses: jaywcjlove/generated-badges@main
with:
label: Failed tests
status: ${{ steps.extract_results.outputs.failedTests }}
color: 'red'
output: badges/tests-failed.svg
- name: Generate Badges number todo tests
uses: jaywcjlove/generated-badges@main
with:
label: Todo tests
status: ${{ steps.extract_results.outputs.todoTests }}
color: 'yellow'
output: badges/tests-todo.svg
- name: Commit test badges
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add badges/*
git commit -m "Update test badges"
git push