Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for mac arm (m1) runners #31234

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/dispatch-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ jobs:
unit-tests: ${{ inputs.unit-tests }}
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}

macos-arm:
if: ${{ inputs.workflow == 'macos-arm' }}
uses: ./.github/workflows/mac.yml
secrets: inherit
with:
arm: true
profile: ${{ inputs.profile }}
wpt-layout: ${{ inputs.wpt-layout }}
unit-tests: ${{ inputs.unit-tests }}
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}

linux:
if: ${{ inputs.workflow == 'linux' }}
name: Linux
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/mac-wpt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Mac WPT Tests
on:
workflow_call:
inputs:
arm:
required: false
default: false
type: boolean
wpt-tests-to-run:
default: ""
required: false
Expand All @@ -22,7 +26,7 @@ env:
jobs:
mac-wpt:
name: WPT ${{ inputs.wpt-layout }}
runs-on: macos-13
runs-on: ${{ inputs.arm && 'macos-14' || 'macos-13' }}
env:
max_chunk_id: 5
strategy:
Expand All @@ -40,7 +44,7 @@ jobs:
ref: refs/pull/${{ github.event.number }}/head
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.profile }}-binary-macos
name: ${{ inputs.profile }}-binary-${{ inputs.arm && 'macos-arm' || 'macos' }}
- name: Prep test environment
run: |
gtar -xzf target.tar.gz
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: MacOS
on:
workflow_call:
inputs:
arm:
required: false
default: false
type: boolean
profile:
required: false
default: "release"
Expand All @@ -27,6 +31,10 @@ on:
type: string
workflow_dispatch:
inputs:
arm:
required: false
default: false
type: boolean
profile:
required: false
default: "release"
Expand Down Expand Up @@ -58,8 +66,8 @@ env:

jobs:
build:
name: MacOS Build
runs-on: macos-13
name: MacOS ${{ inputs.arm && 'ARM' || '' }} Build
runs-on: ${{ inputs.arm && 'macos-14' || 'macos-13' }}
steps:
# XProtect can cause random failures if it decides that the DMG we create
# during the packaging phase is malware.
Expand Down Expand Up @@ -124,12 +132,12 @@ jobs:
- name: Upload artifact for mach package
uses: actions/upload-artifact@v4
with:
name: mac
name: ${{ inputs.arm && 'mac-arm' || 'mac' }}
path: target/${{ inputs.profile }}/servo-tech-demo.dmg
- name: Upload nightly
if: ${{ inputs.upload }}
run: |
python3 ./mach upload-nightly mac --secret-from-environment \
python3 ./mach upload-nightly ${{ inputs.arm && 'mac-arm' || 'mac' }} --secret-from-environment \
--github-release-id ${{ inputs.github-release-id }}
env:
S3_UPLOAD_CREDENTIALS: ${{ secrets.S3_UPLOAD_CREDENTIALS }}
Expand All @@ -141,7 +149,7 @@ jobs:
- name: Upload package for target
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.profile }}-binary-macos
name: ${{ inputs.profile }}-binary-${{ inputs.arm && 'macos-arm' || 'macos' }}
path: target.tar.gz

wpt-2020:
Expand All @@ -150,6 +158,7 @@ jobs:
needs: ["build"]
uses: ./.github/workflows/mac-wpt.yml
with:
arm: ${{ inputs.arm }}
profile: ${{ inputs.profile }}
wpt-layout: "layout-2020"
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}
Expand All @@ -161,6 +170,7 @@ jobs:
needs: ["build"]
uses: ./.github/workflows/mac-wpt.yml
with:
arm: ${{ inputs.arm }}
profile: ${{ inputs.profile }}
wpt-layout: "layout-2013"
wpt-tests-to-run: ${{ inputs.wpt-tests-to-run }}
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ jobs:
unit-tests: true
secrets: inherit

build-mac-arm:
name: Mac Arm
if: ${{ github.event_name != 'pull_request' }}
uses: ./.github/workflows/mac.yml
with:
arm: true
unit-tests: true
secrets: inherit

build-linux:
name: Linux
uses: ./.github/workflows/linux.yml
Expand Down
3 changes: 3 additions & 0 deletions python/servo/package_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
'mac': [
'production/servo-tech-demo.dmg',
],
'mac-arm': [
'production/servo-tech-demo.dmg',
],
'maven': [
'android/gradle/servoview/maven/org/mozilla/servoview/servoview-armv7/',
'android/gradle/servoview/maven/org/mozilla/servoview/servoview-x86/',
Expand Down
29 changes: 23 additions & 6 deletions python/servo/try_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ def to_string(self):


class Workflow(str, Enum):
LINUX = "linux"
MACOS = "macos"
WINDOWS = "windows"
ANDROID = "android"
LINUX = 'linux'
MACOS = 'macos'
MACOS_ARM = 'macos-arm'
WINDOWS = 'windows'
ANDROID = 'android'


@dataclass
Expand Down Expand Up @@ -79,6 +80,8 @@ def handle_preset(s: str) -> Optional[JobConfig]:
return JobConfig("Linux", Workflow.LINUX, unit_tests=True)
elif s in ["mac", "macos"]:
return JobConfig("MacOS", Workflow.MACOS, unit_tests=True)
elif s in ["mac-arm", "macos-arm"]:
return JobConfig("MacOS ARM", Workflow.MACOS_ARM, unit_tests=True)
elif s in ["win", "windows"]:
return JobConfig("Windows", Workflow.WINDOWS, unit_tests=True)
elif s in ["wpt", "linux-wpt"]:
Expand All @@ -93,6 +96,12 @@ def handle_preset(s: str) -> Optional[JobConfig]:
return JobConfig("MacOS WPT", Workflow.MACOS, wpt_layout=Layout.layout2013)
elif s == "mac-wpt-2020":
return JobConfig("MacOS WPT", Workflow.MACOS, wpt_layout=Layout.layout2020)
elif s == "mac-arm-wpt":
return JobConfig("MacOS ARM WPT", Workflow.MACOS_ARM, wpt_layout=Layout.all())
elif s == "mac-arm-wpt-2013":
return JobConfig("MacOS ARM WPT", Workflow.MACOS_ARM, wpt_layout=Layout.layout2013)
elif s == "mac-arm-wpt-2020":
return JobConfig("MacOS ARM WPT", Workflow.MACOS_ARM, wpt_layout=Layout.layout2020)
elif s == "android":
return JobConfig("Android", Workflow.ANDROID)
elif s == "webgpu":
Expand Down Expand Up @@ -135,7 +144,7 @@ def parse(self, input: str):
self.fail_fast = True
continue # skip over keyword
if word == "full":
words.extend(["linux-wpt", "macos", "windows", "android"])
words.extend(["linux-wpt", "macos", "macos-arm", "windows", "android"])
continue # skip over keyword

job = handle_preset(word)
Expand Down Expand Up @@ -196,6 +205,14 @@ def test_empty(self):
"unit_tests": True,
"wpt_tests_to_run": ""
},
{
"name": "MacOS ARM",
"workflow": "macos-arm",
"wpt_layout": "none",
"profile": "release",
"unit_tests": True,
"wpt_tests_to_run": ""
},
{
"name": "Windows",
"workflow": "windows",
Expand Down Expand Up @@ -248,7 +265,7 @@ def test_job_merging(self):
self.assertEqual(a, JobConfig("Linux", Workflow.LINUX, unit_tests=True))

def test_full(self):
self.assertDictEqual(json.loads(Config("linux-wpt macos windows android").to_json()),
self.assertDictEqual(json.loads(Config("linux-wpt macos macos-arm windows android").to_json()),
json.loads(Config("").to_json()))


Expand Down