Skip to content

Update resource class to large.gen2 in CircleCI config #347

Update resource class to large.gen2 in CircleCI config

Update resource class to large.gen2 in CircleCI config #347

Workflow file for this run

name: Codecov CI with Vitest and SonarQube
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Initialize clean package.json
run: |
npm init -y
npm install vitest@1.6.1 @vitest/coverage-v8@1.6.1
# Optional: only install Codecov bundle plugin if you want bundle analysis:
# npm install @codecov/vite-plugin@latest
- name: Add test & build scripts manually
run: |
jq '.scripts.test="vitest run --coverage"' package.json > tmp.json && mv tmp.json package.json
jq '.scripts.build="vite build"' package.json > tmp.json && mv tmp.json package.json
- name: Create vitest.config.ts
run: |
echo "import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
include: ['app/**/*.test.js'],
coverage: {
provider: 'v8',
reporters: ['text', 'json', 'html', 'lcov'],
reportDir: 'coverage'
},
reporters: [
'default',
['junit', { outputFile: 'junit.xml' }]
]
}
})" > vitest.config.ts
# Uncomment this block if you eventually want bundle analysis enabled again:
#
# - name: Create vite.config.js (for Codecov Bundle Analysis)
# run: |
# echo "import { defineConfig } from 'vite';
# import { codecovVitePlugin } from '@codecov/vite-plugin';
# export default defineConfig({
# plugins: [
# codecovVitePlugin({
# enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
# bundleName: 'example-javascript',
# uploadToken: process.env.CODECOV_TOKEN
# })
# ]
# })" > vite.config.js
# - name: Build app for bundle analysis
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
# run: npm run build
- name: Run tests with coverage
run: npm run test || true
- name: List coverage files (debugging)
run: ls -R coverage
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
with:
args: >
-Dsonar.projectKey=nofarb_example-javascript
-Dsonar.organization=nofarb
-Dsonar.verbose=true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}