JS benchmarks #787
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: 'JS benchmarks' | |
on: | |
workflow_run: | |
workflows: ['Package the js repl as a binary artifact'] | |
branches: [master] | |
types: [completed] | |
jobs: | |
js-benchmarks: | |
runs-on: ${{ fromJSON(matrix.runner_labels) }} | |
if: ${{ github.repository == 'LadybirdBrowser/ladybird' && github.event.workflow_run.conclusion == 'success' }} | |
name: ${{ matrix.os_name }}, ${{ matrix.arch }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os_name: ['Linux'] | |
arch: ['x86_64'] | |
package_type: ['Linux-x86_64'] | |
runner_labels: ['["ubuntu-24.04-internal", "js-benchmarks", "self-hosted"]'] | |
include: | |
- os_name: 'macOS' | |
arch: 'arm64' | |
package_type: 'macOS-arm64' | |
runner_labels: '["macos-15", "js-benchmarks", "self-hosted"]' | |
permissions: | |
actions: read | |
contents: read | |
steps: | |
- name: 'Checkout LadybirdBrowser/js-benchmarks' | |
uses: actions/checkout@v4 | |
with: | |
repository: LadybirdBrowser/js-benchmarks | |
path: js-benchmarks | |
- name: 'Install dependencies' | |
if: ${{ matrix.os_name == 'Linux' }} | |
shell: bash | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y python3-venv | |
- name: 'Download JS repl artifact' | |
id: download-artifact | |
uses: dawidd6/action-download-artifact@v11 | |
with: | |
run_id: ${{ github.event.workflow_run.id }} | |
name: ladybird-js-${{ matrix.package_type }} | |
path: js-repl | |
- name: 'Extract JS repl' | |
shell: bash | |
run: | | |
cd js-repl | |
tar -xvzf ladybird-js-${{ matrix.os_name }}-${{ matrix.arch }}.tar.gz | |
- name: 'Run the JS benchmarks' | |
shell: bash | |
run: | | |
cd js-benchmarks | |
python3 -m venv .venv | |
source .venv/bin/activate | |
python3 -m pip install -r requirements.txt | |
./run.py --executable=${{ github.workspace }}/js-repl/bin/js --iterations=5 | |
- name: 'Save results as an artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: js-benchmarks-results-${{ matrix.os_name }}-${{ matrix.arch }} | |
path: js-benchmarks/results.json | |
retention-days: 90 | |
- name: 'Call webhook' | |
shell: bash | |
run: | | |
echo '{ | |
"commit": "${{ github.event.workflow_run.head_sha }}", | |
"os": "${{ matrix.os_name }}", | |
"arch": "${{ matrix.arch }}", | |
"artifact": "js-benchmarks-results-${{ matrix.os_name }}-${{ matrix.arch }}", | |
"artifact_run_id": "${{ github.run_id }}" | |
}' > request.json | |
curl \ | |
--fail \ | |
--silent \ | |
--show-error \ | |
--header 'Content-Type: application/json' \ | |
--header "X-Hub-Signature-256: sha256=$(openssl dgst -sha256 -hmac '${{ secrets.JS_BENCHMARKS_WEBHOOK_SECRET }}' request.json | cut -d' ' -f2)" \ | |
--data-binary '@request.json' \ | |
'${{ secrets.JS_BENCHMARKS_WEBHOOK_URL }}' |