Add validation utility tests and truncate parameter validation #578
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: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| # Run on all PRs regardless of target branch | |
| jobs: | |
| python-tests: | |
| name: Python Tests (3.13) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.13'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.9.8" | |
| enable-cache: true | |
| - name: Set up Node.js 24 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| cache-dependency-path: cli/package-lock.json | |
| - name: Install Python dependencies | |
| run: | | |
| uv venv | |
| uv pip sync requirements-dev.lock | |
| uv pip install -e . | |
| - name: Install Node dependencies and build CLI | |
| run: | | |
| cd cli | |
| npm ci | |
| npm run build | |
| - name: Lint with ruff | |
| run: uv run ruff check analyzer/ | |
| - name: Check Python formatting | |
| run: uv run ruff format --check analyzer/ | |
| - name: Type check with mypy | |
| run: uv run mypy analyzer/src --ignore-missing-imports | |
| - name: Run tests | |
| run: uv run pytest analyzer/tests/ -v --cov=analyzer/src --cov-report=term | |
| typescript-tests: | |
| name: TypeScript Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: ['24'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.9.8" | |
| enable-cache: true | |
| - name: Set up Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| cache-dependency-path: cli/package-lock.json | |
| - name: Install Python dependencies | |
| run: | | |
| uv venv | |
| uv pip sync requirements.lock | |
| uv pip install -e . | |
| - name: Install dependencies | |
| run: | | |
| cd cli | |
| npm ci | |
| - name: Lint TypeScript | |
| run: | | |
| cd cli | |
| npm run lint | |
| - name: Check TypeScript/JavaScript formatting | |
| run: | | |
| cd cli | |
| npm run format:check | |
| - name: Lint JSDoc | |
| run: | | |
| cd cli | |
| npm run lint:jsdoc | |
| continue-on-error: true | |
| - name: Type check | |
| run: | | |
| cd cli | |
| npx tsc --noEmit | |
| - name: Build | |
| run: | | |
| cd cli | |
| npm run build | |
| - name: Run tests | |
| run: | | |
| cd cli | |
| npm test | |
| - name: Run integration tests | |
| run: | | |
| cd cli | |
| npm run test:integration | |
| - name: Performance Benchmarks | |
| run: | | |
| cd cli | |
| npm test -- performance.bench.test.ts | |
| integration-test: | |
| name: Integration Test (Python + TypeScript) | |
| runs-on: ubuntu-latest | |
| needs: [python-tests, typescript-tests] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.9.8" | |
| enable-cache: true | |
| - name: Set up Node.js 24 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| cache-dependency-path: cli/package-lock.json | |
| - name: Install Python dependencies | |
| run: | | |
| uv venv | |
| uv pip sync requirements.lock | |
| uv pip install -e . | |
| - name: Install Node dependencies and build | |
| run: | | |
| cd cli | |
| npm ci | |
| npm run build | |
| - name: Run end-to-end analysis test | |
| env: | |
| DOCIMP_ANALYZER_PATH: ${{ github.workspace }}/analyzer | |
| run: | | |
| cd cli | |
| node dist/index.js analyze ../examples --format json > /dev/null | |
| echo "✓ End-to-end analysis completed successfully" | |
| module-system-matrix: | |
| name: Module System Tests (CommonJS/ESM) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.9.8" | |
| enable-cache: true | |
| - name: Set up Node.js 24 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| cache-dependency-path: cli/package-lock.json | |
| - name: Install dependencies | |
| run: | | |
| uv venv | |
| uv pip sync requirements.lock | |
| uv pip install -e . | |
| cd cli && npm ci && npm run build && cd .. | |
| - name: Test ESM JavaScript parsing | |
| run: | | |
| cd analyzer | |
| uv run python -c " | |
| from src.parsers.typescript_parser import TypeScriptParser | |
| parser = TypeScriptParser() | |
| items = parser.parse_file('../examples/test_javascript_patterns.js') | |
| assert any(item.module_system == 'esm' for item in items), 'ESM not detected' | |
| print('✓ ESM detection working') | |
| " | |
| - name: Test CommonJS parsing | |
| run: | | |
| cd analyzer | |
| uv run python -c " | |
| from src.parsers.typescript_parser import TypeScriptParser | |
| parser = TypeScriptParser() | |
| items = parser.parse_file('../examples/test_commonjs.cjs') | |
| assert any(item.module_system == 'commonjs' for item in items), 'CommonJS not detected' | |
| print('✓ CommonJS detection working') | |
| " | |
| workflow-validation: | |
| name: Workflow Validation (Test Samples) | |
| runs-on: ubuntu-latest | |
| needs: [python-tests, typescript-tests] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.9.8" | |
| enable-cache: true | |
| - name: Set up Node.js 24 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| cache-dependency-path: cli/package-lock.json | |
| - name: Install jq (for JSON validation in test script) | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Install Python dependencies | |
| run: | | |
| uv venv | |
| uv pip sync requirements.lock | |
| uv pip install -e . | |
| - name: Install Node dependencies and build | |
| run: | | |
| cd cli | |
| npm ci | |
| npm run build | |
| - name: Install docimp CLI globally | |
| run: | | |
| cd cli | |
| npm link | |
| - name: Run workflow validation tests | |
| env: | |
| DOCIMP_ANALYZER_PATH: ${{ github.workspace }}/analyzer | |
| run: | | |
| chmod +x test-samples/test-workflows.sh | |
| ./test-samples/test-workflows.sh | |
| - name: Run incremental analysis tests | |
| env: | |
| DOCIMP_ANALYZER_PATH: ${{ github.workspace }}/analyzer | |
| run: | | |
| chmod +x test-samples/test-incremental-analysis.sh | |
| ./test-samples/test-incremental-analysis.sh | |
| - name: Run status command tests | |
| env: | |
| DOCIMP_ANALYZER_PATH: ${{ github.workspace }}/analyzer | |
| run: | | |
| chmod +x test-samples/test-status-command.sh | |
| ./test-samples/test-status-command.sh |