feat(#57): add Dominican Republic cédula validator #143
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| quality-checks: | |
| name: Code Quality Checks | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [16.x, 18.x, 20.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Prettier Check | |
| run: npm run format:check | |
| continue-on-error: false | |
| - name: ESLint Check | |
| run: npm run lint | |
| continue-on-error: true | |
| - name: TypeScript Compilation | |
| run: npm run build | |
| - name: Run Tests | |
| run: npm test | |
| - name: Upload test coverage | |
| if: matrix.node-version == '20.x' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-coverage | |
| path: coverage/ | |
| retention-days: 7 | |
| build-check: | |
| name: Build Verification | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Clean build | |
| run: npm run clean | |
| - name: Build project | |
| run: npm run build | |
| - name: Check dist folder | |
| run: | | |
| if [ ! -d "dist" ]; then | |
| echo "Error: dist folder not created" | |
| exit 1 | |
| fi | |
| if [ ! -f "dist/index.js" ]; then | |
| echo "Error: dist/index.js not found" | |
| exit 1 | |
| fi | |
| if [ ! -f "dist/index.d.ts" ]; then | |
| echo "Error: dist/index.d.ts not found" | |
| exit 1 | |
| fi | |
| echo "✓ Build artifacts verified" | |
| test-coverage: | |
| name: Test Coverage Report | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests with coverage | |
| run: npm run test:coverage | |
| - name: Display coverage summary | |
| run: | | |
| echo "## Test Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| cat coverage/coverage-summary.txt 2>/dev/null || echo "Coverage report not available" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| examples-check: | |
| name: Verify Examples | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| - name: Test basic validation example | |
| run: node docs/examples/basic-validation.js | |
| - name: Test parsing information example | |
| run: node docs/examples/parsing-information.js | |
| - name: Test batch validation example | |
| run: node docs/examples/batch-validation.js | |
| - name: Test real-world integration example | |
| run: node docs/examples/real-world-integration.js | |
| - name: Test TypeScript usage examples | |
| run: | | |
| npm run example | |
| npm run example:extended | |
| summary: | |
| name: CI Summary | |
| runs-on: ubuntu-latest | |
| needs: [quality-checks, build-check, test-coverage, examples-check] | |
| if: always() | |
| steps: | |
| - name: Check results | |
| run: | | |
| if [ "${{ needs.quality-checks.result }}" != "success" ]; then | |
| echo "❌ Quality checks failed" | |
| exit 1 | |
| fi | |
| if [ "${{ needs.build-check.result }}" != "success" ]; then | |
| echo "❌ Build verification failed" | |
| exit 1 | |
| fi | |
| if [ "${{ needs.test-coverage.result }}" != "success" ]; then | |
| echo "❌ Test coverage failed" | |
| exit 1 | |
| fi | |
| if [ "${{ needs.examples-check.result }}" != "success" ]; then | |
| echo "❌ Examples verification failed" | |
| exit 1 | |
| fi | |
| echo "✅ All CI checks passed!" |