mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
some bencher jobs, specifically linux release profile jobs, measure runtime perf by running speedometer and dromaeo. doing this on GitHub-hosted runners is suboptimal, because GitHub-hosted runners are not under our control and their performance can vary wildly depending on what hosts we get and how busy they are. this patch depends on #39270 and #39271, and the new [ci3](https://ci3.servo.org/) and [ci4](https://ci4.servo.org/) servers deployed in servo/ci-runners#49. these servers provide a more controlled environment for benchmarking by using known hardware that runs one job at a time and no other work (servo/project#160), with some of the [techniques](https://github.com/servo/servo/wiki/Servo-Benchmarking-Report-(October-2024)#methodology) [we’ve](https://github.com/servo/servo/wiki/Servo-Benchmarking-Report-(November-2024)#methodology) [developed](https://github.com/servo/servo/wiki/Servo-Benchmarking-Report-%28December-2024%29#methodology) for accurate measurement: - [we disable CPU frequency boost and hyperthreading](364719f210...5c02999bbc (diff-e6f17b25776ca26c2880cc3a4e3b99a0642ea968a8d6214763cb6467cc1251cfR239-R256)) - [we pin guest CPUs to specific host CPUs](364719f210...5c02999bbc (diff-cdaac247bfd7d30f8c835083adab39c7ead8791802498285ea2ce9e023cc5f06R15-R26)) - [we isolate a subset of CPUs from all processes and scheduling interrupts](364719f210...5c02999bbc (diff-e6f17b25776ca26c2880cc3a4e3b99a0642ea968a8d6214763cb6467cc1251cfR97-R102)) - the bencher workflow does not take advantage of this yet, but it will in a later patch to use ci3 and ci4 for bencher jobs, we add them to the list of self-hosted runner servers, then make the bencher workflow try to find a servo-ubuntu2204-bench runner if speedometer and/or dromaeo have been requested. to avoid mixing data, we set the bencher “testbed” based on where the runner came from: - for GitHub-hosted runners, we continue to use “ubuntu-22.04” - for runners on ci3 or ci4, we use “self-hosted-image:[servo-ubuntu2204-bench](e911a23eff/profiles/servo-ubuntu2204-bench)” Testing: - before, always GitHub-hosted: [job run](https://github.com/servo/servo/actions/runs/18276911520/job/52032330450) → [report](https://bencher.dev/perf/servo/reports/86aa60cc-9d42-418f-a639-07b8604b30fb) - after, self-hosted: [job run](https://github.com/servo/servo/actions/runs/18404778338/job/52442477058) → [report](https://bencher.dev/perf/servo/reports/6feed0ac-655a-4e17-9351-41cba8d283b2) - after, GitHub-hosted: [job run](https://github.com/servo/servo/actions/runs/18404806546/job/52442697457) → [report](https://bencher.dev/perf/servo/reports/235a4ee0-340d-458b-9be4-953568b0923d) - there are also counterparts for other platforms in the workflow runs above Fixes: #39269 --------- Signed-off-by: Delan Azabani <dazabani@igalia.com>
287 lines
10 KiB
YAML
287 lines
10 KiB
YAML
name: MacOS
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
profile:
|
|
required: false
|
|
default: "release"
|
|
type: string
|
|
build-args:
|
|
default: ""
|
|
required: false
|
|
type: string
|
|
wpt-args:
|
|
default: ""
|
|
required: false
|
|
type: string
|
|
wpt:
|
|
required: false
|
|
type: boolean
|
|
unit-tests:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
build-libservo:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
upload:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
github-release-id:
|
|
required: false
|
|
type: string
|
|
force-github-hosted-runner:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
bencher:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
workflow_dispatch:
|
|
inputs:
|
|
profile:
|
|
required: false
|
|
default: "release"
|
|
type: choice
|
|
options: ["release", "debug", "production"]
|
|
wpt-args:
|
|
default: ""
|
|
required: false
|
|
type: string
|
|
wpt:
|
|
required: false
|
|
type: boolean
|
|
unit-tests:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
build-libservo:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
upload:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
force-github-hosted-runner:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
bencher:
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
SHELL: /bin/bash
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
jobs:
|
|
# Runs the underlying job (“workload”) on a self-hosted runner if available,
|
|
# with the help of a `runner-select` job and a `runner-timeout` job.
|
|
runner-select:
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
unique-id: ${{ steps.select.outputs.unique-id }}
|
|
selected-runner-label: ${{ steps.select.outputs.selected-runner-label }}
|
|
runner-type-label: ${{ steps.select.outputs.runner-type-label }}
|
|
is-self-hosted: ${{ steps.select.outputs.is-self-hosted }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: '.github'
|
|
- name: Runner select
|
|
id: select
|
|
uses: ./.github/actions/runner-select
|
|
with:
|
|
monitor-api-token: ${{ secrets.SERVO_CI_MONITOR_API_TOKEN }}
|
|
github-hosted-runner-label: macos-13
|
|
self-hosted-image-name: servo-macos13
|
|
# You can disable self-hosted runners globally by creating a repository variable named
|
|
# NO_SELF_HOSTED_RUNNERS with any non-empty value.
|
|
# <https://github.com/servo/servo/settings/variables/actions>
|
|
NO_SELF_HOSTED_RUNNERS: ${{ vars.NO_SELF_HOSTED_RUNNERS }}
|
|
# Any other boolean conditions that disable self-hosted runners go here.
|
|
force-github-hosted-runner: ${{ inputs.force-github-hosted-runner }}
|
|
runner-timeout:
|
|
needs:
|
|
- runner-select
|
|
if: ${{ fromJSON(needs.runner-select.outputs.is-self-hosted) }}
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: '.github'
|
|
- name: Runner timeout
|
|
uses: ./.github/actions/runner-timeout
|
|
with:
|
|
github_token: '${{ secrets.GITHUB_TOKEN }}'
|
|
unique-id: '${{ needs.runner-select.outputs.unique-id }}'
|
|
|
|
build:
|
|
needs:
|
|
- runner-select
|
|
name: MacOS Build [${{ needs.runner-select.outputs.unique-id }}]
|
|
runs-on: ${{ needs.runner-select.outputs.selected-runner-label }}
|
|
steps:
|
|
# XProtect can cause random failures if it decides that the DMG we create
|
|
# during the packaging phase is malware.
|
|
# TODO(mrobinson): Is there a way we can do things in a less suspicious way so
|
|
# we don't have to kill this service?
|
|
- name: Kill XProtectBehaviorService
|
|
run: |
|
|
echo Killing XProtect.; sudo pkill -9 XProtect >/dev/null || true;
|
|
- uses: actions/checkout@v4
|
|
if: runner.environment != 'self-hosted' && github.event_name != 'pull_request_target'
|
|
# This is necessary to checkout the pull request if this run was triggered via a
|
|
# `pull_request_target` event.
|
|
- uses: actions/checkout@v4
|
|
if: runner.environment != 'self-hosted' && github.event_name == 'pull_request_target'
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
# Faster checkout for self-hosted runner that uses prebaked repo.
|
|
- if: ${{ runner.environment == 'self-hosted' && github.event_name != 'pull_request_target' }}
|
|
run: git fetch --depth=1 origin $GITHUB_SHA
|
|
- if: ${{ runner.environment == 'self-hosted' && github.event_name == 'pull_request_target' }}
|
|
run: git fetch --depth=1 origin ${{ github.event.pull_request.head.sha }}
|
|
- if: ${{ runner.environment == 'self-hosted' }}
|
|
# Same as `git switch --detach FETCH_HEAD`, but fixes up dirty working
|
|
# trees, in case the runner image was baked with a dirty working tree.
|
|
run: |
|
|
git switch --detach
|
|
git reset --hard FETCH_HEAD
|
|
|
|
- if: runner.environment != 'self-hosted'
|
|
name: Setup Python
|
|
uses: ./.github/actions/setup-python
|
|
|
|
# Always install crown, even on self-hosted runners, because it is tightly
|
|
# coupled to the rustc version, and we may have the wrong version if the
|
|
# commit we are building uses a different rustc version.
|
|
- name: Install crown
|
|
run: cargo install --path support/crown
|
|
|
|
- if: runner.environment != 'self-hosted'
|
|
name: Bootstrap
|
|
run: |
|
|
./mach bootstrap --skip-lints
|
|
brew install gnu-tar
|
|
- name: Build (${{ inputs.profile }})
|
|
run: |
|
|
./mach build --use-crown --locked --${{ inputs.profile }} ${{ inputs.build-args }}
|
|
cp -r target/cargo-timings target/cargo-timings-macos
|
|
- name: Smoketest
|
|
uses: nick-fields/retry@v3
|
|
with: # See https://github.com/servo/servo/issues/30757
|
|
timeout_minutes: 5
|
|
max_attempts: 2
|
|
command: ./mach smoketest --${{ inputs.profile }}
|
|
- name: Script tests
|
|
run: ./mach test-scripts
|
|
- name: Unit tests
|
|
if: ${{ inputs.unit-tests }}
|
|
uses: nick-fields/retry@v3
|
|
with:
|
|
timeout_minutes: 40 # https://github.com/servo/servo/issues/30275
|
|
max_attempts: 3 # https://github.com/servo/servo/issues/30683
|
|
command: ./mach test-unit --${{ inputs.profile }}
|
|
- name: Devtools tests
|
|
if: ${{ inputs.unit-tests }}
|
|
run: ./mach test-devtools --${{ inputs.profile }}
|
|
- name: Build mach package
|
|
run: ./mach package --${{ inputs.profile }}
|
|
- name: Run DMG smoketest
|
|
uses: nick-fields/retry@v3
|
|
with: # See https://github.com/servo/servo/issues/30757
|
|
timeout_minutes: 5
|
|
max_attempts: 2
|
|
command: ./etc/ci/macos_package_smoketest.sh target/${{ inputs.profile }}/servo-tech-demo.dmg
|
|
- name: Archive build timing
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cargo-timings-macos-${{ inputs.profile }}
|
|
# Using a wildcard here ensures that the archive includes the path.
|
|
path: target/cargo-timings-*
|
|
- name: Upload artifact for mach package
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ inputs.profile }}-binary-mac
|
|
path: target/${{ inputs.profile }}/servo-tech-demo.dmg
|
|
- name: Upload nightly
|
|
if: ${{ inputs.upload }}
|
|
run: |
|
|
./mach upload-nightly mac --secret-from-environment \
|
|
--github-release-id ${{ inputs.github-release-id }}
|
|
env:
|
|
S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }}
|
|
GITHUB_HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}
|
|
NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
|
|
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds
|
|
- name: Build package for target
|
|
run: gtar -czf target.tar.gz target/${{ inputs.profile }}/servo target/${{ inputs.profile }}/lib/*.dylib resources
|
|
- name: Upload package for target
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ inputs.profile }}-binary-macos
|
|
path: target.tar.gz
|
|
|
|
wpt-2020:
|
|
if: ${{ inputs.wpt }}
|
|
name: MacOS WPT
|
|
needs: ["build"]
|
|
uses: ./.github/workflows/mac-wpt.yml
|
|
with:
|
|
profile: ${{ inputs.profile }}
|
|
wpt-args: ${{ inputs.wpt-args }}
|
|
secrets: inherit
|
|
|
|
bencher:
|
|
needs: ["build"]
|
|
if: ${{ inputs.bencher && inputs.profile != 'debug' && github.event_name != 'workflow_dispatch' && github.event_name != 'merge_group' }}
|
|
uses: ./.github/workflows/bencher.yml
|
|
with:
|
|
target: 'macos'
|
|
profile: ${{ inputs.profile }}
|
|
compressed-file-path: ${{ inputs.profile }}-binary-macos/target.tar.gz
|
|
binary-path: target/${{ inputs.profile }}/servo
|
|
file-size: true
|
|
speedometer: false
|
|
dromaeo: false
|
|
secrets: inherit
|
|
|
|
build-libservo:
|
|
if: ${{ inputs.build-libservo }}
|
|
name: Build libservo and MSRV check
|
|
runs-on: macos-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
if: github.event_name != 'pull_request_target'
|
|
with:
|
|
fetch-depth: 1
|
|
# This is necessary to checkout the pull request if this run was triggered via a
|
|
# `pull_request_target` event.
|
|
- uses: actions/checkout@v4
|
|
if: github.event_name == 'pull_request_target'
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
fetch-depth: 1
|
|
- name: Setup Python
|
|
uses: ./.github/actions/setup-python
|
|
- name: Determine MSRV
|
|
id: msrv
|
|
uses: ./.github/actions/parse_msrv
|
|
- name: Install MSRV
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ steps.msrv.outputs.rust_version }}
|
|
- name: Compile libservo with MSRV
|
|
run: |
|
|
cargo +${{ steps.msrv.outputs.rust_version }} build -p libservo --locked --all-targets
|