chore(deps): bump rollup from 4.35.0 to 4.59.0 #260
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: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x, 22.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgbm-dev jq xvfb | |
| npm ci | |
| - name: Install Chrome | |
| uses: browser-actions/setup-chrome@latest | |
| with: | |
| chrome-version: stable | |
| - name: Run tests with mocks | |
| run: | | |
| # Run tests with coverage and capture results in JSON format | |
| npm test -- --coverage.reporter=lcov --coverage.reporter=json-summary --reporter=json --outputFile=test-results.json | |
| # Extract coverage and test results | |
| { | |
| echo "# Test Results (Node ${{ matrix.node-version }})" | |
| echo "## Coverage" | |
| echo "| Type | Coverage | Details |" | |
| echo "|------|----------|----------|" | |
| # Use jq to parse the coverage JSON | |
| jq -r '.total | | |
| "| Statements | \(.statements.pct)% | \(.statements.covered)/\(.statements.total) |\n| Branches | \(.branches.pct)% | \(.branches.covered)/\(.branches.total) |\n| Functions | \(.functions.pct)% | \(.functions.covered)/\(.functions.total) |\n| Lines | \(.lines.pct)% | \(.lines.covered)/\(.lines.total) |"' coverage/coverage-summary.json || { | |
| echo "| Coverage data not available | - | - |" | |
| } | |
| echo "## Test Results" | |
| echo "| Total | Passed | Failed | Skipped |" | |
| echo "|-------|---------|---------|----------|" | |
| jq -r '"| \(.numTotalTests) | \(.numPassedTests) | \(.numFailedTests) | \(.numPendingTests) |"' test-results.json | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Live API sanity check | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| env: | |
| SCREENLY_API_KEY: ${{ secrets.SCREENLY_API_TOKEN }} | |
| run: | | |
| echo "## Live API Test Results" >> "$GITHUB_STEP_SUMMARY" | |
| npm test | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report-${{ matrix.node-version }} | |
| path: coverage/ | |
| - name: Run visual tests | |
| run: | | |
| mkdir -p __image_snapshots__ | |
| CHROME_PATH="$(which chrome)" xvfb-run --auto-servernum --server-args="-screen 0 1280x800x24" npm run test:visual:ci -- --update --reporter=json --outputFile=visual-test-results.json | |
| # Show test results and screenshots | |
| { | |
| if [ -f "visual-test-results.json" ]; then | |
| echo "## Visual Test Results" | |
| echo "| Total | Passed | Failed | Skipped |" | |
| echo "|-------|---------|---------|----------|" | |
| jq -r '"| \(.numTotalTests) | \(.numPassedTests) | \(.numFailedTests) | \(.numPendingTests) |"' visual-test-results.json | |
| echo "" | |
| fi | |
| echo "## Screenshots" | |
| echo "" | |
| for img in __image_snapshots__/ci-*.png; do | |
| if [ -f "$img" ]; then | |
| name=$(basename "$img" | sed -E 's/ci-Zapier Visual Tests (.+)-1\.png/\1/') | |
| echo "### $name" | |
| echo "" | |
| echo "<details>" | |
| echo "<summary>View Screenshot</summary>" | |
| echo "" | |
| encoded=$(base64 < "$img") | |
| echo "<img src=\"data:image/png;base64,${encoded}\" width=\"800\">" | |
| echo "" | |
| echo "</details>" | |
| echo "" | |
| fi | |
| done | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: screenshots-${{ matrix.node-version }} | |
| path: artifacts/ |