Skip to content

CDN Performance

CDN Performance #11

Workflow file for this run

name: CDN Performance # workflow name displayed in GitHub
on:
schedule:
- cron: '0 0 * * 0' # run weekly on Sunday
workflow_dispatch: # allow manual runs
jobs:
measure:
runs-on: ubuntu-latest # run on Ubuntu runner
steps:
- name: Checkout repository
uses: actions/checkout@v3 # fetch repo
- name: Setup Node
uses: actions/setup-node@v3 # install node
with:
node-version: 18 # desired node version
- name: Cache node modules #speeds install
uses: actions/cache@v3 #restore node_modules
with:
path: node_modules #directory to cache
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} #unique cache key
restore-keys: |
${{ runner.os }}-node- #fallback key prefix
- name: Install dependencies
run: npm ci # uses lock file for deterministic install
- name: Run tests #executes suite before build
run: npm test #runs npm test command
- name: Build CSS # generates hashed CSS before performance test
run: npm run build # ensures build.hash and hashed CSS exist
- name: Run performance script
run: node scripts/performance.js --json > performance.log # generate log and json
- name: Upload results
uses: actions/upload-artifact@v3 # archive log
with:
name: cdn-performance # artifact name
path: performance.log # artifact path
retention-days: 30 # keep artifact for 30 days
- name: Upload json
uses: actions/upload-artifact@v3 # archive json
with:
name: cdn-performance-json # artifact name for json
path: performance-results.json # artifact path for json
retention-days: 30 # keep artifact for 30 days