Skip to content

Tv standalone

Tv standalone #1158

Workflow file for this run

name: PR Checks
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
packages: read
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Create package and run lint
run: npm run package
- name: Run tests
run: npm test
- name: Upload test reports
uses: actions/upload-artifact@v4
if: always() # Upload test reports even if tests failed
with:
name: test-reports-${{ github.run_number }}
path: |
mochawesome-report/
out/test/
retention-days: 30
- name: Upload compiled output
uses: actions/upload-artifact@v4
if: always()
with:
name: compiled-output-${{ github.run_number }}
path: |
out/
dist/
retention-days: 7
- name: Upload packaged extension
uses: actions/upload-artifact@v4
if: always()
with:
name: vscode-extension-${{ github.run_number }}
path: "*.vsix"
retention-days: 30
- name: Upload build logs
uses: actions/upload-artifact@v4
if: failure() # Only upload logs if something failed
with:
name: build-logs-${{ github.run_number }}
path: |
npm-debug.log*
yarn-error.log*
.npm/_logs/
retention-days: 7
e2e-tests:
runs-on: ubuntu-latest
needs: build-and-test
timeout-minutes: 60
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Check E2E support
id: e2e
run: |
HAS_E2E_SCRIPT="$(node -p "Boolean(require('./package.json').scripts?.['test:e2e'])")"
echo "has_script=${HAS_E2E_SCRIPT}" >> "$GITHUB_OUTPUT"
if [ "$HAS_E2E_SCRIPT" != "true" ]; then
echo "No test:e2e script configured; skipping E2E job."
fi
- name: Install Playwright browsers and dependencies
if: steps.e2e.outputs.has_script == 'true'
run: npx playwright install --with-deps chromium
- name: Run E2E tests
if: steps.e2e.outputs.has_script == 'true'
run: npm run test:e2e -- --workers=3
- name: Upload Playwright report
if: ${{ !cancelled() && steps.e2e.outputs.has_script == 'true' }}
uses: actions/upload-artifact@v4
with:
name: playwright-report-${{ github.run_number }}
path: playwright-report/
retention-days: 30
# Optional: Add a job to test the packaged extension
package-validation:
runs-on: ubuntu-latest
needs: build-and-test
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Download packaged extension
uses: actions/download-artifact@v4
with:
name: vscode-extension-${{ github.run_number }}
path: ./package/
- name: Validate package
run: |
echo "Checking if VSIX package was created..."
if ls ./package/*.vsix 1> /dev/null 2>&1; then
echo "✅ VSIX package found:"
ls -la ./package/*.vsix
# Install vsce to inspect the package
npm install -g @vscode/vsce
echo "📦 Package contents:"
vsce ls ./package/*.vsix
echo "✅ Package validation completed successfully"
else
echo "❌ No VSIX package found"
exit 1
fi
# Summary job that depends on all other jobs
pr-check-summary:
runs-on: ubuntu-latest
needs: [build-and-test, package-validation, e2e-tests]
if: always()
steps:
- name: Check results
run: |
echo "Build and Test: ${{ needs.build-and-test.result }}"
echo "Package Validation: ${{ needs.package-validation.result }}"
echo "E2E Tests: ${{ needs.e2e-tests.result }}"
if [[ "${{ needs.build-and-test.result }}" == "success" && "${{ needs.package-validation.result }}" == "success" && "${{ needs.e2e-tests.result }}" == "success" ]]; then
echo "✅ All checks passed!"
else
echo "❌ Some checks failed. Please review the artifacts and logs."
exit 1
fi