diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 135f263..0d0e3c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,8 +99,8 @@ jobs: - name: 🧪 Roda suíte de testes run: npm test - sonarqube: - name: SonarQube + sonarcloud: + name: sonarcloud needs: [test] runs-on: ubuntu-latest env: @@ -111,55 +111,33 @@ jobs: PORT: ${{ secrets.PORT }} EMAIL: ${{ secrets.EMAIL }} SECRET: ${{ secrets.SECRET }} + continue-on-error: true steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@v4 + + - name: 📬 Caching + uses: actions/cache@v3 + with: + path: | + ${{ github.workspace }}/node_modules + ${{ github.workspace }}/dist + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.{js,jsx,ts,tsx}') }} + restore-keys: | + ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}- + - name: 🧰 Instala bibliotecas e dependências + run: npm i + + - name: 📜 Relatório do eslint + run: npx eslint -f json -o reports/eslint-report.json src || true + + - name: 🧪 Testes e cobertura + run: JEST_SONAR=jest-sonar CI=true npm test -- --coverage --passWithNoTests + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - # sonarcloud: - # name: sonarcloud - # needs: [test] - # runs-on: ubuntu-latest - # env: - # MONGO_URI: ${{ secrets.MONGO_URI }} - # MONGO_INITDB_ROOT_USERNAME: ${{ secrets.MONGO_INITDB_ROOT_USERNAME }} - # MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} - # DB_HOST: ${{ secrets.DB_HOST }} - # PORT: ${{ secrets.PORT }} - # EMAIL: ${{ secrets.EMAIL }} - # SECRET: ${{ secrets.SECRET }} - # continue-on-error: true - # steps: - # - name: Checkout code - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - - # - name: 📬 Caching - # uses: actions/cache@v3 - # with: - # path: | - # ${{ github.workspace }}/node_modules - # ${{ github.workspace }}/dist - # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.{js,jsx,ts,tsx}') }} - # restore-keys: | - # ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}- - # - name: 🧰 Instala bibliotecas e dependências - # run: npm i - - # - name: 📜 Relatório do eslint - # run: npx eslint -f json -o reports/eslint-report.json src || true - - # - name: 🧪 Testes e cobertura - # run: JEST_SONAR=jest-sonar CI=true npm test -- --coverage --passWithNoTests - - # - name: SonarCloud Scan - # uses: SonarSource/sonarcloud-github-action@master - # env: - # GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }} - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/jest.config.js b/jest.config.js index 57b6b47..fa7ff4a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -51,7 +51,7 @@ const config = { : ["default"], // A list of reporter names that Jest uses when writing coverage reports - coverageReporters: ["lcov"], + coverageReporters: ["lcov", "text", "clover"], // An object that configures minimum threshold enforcement for coverage results // coverageThreshold: undefined,