Merge branch 'main' of https://github.com/LorenFrankLab/rec_to_nwb_ya… #117
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 Suite | |
| on: | |
| push: | |
| branches: [main] # Only run on pushes to main | |
| pull_request: | |
| branches: [main] # Run on all PRs to main | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| test: | |
| name: Unit & Integration Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linter | |
| run: npm run lint | |
| - name: Run all tests with coverage | |
| run: npm run test:coverage -- run | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/lcov.info | |
| flags: unittests | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload coverage artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| retention-days: 30 | |
| e2e: | |
| name: End-to-End Tests | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps chromium | |
| - name: Run E2E tests | |
| run: npm run test:e2e | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-test-results | |
| path: test-results/ | |
| retention-days: 30 | |
| integration: | |
| name: Schema Sync Check | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout this repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: rec_to_nwb_yaml_creator | |
| - name: Checkout trodes_to_nwb repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: LorenFrankLab/trodes_to_nwb | |
| ref: main | |
| path: trodes_to_nwb | |
| - name: Compare nwb_schema.json | |
| run: | | |
| cd rec_to_nwb_yaml_creator | |
| SCHEMA_HASH=$(sha256sum src/nwb_schema.json | cut -d' ' -f1) | |
| echo "Web app schema hash: $SCHEMA_HASH" | |
| cd ../trodes_to_nwb | |
| if [ -f "src/trodes_to_nwb/nwb_schema.json" ]; then | |
| PYTHON_SCHEMA_HASH=$(sha256sum src/trodes_to_nwb/nwb_schema.json | cut -d' ' -f1) | |
| echo "Python package schema hash: $PYTHON_SCHEMA_HASH" | |
| if [ "$SCHEMA_HASH" != "$PYTHON_SCHEMA_HASH" ]; then | |
| echo "❌ Schema mismatch detected!" | |
| echo "Web app hash: $SCHEMA_HASH" | |
| echo "Python pkg hash: $PYTHON_SCHEMA_HASH (main branch)" | |
| echo "" | |
| echo "The nwb_schema.json files are out of sync between repositories." | |
| echo "Please ensure the web app schema matches:" | |
| echo "https://github.com/LorenFrankLab/trodes_to_nwb/blob/main/src/trodes_to_nwb/nwb_schema.json" | |
| exit 1 | |
| fi | |
| echo "✅ Schemas are synchronized" | |
| else | |
| echo "⚠️ Warning: trodes_to_nwb schema file not found at expected location" | |
| echo "Skipping schema sync check" | |
| fi | |
| build: | |
| name: Build Application | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build production bundle | |
| # TODO: Remove CI=false after fixing ESLint warnings (target: Phase 3) | |
| # Create React App treats warnings as errors when CI=true | |
| # Known warnings: unused variables in App.js (lines 119, 122, 596, 618, 2852) | |
| # unused variables in ArrayUpdateMenu.jsx (line 13) | |
| # Issue: https://github.com/LorenFrankLab/rec_to_nwb_yaml_creator/issues/[TBD] | |
| run: CI=false npm run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build | |
| path: build/ | |
| retention-days: 7 |