feat(MWPW-162835): ability to have multiple event sort options #478
This file contains 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: Pull Request | |
on: [pull_request] | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: write-all | |
jobs: | |
check-linting: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13.1 | |
cache: 'npm' | |
- name: Install | |
run: npm ci | |
- name: Lint | |
run: npm run lint | |
check-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13.1 | |
cache: 'npm' | |
- name: Install | |
run: npm ci | |
- name: Build | |
run: npm run build | |
run-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13.1 | |
- name: Install | |
run: npm ci | |
- name: Coverage | |
run: npm run test:unit | |
check-coverage-thresholds: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13.1 | |
- name: Install | |
run: npm ci | |
- name: Coverage | |
run: npm run test:coverage | |
deployment: | |
needs: check-build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: '.' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
run-web-vitals-checks: | |
runs-on: ubuntu-latest | |
needs: deployment | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13.1 | |
cache: 'npm' | |
- name: Install dependencies | |
run: | | |
npm ci | |
npm install puppeteer web-vitals | |
- name: Install Chrome dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xvfb libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libasound2 | |
- name: Record Web Vitals | |
run: | | |
xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" node scripts/record-web-vitals.js | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
- name: Create PR Comment | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs'); | |
const metrics = JSON.parse(fs.readFileSync('.github/web-vitals-history.json', 'utf8')); | |
const latest = metrics[metrics.length - 1]; | |
const formatMetric = (metric) => { | |
if (!metric) return 'Not available'; | |
return `${metric.mean.toFixed(2)} ±${metric.stdDev.toFixed(2)}`; | |
}; | |
const comment = `## Core Web Vitals Results | |
### Desktop | |
- LCP: ${formatMetric(latest.metrics.desktop.lcp)} | |
- FID: ${formatMetric(latest.metrics.desktop.fid)} | |
- CLS: ${formatMetric(latest.metrics.desktop.cls)} | |
### Mobile | |
- LCP: ${formatMetric(latest.metrics.mobile.lcp)} | |
- FID: ${formatMetric(latest.metrics.mobile.fid)} | |
- CLS: ${formatMetric(latest.metrics.mobile.cls)} | |
Recorded at: ${latest.timestamp} | |
`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment | |
}); | |
- name: Commit updated history | |
if: github.event.pull_request.merged == true | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email 'action@github.com' | |
git add .github/web-vitals-history.json | |
git commit -m "chore: update web vitals history [skip ci]" || echo "No changes to commit" | |
git push || echo "No changes to push" | |
run-e2e-tests: | |
runs-on: ubuntu-latest | |
needs: deployment | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Chrome | |
uses: browser-actions/setup-chrome@v1 | |
with: | |
chrome-version: 'stable' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13.1 | |
- name: Install | |
run: npm ci | |
- name: Install Matching ChromeDriver | |
run: | | |
CHROME_VERSION=$(google-chrome --version | cut -d' ' -f3 | cut -d'.' -f1) | |
npm install chromedriver@$CHROME_VERSION | |
- name: E2E | |
run: npm run test:e2e-prod | |
run-accessibility-checks: | |
runs-on: ubuntu-latest | |
needs: deployment | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js 18.0.0x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.0.0 | |
- name: Run pa11y | |
run: | | |
npm install -g pa11y@latest | |
pa11y https://adobecom.github.io/caas/ --timeout=10000 --threshold 20 --debug | |
run-lighthouse-checks: | |
runs-on: ubuntu-latest | |
needs: deployment | |
steps: | |
- uses: actions/checkout@master | |
- name: Lighthouse | |
uses: foo-software/lighthouse-check-action@master | |
id: lighthouseCheck | |
with: | |
urls: 'https://adobecom.github.io/caas/' | |
- name: Verify Lighthouse Check results | |
uses: foo-software/lighthouse-check-status-action@master | |
with: | |
lighthouseCheckResults: ${{ steps.lighthouseCheck.outputs.lighthouseCheckResults }} | |
minAccessibilityScore: "80" | |
minBestPracticesScore: "80" | |
minPerformanceScore: "30" | |
minProgressiveWebAppScore: "30" | |
minSeoScore: "70" | |