-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: setup prep-deps on GitHub Actions, and try self-hosted runners fo…
…r benchmarks
- Loading branch information
1 parent
bb1c77e
commit 6f1d3b5
Showing
4 changed files
with
154 additions
and
22 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# This script will probably eventually live at | ||
# https://github.com/MetaMask/github-tools/blob/main/.github/actions/setup-environment/action.yml | ||
name: Setup environment | ||
description: Setup environment | ||
inputs: | ||
should-cache-restore: | ||
required: true | ||
should-cache-save: | ||
required: false | ||
default: 'false' | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# actions/cache/restore will not work in a container unless zstd is installed | ||
- name: Install zstd | ||
if: ${{ job.container }} | ||
run: sudo apt-get update && sudo apt-get install zstd | ||
shell: bash | ||
|
||
- name: Download workspace | ||
if: ${{ inputs.should-cache-restore == 'true' }} | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ./node_modules | ||
key: workspace-${{ github.sha }} | ||
|
||
- run: corepack enable | ||
shell: bash | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
cache: yarn | ||
cache-dependency-path: yarn.lock | ||
|
||
- name: Install dependencies | ||
if: ${{ inputs.should-cache-restore == 'false' }} | ||
run: yarn --immutable | ||
shell: bash | ||
|
||
- name: Cache workspace | ||
if: ${{ inputs.should-cache-save == 'true' }} | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ./node_modules | ||
key: workspace-${{ github.sha }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: 'Run Benchmarks' | ||
|
||
on: workflow_call | ||
|
||
jobs: | ||
benchmark: | ||
name: Benchmark | ||
# runs-on: ubuntu-latest | ||
# runs-on: [self-hosted, Linux, X64] | ||
runs-on: gha-mm-scale-set-ubuntu-22.04-amd64-med | ||
container: | ||
image: cimg/node:20.18-browsers | ||
# options: --user root | ||
steps: | ||
- name: Setup environment | ||
uses: MetaMask/metamask-extension/.github/actions/setup-environment@self-hosted-temp | ||
with: | ||
should-cache-restore: true | ||
|
||
# - name: Debugging with tmate | ||
# uses: ./.github/actions/actions-tmate | ||
|
||
# - run: | | ||
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash | ||
# source ~/.nvm/nvm.sh | ||
# nvm install 20 | ||
# node -v # should print `v20.18.1`. | ||
# apt-get update | ||
# apt-get install gh | ||
|
||
# - run: corepack enable | ||
# shell: bash | ||
|
||
# - name: Set up Node.js | ||
# uses: actions/setup-node@v4 | ||
# with: | ||
# node-version-file: .nvmrc | ||
# cache: yarn | ||
# cache-dependency-path: yarn.lock | ||
|
||
# - name: Install dependencies | ||
# run: yarn | ||
# shell: bash | ||
|
||
# - run: yarn build:test | ||
- run: yarn webpack --test | ||
|
||
- name: Install prereqs | ||
run: | | ||
# apt-get update | ||
# apt-get install -y xvfb | ||
# apt-get -y install xorg xvfb gtk2-engines-pixbuf | ||
# apt-get -y install dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable | ||
Xvfb -ac :99 -screen 0 1280x1024x16 & | ||
# export DISPLAY=:99 | ||
- name: Run the benchmark | ||
run: yarn benchmark:chrome --out test-artifacts/chrome/benchmark/pageload.json --retries 2 | ||
|
||
- name: 'Upload Artifact' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pageload | ||
path: test-artifacts/chrome/benchmark/pageload.json | ||
retention-days: 5 | ||
# user-actions-benchmark: | ||
# name: User Actions Benchmark |
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
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