Compare commits

...

1 Commits

Author SHA1 Message Date
Delan Azabani
ab1b911ae1 CI: separate libservo build job
Signed-off-by: Delan Azabani <dazabani@igalia.com>
2025-01-27 19:49:07 +08:00
8 changed files with 144 additions and 6 deletions

View File

@@ -14,6 +14,9 @@ on:
wpt-layout:
required: true
type: string
build-servoshell:
required: true
type: boolean
unit-tests:
required: true
type: boolean
@@ -32,6 +35,7 @@ jobs:
secrets: inherit
with:
profile: ${{ inputs.profile }}
build-servoshell: ${{ inputs.build-servoshell }}
unit-tests: ${{ inputs.unit-tests }}
build-libservo: ${{ inputs.build-libservo }}
bencher: ${{ inputs.bencher }}
@@ -44,6 +48,7 @@ jobs:
with:
profile: ${{ inputs.profile }}
wpt-layout: ${{ inputs.wpt-layout }}
build-servoshell: ${{ inputs.build-servoshell }}
unit-tests: ${{ inputs.unit-tests }}
build-libservo: ${{ inputs.build-libservo }}
wpt-args: ${{ inputs.wpt-args }}
@@ -57,6 +62,7 @@ jobs:
with:
profile: ${{ inputs.profile }}
wpt-layout: ${{ inputs.wpt-layout }}
build-servoshell: ${{ inputs.build-servoshell }}
unit-tests: ${{ inputs.unit-tests }}
build-libservo: ${{ inputs.build-libservo }}
wpt-args: ${{ inputs.wpt-args }}

View File

@@ -17,6 +17,10 @@ on:
wpt-layout:
required: false
type: string
build-servoshell:
required: false
default: true
type: boolean
unit-tests:
required: false
default: false
@@ -59,6 +63,10 @@ on:
required: false
type: choice
options: ["none", "2013", "2020", "all"]
build-servoshell:
required: false
default: true
type: boolean
unit-tests:
required: false
default: false
@@ -159,12 +167,15 @@ jobs:
run: cargo install --path support/crown
- name: Build (${{ inputs.profile }})
if: ${{ inputs.build-servoshell }}
run: |
./mach build --use-crown --locked --${{ inputs.profile }} --features "layout_2013"
cp -r target/cargo-timings target/cargo-timings-linux
- name: Smoketest
if: ${{ inputs.build-servoshell }}
run: xvfb-run ./mach smoketest --${{ inputs.profile }}
- name: Script tests
if: ${{ inputs.build-servoshell }}
run: ./mach test-scripts
- name: Unit tests
if: ${{ inputs.unit-tests }}
@@ -178,20 +189,23 @@ jobs:
continue-on-error: true
run: cargo build -p libservo --all-targets
- name: Archive build timing
if: ${{ inputs.build-servoshell }}
uses: actions/upload-artifact@v4
with:
name: cargo-timings-linux-${{ inputs.profile }}
# Using a wildcard here ensures that the archive includes the path.
path: target/cargo-timings-*
- name: Build mach package
if: ${{ inputs.build-servoshell }}
run: ./mach package --${{ inputs.profile }}
- name: Upload artifact for mach package
if: ${{ inputs.build-servoshell }}
uses: actions/upload-artifact@v4
with:
name: linux-${{ inputs.profile }}
path: target/${{ inputs.profile }}/servo-tech-demo.tar.gz
- name: Upload nightly
if: ${{ inputs.upload }}
if: ${{ inputs.build-servoshell && inputs.upload }}
run: |
./mach upload-nightly linux \
--secret-from-environment \
@@ -201,8 +215,10 @@ jobs:
NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds
- name: Build package for target
if: ${{ inputs.build-servoshell }}
run: tar -czf target.tar.gz target/${{ inputs.profile }}/servo resources
- name: Upload artifact for target
if: ${{ inputs.build-servoshell }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.profile }}-binary-linux

View File

@@ -14,6 +14,10 @@ on:
wpt-layout:
required: false
type: string
build-servoshell:
required: false
default: true
type: boolean
unit-tests:
required: false
default: false
@@ -52,6 +56,10 @@ on:
required: false
type: choice
options: ["none", "2013", "2020", "all"]
build-servoshell:
required: false
default: true
type: boolean
unit-tests:
required: false
default: false
@@ -142,16 +150,19 @@ jobs:
./mach bootstrap --skip-lints
brew install gnu-tar
- name: Build (${{ inputs.profile }})
if: ${{ inputs.build-servoshell }}
run: |
./mach build --use-crown --locked --${{ inputs.profile }}
cp -r target/cargo-timings target/cargo-timings-macos
- name: Smoketest
if: ${{ inputs.build-servoshell }}
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
if: ${{ inputs.build-servoshell }}
run: ./mach test-scripts
- name: Unit tests
if: ${{ inputs.unit-tests }}
@@ -165,26 +176,30 @@ jobs:
continue-on-error: true
run: cargo build -p libservo --all-targets
- name: Build mach package
if: ${{ inputs.build-servoshell }}
run: ./mach package --${{ inputs.profile }}
- name: Run DMG smoketest
if: ${{ inputs.build-servoshell }}
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
if: ${{ inputs.build-servoshell }}
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
if: ${{ inputs.build-servoshell }}
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 }}
if: ${{ inputs.build-servoshell && inputs.upload }}
run: |
./mach upload-nightly mac --secret-from-environment \
--github-release-id ${{ inputs.github-release-id }}
@@ -194,8 +209,10 @@ jobs:
NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds
- name: Build package for target
if: ${{ inputs.build-servoshell }}
run: gtar -czf target.tar.gz target/${{ inputs.profile }}/servo target/${{ inputs.profile }}/lib/*.dylib resources
- name: Upload package for target
if: ${{ inputs.build-servoshell }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.profile }}-binary-macos

View File

@@ -35,7 +35,7 @@ jobs:
run: |
{
echo 'result<<EOF'
python ./python/servo/try_parser.py ${{ github.event_name == 'pull_request' && 'linux-unit-tests lint' || github.event_name == 'push' && 'fail-fast full bencher production-bencher' || 'fail-fast full' }}
python ./python/servo/try_parser.py ${{ github.event_name == 'pull_request' && 'linux-unit-tests linux-build-libservo lint' || github.event_name == 'push' && 'fail-fast full bencher production-bencher' || 'fail-fast full' }}
echo EOF
} >> $GITHUB_OUTPUT
@@ -53,6 +53,7 @@ jobs:
workflow: ${{ matrix.workflow }}
wpt-layout: ${{ matrix.wpt_layout }}
profile: ${{ matrix.profile }}
build-servoshell: ${{ matrix.build_servoshell }}
unit-tests: ${{ matrix.unit_tests }}
build-libservo: ${{ matrix.build_libservo }}
wpt-args: ${{ matrix.wpt_args }}

View File

@@ -136,6 +136,7 @@ jobs:
workflow: ${{ matrix.workflow }}
wpt-layout: ${{ matrix.wpt_layout }}
profile: ${{ matrix.profile }}
build-servoshell: ${{ matrix.build_servoshell }}
unit-tests: ${{ matrix.unit_tests }}
build-libservo: ${{ matrix.build_libservo }}
wpt-args: ${{ matrix.wpt_args }}

View File

@@ -106,6 +106,7 @@ jobs:
workflow: ${{ matrix.workflow }}
wpt-layout: ${{ matrix.wpt_layout }}
profile: ${{ matrix.profile }}
build-servoshell: ${{ matrix.build_servoshell }}
unit-tests: ${{ matrix.unit_tests }}
build-libservo: ${{ matrix.build_libservo }}
wpt-args: ${{ matrix.wpt_args }}

View File

@@ -7,6 +7,10 @@ on:
required: false
default: "release"
type: string
build-servoshell:
required: false
default: true
type: boolean
unit-tests:
required: false
default: false
@@ -37,6 +41,10 @@ on:
default: "release"
options: ["release", "debug", "production"]
type: choice
build-servoshell:
required: false
default: true
type: boolean
unit-tests:
required: false
default: false
@@ -160,6 +168,7 @@ jobs:
echo "`$env:PATH now = $env:PATH"
- name: Build (${{ inputs.profile }})
if: ${{ inputs.build-servoshell }}
run: |
.\mach build --use-crown --locked --${{ inputs.profile }}
cp C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows -Recurse
@@ -168,6 +177,7 @@ jobs:
# GitHub-hosted runners check out the repo on D: drive.
run: cp D:\a\servo\servo\resources C:\a\servo\servo -Recurse
- name: Smoketest
if: ${{ inputs.build-servoshell }}
run: .\mach smoketest --${{ inputs.profile }}
- name: Unit tests
if: ${{ inputs.unit-tests }}
@@ -181,14 +191,17 @@ jobs:
continue-on-error: true
run: cargo build -p libservo --all-targets
- name: Archive build timing
if: ${{ inputs.build-servoshell }}
uses: actions/upload-artifact@v4
with:
name: cargo-timings-windows-${{ inputs.profile }}
# Using a wildcard here ensures that the archive includes the path.
path: C:\\a\\servo\\servo\\target\\cargo-timings-*
- name: Build mach package
if: ${{ inputs.build-servoshell }}
run: .\mach package --${{ inputs.profile }}
- name: Upload artifact for mach package
if: ${{ inputs.build-servoshell }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.profile }}-binary-windows
@@ -198,7 +211,7 @@ jobs:
# Zip: C:\a\servo\servo\target\${{ inputs.profile }}\msi\Servo.zip
path: C:\\a\\servo\\servo\\target\\${{ inputs.profile }}\\msi\\Servo.exe
- name: Upload nightly
if: ${{ inputs.upload }}
if: ${{ inputs.build-servoshell && inputs.upload }}
run: |
.\mach upload-nightly windows-msvc --secret-from-environment `
--github-release-id ${{ inputs.github-release-id }}

View File

@@ -56,13 +56,35 @@ class JobConfig(object):
workflow: Workflow = Workflow.LINUX
wpt_layout: Layout = Layout.none
profile: str = "release"
build_servoshell: bool = False
unit_tests: bool = False
build_libservo: bool = False
bencher: bool = False
wpt_args: str = ""
# These are the fields that must match in between two JobConfigs for them to be able to be
# merged. If you modify any of the fields above, make sure to update this line as well.
merge_compatibility_fields: ClassVar[List[str]] = ['workflow', 'profile', 'wpt_args']
merge_compatibility_fields: ClassVar[List[str]] = [
'workflow', 'profile', 'wpt_args', 'build_servoshell', 'build_libservo'
]
# The next two methods ensure that JobConfig instances never have build_libservo set when
# build_servoshell and/or unit_tests are set, while still allowing mutation. We could make the
# dataclass frozen, but that would require much more invasive changes elsewhere.
def __post_init__(self):
# First check if the code has constructed a JobConfig with an invalid combination of flags.
if self.build_libservo and (self.build_servoshell or self.unit_tests):
raise ValueError("GitHub-hosted runners may not have enough disk space to build libservo in this job")
# Now enable build_servoshell by default, unless build_libservo was set.
if not self.build_libservo:
self.build_servoshell = True
# https://stackoverflow.com/a/66412774
def __setattr__(self, prop, val):
super().__setattr__(prop, val)
if prop in ["build_servoshell", "unit_tests", "build_libservo"]:
if self.build_libservo and (self.build_servoshell or self.unit_tests):
raise ValueError("GitHub-hosted runners may not have enough disk space to build libservo in this job")
def merge(self, other: JobConfig) -> bool:
"""Try to merge another job with this job. Returns True if merging is successful
@@ -72,6 +94,7 @@ class JobConfig(object):
return False
self.wpt_layout |= other.wpt_layout
self.build_servoshell |= other.build_servoshell
self.unit_tests |= other.unit_tests
self.build_libservo |= other.build_libservo
self.bencher |= other.bencher
@@ -136,6 +159,9 @@ def handle_modifier(config: JobConfig, s: str) -> Optional[JobConfig]:
if "unit-tests" in s:
config.unit_tests = True
if "build-libservo" in s:
# “build-libservo” disables the implicit build_servoshell, but
# “build-libservo-unit-tests” will raise ValueError.
config.build_servoshell = False
config.build_libservo = True
if "production" in s:
config.profile = "production"
@@ -181,7 +207,7 @@ class Config(object):
self.fail_fast = True
continue # skip over keyword
if word == "full":
words.extend(["linux-unit-tests", "linux-wpt-2020", "linux-bencher"])
words.extend(["linux-unit-tests", "linux-build-libservo", "linux-wpt-2020", "linux-bencher"])
words.extend(["macos-unit-tests", "windows-unit-tests", "android", "ohos", "lint"])
continue # skip over keyword
if word == "bencher":
@@ -218,6 +244,8 @@ if __name__ == "__main__":
class TestParser(unittest.TestCase):
maxDiff = None
def test_string(self):
self.assertDictEqual(json.loads(Config("linux-unit-tests fail-fast").to_json()),
{'fail_fast': True,
@@ -225,6 +253,7 @@ class TestParser(unittest.TestCase):
'bencher': False,
'name': 'Linux (Unit Tests)',
'profile': 'release',
'build_servoshell': True,
'unit_tests': True,
'build_libservo': False,
'workflow': 'linux',
@@ -241,16 +270,29 @@ class TestParser(unittest.TestCase):
"workflow": "linux",
"wpt_layout": "2020",
"profile": "release",
"build_servoshell": True,
"unit_tests": True,
'build_libservo': False,
'bencher': True,
"wpt_args": ""
},
{
"name": "Linux (Build libservo)",
"workflow": "linux",
"wpt_layout": "none",
"profile": "release",
"build_servoshell": False,
"unit_tests": False,
'build_libservo': True,
'bencher': False,
"wpt_args": ""
},
{
"name": "MacOS (Unit Tests)",
"workflow": "macos",
"wpt_layout": "none",
"profile": "release",
"build_servoshell": True,
"unit_tests": True,
'build_libservo': False,
'bencher': False,
@@ -261,6 +303,7 @@ class TestParser(unittest.TestCase):
"workflow": "windows",
"wpt_layout": "none",
"profile": "release",
"build_servoshell": True,
"unit_tests": True,
'build_libservo': False,
'bencher': False,
@@ -271,6 +314,7 @@ class TestParser(unittest.TestCase):
"workflow": "android",
"wpt_layout": "none",
"profile": "release",
"build_servoshell": True,
"unit_tests": False,
'build_libservo': False,
'bencher': False,
@@ -281,6 +325,7 @@ class TestParser(unittest.TestCase):
"workflow": "ohos",
"wpt_layout": "none",
"profile": "release",
"build_servoshell": True,
"unit_tests": False,
'build_libservo': False,
'bencher': False,
@@ -291,6 +336,7 @@ class TestParser(unittest.TestCase):
"workflow": "lint",
"wpt_layout": "none",
"profile": "release",
"build_servoshell": True,
"unit_tests": False,
'build_libservo': False,
'bencher': False,
@@ -304,6 +350,7 @@ class TestParser(unittest.TestCase):
'bencher': False,
'name': 'Linux (WPT)',
'profile': 'release',
'build_servoshell': True,
'unit_tests': False,
'build_libservo': False,
'workflow': 'linux',
@@ -340,10 +387,46 @@ class TestParser(unittest.TestCase):
self.assertFalse(a.merge(b), "Should not merge jobs that run different WPT tests.")
self.assertEqual(a, JobConfig("Linux (Unit Tests)", Workflow.LINUX, unit_tests=True))
a = JobConfig("Linux", Workflow.LINUX, build_servoshell=True)
b = JobConfig("Linux (Build libservo)", Workflow.LINUX, build_libservo=True)
self.assertFalse(a.merge(b), "Should not merge a job that builds servoshell with a job that builds libservo.")
self.assertEqual(a, JobConfig("Linux", Workflow.LINUX, build_servoshell=True))
def test_full(self):
self.assertDictEqual(json.loads(Config("full").to_json()),
json.loads(Config("").to_json()))
def test_invalid_init_combinations(self):
c = JobConfig("Linux", Workflow.LINUX)
self.assertTrue(c.build_servoshell)
self.assertFalse(c.build_libservo)
c = JobConfig("Linux", Workflow.LINUX, build_libservo=True)
self.assertFalse(c.build_servoshell)
self.assertTrue(c.build_libservo)
with self.assertRaises(ValueError):
c = JobConfig("Linux", Workflow.LINUX, build_servoshell=True, build_libservo=True)
with self.assertRaises(ValueError):
c = JobConfig("Linux", Workflow.LINUX, unit_tests=True, build_libservo=True)
def test_invalid_setattr_combinations(self):
with self.assertRaises(ValueError):
c = JobConfig("Linux", Workflow.LINUX)
c.build_libservo = True
with self.assertRaises(ValueError):
c = JobConfig("Linux", Workflow.LINUX, unit_tests=True)
c.build_libservo = True
with self.assertRaises(ValueError):
c = JobConfig("Linux", Workflow.LINUX, build_servoshell=False, unit_tests=True)
c.build_libservo = True
c = JobConfig("Linux", Workflow.LINUX)
def test_invalid_parse_combinations(self):
Config("linux-build-libservo") # ok
with self.assertRaises(ValueError):
Config("linux-build-libservo-unit-tests")
with self.assertRaises(ValueError):
Config("linux-unit-tests-build-libservo")
def run_tests():
verbosity = 1 if logging.getLogger().level >= logging.WARN else 2