snapshot with grid coordinates #293
Workflow file for this run
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 | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| node-version: ['20'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install dependencies | |
| run: | | |
| npm ci | |
| - name: Install Playwright Browsers | |
| run: | | |
| npx playwright install chromium | |
| npx playwright install-deps chromium || true | |
| - name: Lint with ESLint | |
| run: | | |
| npm run lint | |
| - name: Type check | |
| run: | | |
| npm run type-check | |
| - name: Format check | |
| run: | | |
| npm run format-check | |
| - name: Build package | |
| run: | | |
| npm run build | |
| - name: Build and sync extension | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| # Check if extension is already synced (from sync-extension workflow) | |
| if [ -d "src/extension" ] && [ -f "src/extension/manifest.json" ]; then | |
| echo "✅ Extension already synced in src/extension/" | |
| echo "📦 Extension files:" | |
| find src/extension -type f | head -10 | |
| elif [ -d "../sentience-chrome" ]; then | |
| echo "Building sentience-chrome extension..." | |
| cd ../sentience-chrome | |
| ./build.sh || echo "Extension build skipped (may not be available in CI)" | |
| if [ -f "dist/manifest.json" ]; then | |
| echo "Verifying extension build..." | |
| echo "Copying extension files to sdk-ts/src/extension..." | |
| cd ../sdk-ts | |
| mkdir -p src/extension/pkg | |
| # Copy required files | |
| cp ../sentience-chrome/dist/manifest.json src/extension/ | |
| cp ../sentience-chrome/dist/*.js src/extension/ 2>/dev/null || true | |
| cp -r ../sentience-chrome/pkg/* src/extension/pkg/ 2>/dev/null || true | |
| # Verify extension files are present | |
| echo "Verifying extension files..." | |
| REQUIRED_FILES=( | |
| "src/extension/manifest.json" | |
| "src/extension/injected_api.js" | |
| "src/extension/pkg/sentience_core.js" | |
| "src/extension/pkg/sentience_core_bg.wasm" | |
| ) | |
| MISSING_FILES=() | |
| for file in "${REQUIRED_FILES[@]}"; do | |
| if [ ! -f "$file" ]; then | |
| MISSING_FILES+=("$file") | |
| fi | |
| done | |
| if [ ${#MISSING_FILES[@]} -ne 0 ]; then | |
| echo "❌ Error: Missing required extension files:" | |
| printf ' - %s\n' "${MISSING_FILES[@]}" | |
| exit 1 | |
| fi | |
| echo "✅ Extension built and synced successfully" | |
| echo "📦 Extension files:" | |
| find src/extension -type f | head -10 | |
| else | |
| echo "⚠️ Warning: Extension build failed or dist/manifest.json not found" | |
| echo "Extension directory not found, skipping build" | |
| fi | |
| else | |
| echo "⚠️ Warning: Extension directory not found at ../sentience-chrome" | |
| echo "Extension may be synced via sync-extension workflow in src/extension/" | |
| echo "Tests requiring extension may fail if extension is not available." | |
| fi | |
| - name: Copy extension to dist for tests | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: | | |
| # After build, copy extension from src/extension to dist/extension | |
| # This is needed because tests run from dist/ and browser.ts looks for extension relative to __dirname | |
| if [ -d "src/extension" ] && [ -f "src/extension/manifest.json" ]; then | |
| echo "📦 Copying extension from src/extension to dist/extension..." | |
| mkdir -p dist/extension | |
| cp -r src/extension/* dist/extension/ | |
| # Verify copy - check critical files | |
| REQUIRED_FILES=( | |
| "dist/extension/manifest.json" | |
| "dist/extension/dist/background.js" | |
| "dist/extension/dist/content.js" | |
| "dist/extension/dist/injected_api.js" | |
| "dist/extension/pkg/sentience_core.js" | |
| "dist/extension/pkg/sentience_core_bg.wasm" | |
| ) | |
| MISSING_FILES=() | |
| for file in "${REQUIRED_FILES[@]}"; do | |
| if [ ! -f "$file" ]; then | |
| MISSING_FILES+=("$file") | |
| fi | |
| done | |
| if [ ${#MISSING_FILES[@]} -ne 0 ]; then | |
| echo "❌ Error: Missing required extension files after copy:" | |
| printf ' - %s\n' "${MISSING_FILES[@]}" | |
| echo "" | |
| echo "Files in dist/extension:" | |
| find dist/extension -type f | sort | |
| exit 1 | |
| fi | |
| echo "✅ Extension copied to dist/extension/" | |
| echo "📦 Extension structure:" | |
| find dist/extension -type f | sort | head -15 | |
| else | |
| echo "⚠️ Warning: src/extension not found, cannot copy to dist/extension" | |
| echo "Tests requiring extension may fail." | |
| fi | |
| - name: Run tests | |
| run: | | |
| npm test | |
| env: | |
| CI: true | |