Skip to content

anagri/exp-orama

Repository files navigation

GitHub Actions CI/CD

This directory contains GitHub Actions workflows for automated testing and deployment.

Workflows

Playwright Tests (playwright.yml)

Runs end-to-end tests using Playwright on every push and pull request.

Features:

  • Headless execution in CI environment
  • Virtual display setup for Linux runners (Xvfb)
  • Browser caching to speed up test runs
  • Test artifacts upload on failure
  • PR status reports with detailed results
  • Concurrent run prevention to avoid conflicts
  • Chrome-only execution (as per project requirements)

Triggers:

  • Push to main or master branches
  • Pull requests to main or master branches
  • Manual workflow dispatch with optional commit SHA

Environment:

  • Platform: Ubuntu Latest (cost-efficient)
  • Browser: Chrome (headless mode)
  • Display: Virtual display via Xvfb
  • Timeout: 15 minutes

Test Flow:

  1. Checkout code and setup Node.js
  2. Install dependencies with npm cache
  3. Install Playwright browsers with system dependencies
  4. Configure virtual display for headless execution
  5. Build Next.js application
  6. Start server on random port (20000-30000)
  7. Run Playwright tests with data-testid selectors
  8. Upload test results and reports on failure
  9. Report status to PR with detailed summary

Custom Actions

Setup Playwright (actions/setup-playwright)

Reusable action for setting up Playwright with optimal caching and system dependencies.

Inputs:

  • working-directory: Working directory (default: ".")
  • browsers: Browsers to install (default: "chromium")

Features:

  • Browser caching based on package-lock.json hash
  • Automatic system dependency installation on Linux
  • Support for multiple browser types

Best Practices Implemented

  1. Caching Strategy:

    • Playwright browsers cached by package-lock.json hash
    • npm dependencies cached by Node.js action
  2. Resource Optimization:

    • Chrome-only execution (per user requirements)
    • Ubuntu-only for cost efficiency
    • Concurrent run prevention
  3. Reliability:

    • Virtual display (Xvfb) for stable headless execution
    • Proper timeout handling (15 minutes)
    • Artifact retention for debugging
  4. Reporting:

    • Detailed PR comments with test results
    • Job summaries with status tables
    • Artifact uploads for failed tests
  5. Security:

    • Minimal permissions (read, checks, PR comments)
    • No secrets required for basic functionality
    • Controlled concurrent execution

Usage

The workflow runs automatically on pushes and PRs. For manual execution:

gh workflow run playwright.yml

Or with a specific commit:

gh workflow run playwright.yml -f commit_sha=abc123

Extending

To add more platforms or browsers:

strategy:
  matrix:
    os: [ubuntu-latest, macos-latest, windows-latest]

To test with multiple browsers:

- name: Setup Playwright
  uses: ./.github/actions/setup-playwright
  with:
    browsers: chromium firefox webkit

About

Chat with PDF - A client-side RAG application using Orama, Next.js 14, and OpenAI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published