Add tests and github action to run them #6
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: Test Data Migration | |
| on: | |
| pull_request: | |
| paths: | |
| - 'v1-to-v2-data-migration/**' | |
| - '.github/workflows/test-migration.yml' | |
| jobs: | |
| test: | |
| name: Run Migration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Deno | |
| uses: denoland/setup-deno@v1 | |
| with: | |
| deno-version: v2.x | |
| - name: Cache Deno dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.deno | |
| ~/.cache/deno | |
| key: ${{ runner.os }}-deno-${{ hashFiles('v1-to-v2-data-migration/tests/deno.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deno- | |
| - name: Detect country and run tests | |
| working-directory: v1-to-v2-data-migration/tests | |
| run: | | |
| echo "🧪 Running migration tests with automatic country detection..." | |
| deno task test | |
| - name: Test Summary | |
| if: always() | |
| working-directory: v1-to-v2-data-migration/tests | |
| run: | | |
| # Extract country code from addressResolver.ts | |
| COUNTRY=$(deno eval "import { COUNTRY_CODE } from '../countryData/addressResolver.ts'; console.log(COUNTRY_CODE)") | |
| echo "## 🧪 Migration Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "**Country:** \`$COUNTRY\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 📦 Test Suites Executed" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Common unit tests (\`unit/\`)" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Country-specific tests (\`$COUNTRY/\`)" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 🎯 Tests Included" >> $GITHUB_STEP_SUMMARY | |
| echo "**Common Tests:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- Birth resolver tests" >> $GITHUB_STEP_SUMMARY | |
| echo "- Death resolver tests" >> $GITHUB_STEP_SUMMARY | |
| echo "- Action mapping tests" >> $GITHUB_STEP_SUMMARY | |
| echo "- Corrections tests" >> $GITHUB_STEP_SUMMARY | |
| echo "- Transform function tests" >> $GITHUB_STEP_SUMMARY | |
| echo "- Post-process tests" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Country-Specific Tests:**" >> $GITHUB_STEP_SUMMARY | |
| echo "- Address resolution tests" >> $GITHUB_STEP_SUMMARY | |
| echo "- Address corrections tests" >> $GITHUB_STEP_SUMMARY |