Core web vitals 2 #443
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: Check if baseline exists | |
id: check | |
run: | | |
if [ ! -f .github/web-vitals-history.json ]; then | |
echo "No baseline found in repository" | |
exit 1 | |
fi | |
- name: Run Web Vitals Check | |
id: web-vitals | |
run: | | |
xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" node ./web-vitals-check.js https://adobecom.github.io/caas/ | |
- name: Commit updated baseline if improved | |
if: success() | |
run: | | |
if [ -f .github/web-vitals-history.json ]; then | |
git config --global user.name 'GitHub Action' | |
git config --global user.email '[email protected]' | |
git add .github/web-vitals-history.json | |
git commit -m "chore: update web vitals baseline" || echo "No changes to commit" | |
git push || echo "No changes to push" | |
fi | |
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" | |