Merge pull request #594 from frankieramirez/dependabot/npm_and_yarn/f… #1283
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: | |
| pull_request: | |
| branches: [main, master] | |
| push: | |
| branches: [main, master] | |
| schedule: | |
| - cron: "17 8 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| # =========================================================================== | |
| # Backend Python Tests | |
| # =========================================================================== | |
| backend-tests: | |
| name: Backend Tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Note: Python 3.10+ required due to mokkari>=3.0.0 dependency | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: uv.lock | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y unrar | |
| - name: Install Python dependencies | |
| run: uv sync --locked --extra dev | |
| - name: Run unit tests | |
| run: | | |
| uv run pytest tests/unit -v --cov=comicarr --cov-report=xml --cov-report=term-missing -m "not slow" | |
| - name: Run integration tests | |
| run: | | |
| uv run pytest tests/integration -v --cov=comicarr --cov-append --cov-report=xml --cov-report=term-missing -m "not slow" | |
| - name: Upload coverage report | |
| uses: codecov/codecov-action@v7 | |
| if: matrix.python-version == '3.11' # Only upload once | |
| with: | |
| files: ./coverage.xml | |
| flags: backend | |
| name: backend-python-${{ matrix.python-version }} | |
| fail_ci_if_error: false | |
| migration-dialects: | |
| name: Schema migrations (${{ matrix.dialect }}) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - dialect: sqlite | |
| extra: "" | |
| database_url: sqlite:////tmp/comicarr-migrations.db | |
| - dialect: postgresql | |
| extra: postgres | |
| database_url: postgresql://comicarr:comicarr@127.0.0.1:5432/comicarr | |
| - dialect: mysql | |
| extra: mysql-pure | |
| database_url: mysql+pymysql://comicarr:comicarr@127.0.0.1:3306/comicarr | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_DB: comicarr | |
| POSTGRES_USER: comicarr | |
| POSTGRES_PASSWORD: comicarr | |
| ports: [5432:5432] | |
| options: >- | |
| --health-cmd "pg_isready -U comicarr -d comicarr" | |
| --health-interval 10s --health-timeout 5s --health-retries 5 | |
| mysql: | |
| image: mysql:8.4 | |
| env: | |
| MYSQL_DATABASE: comicarr | |
| MYSQL_USER: comicarr | |
| MYSQL_PASSWORD: comicarr | |
| MYSQL_ROOT_PASSWORD: root | |
| ports: [3306:3306] | |
| options: >- | |
| --health-cmd "mysqladmin ping -h 127.0.0.1 -uroot -proot" | |
| --health-interval 10s --health-timeout 5s --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.11" | |
| - uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: uv.lock | |
| - name: Install migration dependencies | |
| run: uv sync --locked --extra dev ${{ matrix.extra && format('--extra {0}', matrix.extra) || '' }} | |
| - name: Verify application fresh and legacy migration paths | |
| env: | |
| DATABASE_URL: ${{ matrix.database_url }} | |
| run: uv run pytest tests/integration/test_schema_migration_dialects.py -q | |
| - name: Check adopted schema | |
| env: | |
| DATABASE_URL: ${{ matrix.database_url }} | |
| run: | | |
| uv run alembic current --check-heads | |
| uv run alembic check | |
| # =========================================================================== | |
| # Frontend Tests | |
| # =========================================================================== | |
| frontend-tests: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: 'frontend/package-lock.json' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linting | |
| run: npm run lint | |
| - name: Run type checking | |
| run: npm run typecheck | |
| - name: Run unit and component tests | |
| run: npm run test:run | |
| - name: Run tests with coverage | |
| run: npm run test:coverage | |
| continue-on-error: true # Coverage may fail if no tests exist yet | |
| - name: Upload coverage report | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| files: ./frontend/coverage/lcov.info | |
| flags: frontend | |
| name: frontend | |
| fail_ci_if_error: false | |
| # =========================================================================== | |
| # E2E Tests | |
| # =========================================================================== | |
| e2e-tests: | |
| name: E2E Smoke Tests | |
| runs-on: ubuntu-latest | |
| needs: [backend-tests, frontend-tests] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.11" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: uv.lock | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: 'frontend/package-lock.json' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y unrar | |
| - name: Install Python dependencies | |
| run: uv sync --locked | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| working-directory: frontend | |
| run: npx playwright install --with-deps chromium | |
| - name: Build frontend | |
| working-directory: frontend | |
| run: npm run build | |
| - name: Run smoke E2E tests | |
| working-directory: frontend | |
| run: npm run test:e2e:smoke | |
| env: | |
| COMICARR_E2E_PYTHON: ${{ github.workspace }}/.venv/bin/python | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: playwright-smoke-report | |
| path: frontend/playwright-report/ | |
| retention-days: 7 | |
| - name: Upload Playwright traces | |
| uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: playwright-smoke-test-results | |
| path: frontend/test-results/ | |
| retention-days: 7 | |
| # =========================================================================== | |
| # Full E2E Tests | |
| # =========================================================================== | |
| e2e-full-tests: | |
| name: E2E Full Tests | |
| runs-on: ubuntu-latest | |
| needs: [backend-tests, frontend-tests] | |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.11" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: uv.lock | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: 'frontend/package-lock.json' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y unrar | |
| - name: Install Python dependencies | |
| run: uv sync --locked | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| working-directory: frontend | |
| run: npx playwright install --with-deps chromium | |
| - name: Build frontend | |
| working-directory: frontend | |
| run: npm run build | |
| - name: Run full E2E tests | |
| working-directory: frontend | |
| run: npm run test:e2e:full | |
| env: | |
| COMICARR_E2E_PYTHON: ${{ github.workspace }}/.venv/bin/python | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: playwright-full-report | |
| path: frontend/playwright-report/ | |
| retention-days: 7 | |
| - name: Upload Playwright traces | |
| uses: actions/upload-artifact@v7 | |
| if: failure() | |
| with: | |
| name: playwright-full-test-results | |
| path: frontend/test-results/ | |
| retention-days: 7 | |
| # =========================================================================== | |
| # Summary Job | |
| # =========================================================================== | |
| test-summary: | |
| name: Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [backend-tests, frontend-tests, e2e-tests, e2e-full-tests, migration-dialects] | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| if [ "${{ needs.backend-tests.result }}" == "failure" ] || [ "${{ needs.frontend-tests.result }}" == "failure" ] || [ "${{ needs.e2e-tests.result }}" == "failure" ] || [ "${{ needs.e2e-full-tests.result }}" == "failure" ] || [ "${{ needs.migration-dialects.result }}" == "failure" ]; then | |
| echo "Some tests failed!" | |
| exit 1 | |
| fi | |
| echo "All tests passed!" |