ci: enhanced CI/CD and test coverage

- Update version from 0.2.0 to 0.9.0
- Upgrade Vitest from v3 to v4 for improved testing capabilities
- Add @vitest/coverage-v8 for comprehensive code coverage reporting
- Enhance GitHub Actions CI workflow with separate unit and integration
test runs
- Integrate Codecov v5 for coverage reporting and test results tracking
- Add JUnit reporter for better test result analysis
- Configure @codecov/vite-plugin for automated coverage collection
This commit is contained in:
2025-10-23 00:59:18 -05:00
parent c7852ddab4
commit 852277d648
5 changed files with 498 additions and 168 deletions

View File

@@ -71,20 +71,30 @@ jobs:
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
- name: Run unit tests - name: Run unit tests
run: pnpm test:run run: pnpm test:run:coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run integration tests - name: Run integration tests
run: pnpm test:integration run: pnpm test:integration:coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage - name: Run tests with junit reporter
uses: codecov/codecov-action@v4 run: pnpm vitest run --reporter=junit --outputFile=test-report.junit.xml
if: always()
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
if: always() if: always()
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage-final.json
flags: unittests - name: Upload test results to Codecov
name: codecov-umbrella if: ${{ !cancelled() }}
fail_ci_if_error: false uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
# Build verification # Build verification
build: build:

View File

@@ -8,7 +8,7 @@
[![Next.js][badge-nextjs]][nextjs] [![Next.js][badge-nextjs]][nextjs]
[![React][badge-react]][react] [![React][badge-react]][react]
[badge-version]: https://img.shields.io/badge/version-0.2.0-blue [badge-version]: https://img.shields.io/badge/version-0.9.0-blue
[badge-license]: https://img.shields.io/badge/license-MIT-green [badge-license]: https://img.shields.io/badge/license-MIT-green
[badge-ci]: https://github.com/Xevion/rdap/actions/workflows/ci.yml/badge.svg [badge-ci]: https://github.com/Xevion/rdap/actions/workflows/ci.yml/badge.svg
[badge-codecov]: https://codecov.io/gh/Xevion/rdap/branch/master/graph/badge.svg [badge-codecov]: https://codecov.io/gh/Xevion/rdap/branch/master/graph/badge.svg

View File

@@ -1,6 +1,6 @@
{ {
"name": "rdap", "name": "rdap",
"version": "0.2.0", "version": "0.9.0",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "next build", "build": "next build",
@@ -13,8 +13,12 @@
"test": "vitest", "test": "vitest",
"test:ui": "vitest --ui", "test:ui": "vitest --ui",
"test:run": "vitest run --exclude '**/*.integration.test.{ts,tsx}'", "test:run": "vitest run --exclude '**/*.integration.test.{ts,tsx}'",
"test:integration": "vitest run src/rdap.integration.test.ts", "test:run:coverage": "vitest run --coverage --exclude '**/*.integration.test.{ts,tsx}'",
"test:integration": "vitest run src/__tests__/rdap-integration.test.ts",
"test:integration:coverage": "vitest run --coverage src/__tests__/rdap-integration.test.ts",
"test:all": "vitest run", "test:all": "vitest run",
"test:coverage": "vitest run --coverage",
"test:all:coverage": "vitest run --coverage",
"type-check": "tsc --noEmit", "type-check": "tsc --noEmit",
"prepare": "husky install" "prepare": "husky install"
}, },
@@ -40,6 +44,7 @@
"zod": "^4.1.12" "zod": "^4.1.12"
}, },
"devDependencies": { "devDependencies": {
"@codecov/vite-plugin": "^1.9.1",
"@commitlint/cli": "^19.0.0", "@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0", "@commitlint/config-conventional": "^19.0.0",
"@tailwindcss/postcss": "^4.1.15", "@tailwindcss/postcss": "^4.1.15",
@@ -50,7 +55,8 @@
"@types/react-dom": "^19.2.2", "@types/react-dom": "^19.2.2",
"@typescript-eslint/eslint-plugin": "^8.46.2", "@typescript-eslint/eslint-plugin": "^8.46.2",
"@typescript-eslint/parser": "^8.46.2", "@typescript-eslint/parser": "^8.46.2",
"@vitest/ui": "^3.2.4", "@vitest/coverage-v8": "^4.0.1",
"@vitest/ui": "^4.0.1",
"eslint": "^9.38.0", "eslint": "^9.38.0",
"eslint-config-next": "15.5.6", "eslint-config-next": "15.5.6",
"happy-dom": "^20.0.8", "happy-dom": "^20.0.8",
@@ -61,7 +67,7 @@
"prettier-plugin-tailwindcss": "^0.7.1", "prettier-plugin-tailwindcss": "^0.7.1",
"tailwindcss": "^4.1.15", "tailwindcss": "^4.1.15",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"vitest": "^3.2.4" "vitest": "^4.0.1"
}, },
"ct3aMetadata": { "ct3aMetadata": {
"initVersion": "7.2.0" "initVersion": "7.2.0"

603
pnpm-lock.yaml generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,32 @@
import { defineConfig } from "vitest/config"; import { defineConfig } from "vitest/config";
import { codecovVitePlugin } from "@codecov/vite-plugin";
import path from "path"; import path from "path";
export default defineConfig({ export default defineConfig({
plugins: [
codecovVitePlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: "rdap",
uploadToken: process.env.CODECOV_TOKEN,
}),
],
test: { test: {
globals: true, globals: true,
environment: "happy-dom", environment: "happy-dom",
setupFiles: ["./src/test/setup.ts"], setupFiles: ["./src/test/setup.ts"],
coverage: {
provider: "v8",
reporter: ["text", "json", "html", "lcov"],
exclude: [
"**/*.config.*",
"**/dist/**",
"**/node_modules/**",
"**/.next/**",
"**/test/**",
"**/*.test.{ts,tsx}",
"**/src/env/**",
],
},
}, },
resolve: { resolve: {
alias: { alias: {