Run releases via GitHub Actions with npm provenance and SBOM (#2491) #571
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: Linux browsers Chrome | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| basic: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| accounts.google.com:443 | |
| android.clients.google.com:443 | |
| api.github.com:443 | |
| azure.archive.ubuntu.com:80 | |
| clients2.google.com:80 | |
| dl-ssl.google.com:443 | |
| dl.google.com:80 | |
| esm.ubuntu.com:443 | |
| files.pythonhosted.org:443 | |
| github.com:443 | |
| motd.ubuntu.com:443 | |
| msedgedriver.microsoft.com:443 | |
| mtalk.google.com:5228 | |
| nodejs.org:443 | |
| packages.microsoft.com:443 | |
| pypi.org:443 | |
| registry.npmjs.org:443 | |
| release-assets.githubusercontent.com:443 | |
| results-receiver.actions.githubusercontent.com:443 | |
| storage.googleapis.com:443 | |
| www.google.com:443 | |
| www.sitespeed.io:443 | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Use Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 | |
| with: | |
| node-version: '24.x' | |
| cache: 'npm' | |
| - name: Install latest Chrome | |
| run: | | |
| wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
| sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
| sudo apt-get update | |
| sudo apt-get --only-upgrade install google-chrome-stable | |
| google-chrome --version | |
| - name: Install Browsertime | |
| run: npm ci | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install net-tools -y | |
| python -m pip install virtualenv | |
| sudo modprobe ifb numifbs=1 | |
| - name: Start local HTTP server | |
| run: (npm run start-server&) | |
| - name: Test Chrome with CPU throttle and preURL | |
| run: ./bin/browsertime.js -b chrome --skipHar -n 1 --preURL http://127.0.0.1:3000/simple/ -r header:value --chrome.CPUThrottlingRate 2 --chrome.cdp.performance --xvfb --chrome.enableChromeDriverLog --chrome.collectConsoleLog http://127.0.0.1:3000/dimple/ | |
| - name: Test pre/post scripts | |
| run: ./bin/browsertime.js -b chrome test/data/navigationscript/measure.cjs -n 1 --preScript test/data/prepostscripts/preSample.cjs --postScript test/data/prepostscripts/postSample.cjs --xvfb | |
| - name: Test Chrome with emulated mobile | |
| run: ./bin/browsertime.js -b chrome --chrome.mobileEmulation.deviceName 'iPhone 6' http://127.0.0.1:3000/simple/ --xvfb | |
| - name: Test Chrome with web driver nagivation | |
| run: ./bin/browsertime.js -b chrome -n 1 http://127.0.0.1:3000/simple/ --webdriverPageload --xvfb | |
| - name: Test navigate to the same URL twice | |
| run: ./bin/browsertime.js -b chrome test/data/navigationscript/sameURLTwice.cjs -n 1 --pageCompleteCheckInactivity --timeToSettle 1000 --xvfb | |
| - name: Test navigate to the same URL twice by clicking on a link | |
| run: ./bin/browsertime.js -b chrome test/data/navigationscript/sameURLTwiceWithClick.cjs -n 1 --pageCompleteCheckInactivity --timeToSettle 1000 --xvfb | |
| - name: Test using alias for one URL | |
| run: ./bin/browsertime.js -b chrome http://127.0.0.1:3000/simple/ --urlAlias my_url --xvfb | |
| - name: Test using alias for multiple URLs | |
| run: ./bin/browsertime.js -b chrome http://127.0.0.1:3000/simple/ http://127.0.0.1:3000/dimple/ --urlAlias startPage --urlAlias documentation --xvfb | |
| - name: Run test with pre-test functionality | |
| run: ./bin/browsertime.js -b chrome --preWarmServer --xvfb http://127.0.0.1:3000/simple/ | |
| - name: Test Chrome CDP and trace commands | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/commandscripts/chrome.cjs | |
| scripting: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| accounts.google.com:443 | |
| android.clients.google.com:443 | |
| api.github.com:443 | |
| azure.archive.ubuntu.com:80 | |
| clients2.google.com:80 | |
| dl-ssl.google.com:443 | |
| dl.google.com:80 | |
| esm.ubuntu.com:443 | |
| files.pythonhosted.org:443 | |
| github.com:443 | |
| motd.ubuntu.com:443 | |
| msedgedriver.microsoft.com:443 | |
| mtalk.google.com:5228 | |
| nodejs.org:443 | |
| packages.microsoft.com:443 | |
| pypi.org:443 | |
| registry.npmjs.org:443 | |
| release-assets.githubusercontent.com:443 | |
| results-receiver.actions.githubusercontent.com:443 | |
| storage.googleapis.com:443 | |
| www.google.com:443 | |
| www.sitespeed.io:443 | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Use Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 | |
| with: | |
| node-version: '24.x' | |
| cache: 'npm' | |
| - name: Install latest Chrome | |
| run: | | |
| wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
| sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
| sudo apt-get update | |
| sudo apt-get --only-upgrade install google-chrome-stable | |
| google-chrome --version | |
| - name: Install Browsertime | |
| run: npm ci | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install net-tools -y | |
| python -m pip install virtualenv | |
| sudo modprobe ifb numifbs=1 | |
| - name: Start local HTTP server | |
| run: (npm run start-server&) | |
| - name: Run test with screenshots | |
| run: ./bin/browsertime.js -b chrome --screenshotLCP --screenshotLS --xvfb http://127.0.0.1:3000/simple/ | |
| - name: Run test with tcp dump | |
| run: ./bin/browsertime.js -b chrome --xvfb http://127.0.0.1:3000/simple/ -n 1 --tcpdump | |
| - name: Run test with scripting.mjs | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/scripting/module.mjs | |
| - name: Run test with scripting.cjs | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/scripting/common.cjs | |
| - name: Run test with scripting.js | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/scripting/common.js --cjs | |
| - name: Run test with scripting.js | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/scripting/module.js | |
| - name: Run test with scripting.mts | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/scripting/module.mts | |
| - name: Run test with scripting.cts | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/scripting/common.cts | |
| - name: Run test with scripting.ts | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/scripting/common.ts --cjs | |
| - name: Run test with scripting.ts | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/scripting/module.ts | |
| - name: Test unified click commands | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/commandscripts/clickBackAndForth.cjs | |
| - name: Test unified misc commands | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/commandscripts/misc.cjs | |
| - name: Test new convenience commands | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/commandscripts/newCommands.cjs | |
| - name: Test Selenium Actions API | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/commandscripts/actions.cjs | |
| - name: Test stopWatch commands | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/commandscripts/stopWatch.cjs | |
| - name: Test measure with alias | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/commandscripts/measureAlias.cjs | |
| - name: Test scroll commands | |
| run: ./bin/browsertime.js -b chrome -n 1 --xvfb test/data/commandscripts/scrollToBottom.cjs | |
| - name: Test extra profile run Chrome | |
| run: ./bin/browsertime.js -b chrome http://127.0.0.1:3000/simple/ -n 1 --viewPort 1000x600 --xvfb --enableProfileRun | |
| - name: Test Chrome JS/CSS coverage | |
| run: | | |
| ./bin/browsertime.js -b chrome -n 1 --xvfb --skipHar --chrome.coverage --resultDir /tmp/coverage http://127.0.0.1:3000/simple/ | |
| echo "--- coverage block ---" | |
| jq '.[0].coverage' /tmp/coverage/browsertime.json | |
| jq -e '(.[0].coverage.js | type) == "array" and (.[0].coverage.js | length) > 0' /tmp/coverage/browsertime.json | |
| jq -e '(.[0].coverage.css | type) == "array" and (.[0].coverage.css | length) > 0' /tmp/coverage/browsertime.json | |
| jq -e '.[0].coverage.js[0] | has("totalBytes") and has("usedBytes") and has("unusedBytes") and has("unusedPercent") and has("files")' /tmp/coverage/browsertime.json | |
| jq -e '.[0].coverage.css[0] | has("totalBytes") and has("usedBytes") and has("unusedBytes") and has("unusedPercent") and has("files")' /tmp/coverage/browsertime.json | |
| - name: Test Chrome soft navigation detection | |
| run: | | |
| ./bin/browsertime.js -b chrome -n 1 --xvfb --spa --resultDir /tmp/soft-nav test/data/commandscripts/softNavigation.cjs | |
| echo "--- soft navigation entry ---" | |
| jq '.[0].browserScripts[0].timings.softNavigations[0]' /tmp/soft-nav/browsertime.json | |
| echo "--- HAR page ---" | |
| jq '.log.pages[0] | {title, _url, _softNavigation}' /tmp/soft-nav/browsertime.har | |
| jq -e '.[0].browserScripts[0].timings.softNavigations | length > 0' /tmp/soft-nav/browsertime.json | |
| jq -e '.[0].browserScripts[0].timings.softNavigations[0].name | endswith("/spa/page-2")' /tmp/soft-nav/browsertime.json | |
| jq -e '.log.pages[0]._softNavigation == true' /tmp/soft-nav/browsertime.har | |
| jq -e '.log.pages[0]._url | endswith("/spa/page-2")' /tmp/soft-nav/browsertime.har | |
| video: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 | |
| with: | |
| egress-policy: block | |
| allowed-endpoints: > | |
| accounts.google.com:443 | |
| android.clients.google.com:443 | |
| api.github.com:443 | |
| azure.archive.ubuntu.com:80 | |
| clients2.google.com:80 | |
| dl-ssl.google.com:443 | |
| dl.google.com:80 | |
| esm.ubuntu.com:443 | |
| files.pythonhosted.org:443 | |
| github.com:443 | |
| motd.ubuntu.com:443 | |
| msedgedriver.microsoft.com:443 | |
| mtalk.google.com:5228 | |
| nodejs.org:443 | |
| packages.microsoft.com:443 | |
| pypi.org:443 | |
| registry.npmjs.org:443 | |
| release-assets.githubusercontent.com:443 | |
| results-receiver.actions.githubusercontent.com:443 | |
| storage.googleapis.com:443 | |
| www.google.com:443 | |
| www.sitespeed.io:443 | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| - name: Use Node.js | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 | |
| with: | |
| node-version: '24.x' | |
| cache: 'npm' | |
| - name: Install latest Chrome | |
| run: | | |
| wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
| sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
| sudo apt-get update | |
| sudo apt-get --only-upgrade install google-chrome-stable | |
| google-chrome --version | |
| - name: Install Browsertime | |
| run: npm ci | |
| - name: Install ffmpeg | |
| uses: AnimMouse/setup-ffmpeg@ae28d57dabbb148eff63170b6bf7f2b60062cbae # v1.2.3 | |
| with: | |
| version: '7.1' | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install net-tools -y | |
| python -m pip install --upgrade pip setuptools==70.0.0 pyssim OpenCV-Python Numpy virtualenv | |
| sudo modprobe ifb numifbs=1 | |
| - name: Start local HTTP server | |
| run: (npm run start-server&) | |
| - name: Test multi pages with video and visual metrics | |
| run: ./bin/browsertime.js -b chrome test/data/navigationscript/multi.cjs -n 3 --chrome.timeline --video --visualMetrics --visualElements --viewPort 1000x600 --xvfb | |
| - name: Test navigation and page complete check inactivity | |
| run: ./bin/browsertime.js -b chrome test/data/navigationscript/navigateAndStartInTwoSteps.cjs -n 1 --pageCompleteCheckInactivity --timeToSettle 1000 --xvfb | |
| - name: Run test with check network idle in Chrome | |
| run: ./bin/browsertime.js -b chrome --pageCompleteCheckNetworkIdle --xvfb http://127.0.0.1:3000/simple/ |