mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
CI: add build-args
(#36947)
Add `build-args` input in CI and try_parser job definition so we can pass own build args to `./mach build` Testing: There are tests for try parser and I tested CI in my fork. Fixes: partial fix #36823 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
5c9afe4274
commit
c0339dd360
8 changed files with 53 additions and 12 deletions
6
.github/workflows/dispatch-workflow.yml
vendored
6
.github/workflows/dispatch-workflow.yml
vendored
|
@ -8,6 +8,9 @@ on:
|
||||||
profile:
|
profile:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
build-args:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
wpt-args:
|
wpt-args:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
@ -35,6 +38,7 @@ jobs:
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
profile: ${{ inputs.profile }}
|
profile: ${{ inputs.profile }}
|
||||||
|
build-args: ${{ inputs.build-args }}
|
||||||
unit-tests: ${{ inputs.unit-tests }}
|
unit-tests: ${{ inputs.unit-tests }}
|
||||||
build-libservo: ${{ inputs.build-libservo }}
|
build-libservo: ${{ inputs.build-libservo }}
|
||||||
bencher: ${{ inputs.bencher }}
|
bencher: ${{ inputs.bencher }}
|
||||||
|
@ -46,6 +50,7 @@ jobs:
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
profile: ${{ inputs.profile }}
|
profile: ${{ inputs.profile }}
|
||||||
|
build-args: ${{ inputs.build-args }}
|
||||||
wpt: ${{ inputs.wpt }}
|
wpt: ${{ inputs.wpt }}
|
||||||
unit-tests: ${{ inputs.unit-tests }}
|
unit-tests: ${{ inputs.unit-tests }}
|
||||||
build-libservo: ${{ inputs.build-libservo }}
|
build-libservo: ${{ inputs.build-libservo }}
|
||||||
|
@ -59,6 +64,7 @@ jobs:
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
profile: ${{ inputs.profile }}
|
profile: ${{ inputs.profile }}
|
||||||
|
build-args: ${{ inputs.build-args }}
|
||||||
wpt: ${{ inputs.wpt }}
|
wpt: ${{ inputs.wpt }}
|
||||||
number-of-wpt-chunks: ${{ inputs.number-of-wpt-chunks }}
|
number-of-wpt-chunks: ${{ inputs.number-of-wpt-chunks }}
|
||||||
unit-tests: ${{ inputs.unit-tests }}
|
unit-tests: ${{ inputs.unit-tests }}
|
||||||
|
|
6
.github/workflows/linux.yml
vendored
6
.github/workflows/linux.yml
vendored
|
@ -6,6 +6,10 @@ on:
|
||||||
required: false
|
required: false
|
||||||
default: "release"
|
default: "release"
|
||||||
type: string
|
type: string
|
||||||
|
build-args:
|
||||||
|
default: ""
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
wpt-args:
|
wpt-args:
|
||||||
default: ""
|
default: ""
|
||||||
required: false
|
required: false
|
||||||
|
@ -166,7 +170,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build (${{ inputs.profile }})
|
- name: Build (${{ inputs.profile }})
|
||||||
run: |
|
run: |
|
||||||
./mach build --use-crown --locked --${{ inputs.profile }}
|
./mach build --use-crown --locked --${{ inputs.profile }} ${{ inputs.build-args }}
|
||||||
cp -r target/cargo-timings target/cargo-timings-linux
|
cp -r target/cargo-timings target/cargo-timings-linux
|
||||||
- name: Smoketest
|
- name: Smoketest
|
||||||
run: xvfb-run ./mach smoketest --${{ inputs.profile }}
|
run: xvfb-run ./mach smoketest --${{ inputs.profile }}
|
||||||
|
|
6
.github/workflows/mac.yml
vendored
6
.github/workflows/mac.yml
vendored
|
@ -7,6 +7,10 @@ on:
|
||||||
required: false
|
required: false
|
||||||
default: "release"
|
default: "release"
|
||||||
type: string
|
type: string
|
||||||
|
build-args:
|
||||||
|
default: ""
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
wpt-args:
|
wpt-args:
|
||||||
default: ""
|
default: ""
|
||||||
required: false
|
required: false
|
||||||
|
@ -146,7 +150,7 @@ jobs:
|
||||||
brew install gnu-tar
|
brew install gnu-tar
|
||||||
- name: Build (${{ inputs.profile }})
|
- name: Build (${{ inputs.profile }})
|
||||||
run: |
|
run: |
|
||||||
./mach build --use-crown --locked --${{ inputs.profile }}
|
./mach build --use-crown --locked --${{ inputs.profile }} ${{ inputs.build-args }}
|
||||||
cp -r target/cargo-timings target/cargo-timings-macos
|
cp -r target/cargo-timings target/cargo-timings-macos
|
||||||
- name: Smoketest
|
- name: Smoketest
|
||||||
uses: nick-fields/retry@v3
|
uses: nick-fields/retry@v3
|
||||||
|
|
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
|
@ -56,6 +56,7 @@ jobs:
|
||||||
unit-tests: ${{ matrix.unit_tests }}
|
unit-tests: ${{ matrix.unit_tests }}
|
||||||
build-libservo: ${{ matrix.build_libservo }}
|
build-libservo: ${{ matrix.build_libservo }}
|
||||||
wpt-args: ${{ matrix.wpt_args }}
|
wpt-args: ${{ matrix.wpt_args }}
|
||||||
|
build-args: ${{ matrix.build_args }}
|
||||||
number-of-wpt-chunks: ${{ matrix.number_of_wpt_chunks }}
|
number-of-wpt-chunks: ${{ matrix.number_of_wpt_chunks }}
|
||||||
bencher: ${{ matrix.bencher }}
|
bencher: ${{ matrix.bencher }}
|
||||||
|
|
||||||
|
|
1
.github/workflows/try-label.yml
vendored
1
.github/workflows/try-label.yml
vendored
|
@ -128,6 +128,7 @@ jobs:
|
||||||
unit-tests: ${{ matrix.unit_tests }}
|
unit-tests: ${{ matrix.unit_tests }}
|
||||||
build-libservo: ${{ matrix.build_libservo }}
|
build-libservo: ${{ matrix.build_libservo }}
|
||||||
wpt-args: ${{ matrix.wpt_args }}
|
wpt-args: ${{ matrix.wpt_args }}
|
||||||
|
build-args: ${{ matrix.build_args }}
|
||||||
number-of-wpt-chunks: ${{ matrix.number_of_wpt_chunks }}
|
number-of-wpt-chunks: ${{ matrix.number_of_wpt_chunks }}
|
||||||
bencher: ${{ matrix.bencher }}
|
bencher: ${{ matrix.bencher }}
|
||||||
|
|
||||||
|
|
6
.github/workflows/try.yml
vendored
6
.github/workflows/try.yml
vendored
|
@ -10,6 +10,10 @@ on:
|
||||||
default: "release"
|
default: "release"
|
||||||
type: choice
|
type: choice
|
||||||
options: ["release", "debug", "production"]
|
options: ["release", "debug", "production"]
|
||||||
|
build-args:
|
||||||
|
default: ""
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
wpt-args:
|
wpt-args:
|
||||||
default: ""
|
default: ""
|
||||||
required: false
|
required: false
|
||||||
|
@ -79,6 +83,7 @@ jobs:
|
||||||
// WPT-related overrides only affect Linux currently, as tests don't run by default on other platforms.
|
// WPT-related overrides only affect Linux currently, as tests don't run by default on other platforms.
|
||||||
configuration.matrix[0].wpt = Boolean(${{ inputs.wpt }});
|
configuration.matrix[0].wpt = Boolean(${{ inputs.wpt }});
|
||||||
configuration.matrix[0].wpt_args = "${{ inputs.wpt-args }}" || "";
|
configuration.matrix[0].wpt_args = "${{ inputs.wpt-args }}" || "";
|
||||||
|
configuration.matrix[0].build_args = "${{ inputs.build-args }}" || "";
|
||||||
|
|
||||||
let unit_tests = Boolean(${{ inputs.unit-tests }});
|
let unit_tests = Boolean(${{ inputs.unit-tests }});
|
||||||
let profile = '${{ inputs.profile }}';
|
let profile = '${{ inputs.profile }}';
|
||||||
|
@ -107,6 +112,7 @@ jobs:
|
||||||
profile: ${{ matrix.profile }}
|
profile: ${{ matrix.profile }}
|
||||||
unit-tests: ${{ matrix.unit_tests }}
|
unit-tests: ${{ matrix.unit_tests }}
|
||||||
build-libservo: ${{ matrix.build_libservo }}
|
build-libservo: ${{ matrix.build_libservo }}
|
||||||
|
build-args: ${{ matrix.build_args }}
|
||||||
wpt-args: ${{ matrix.wpt_args }}
|
wpt-args: ${{ matrix.wpt_args }}
|
||||||
number-of-wpt-chunks: ${{ matrix.number_of_wpt_chunks }}
|
number-of-wpt-chunks: ${{ matrix.number_of_wpt_chunks }}
|
||||||
bencher: ${{ matrix.bencher }}
|
bencher: ${{ matrix.bencher }}
|
||||||
|
|
6
.github/workflows/windows.yml
vendored
6
.github/workflows/windows.yml
vendored
|
@ -7,6 +7,10 @@ on:
|
||||||
required: false
|
required: false
|
||||||
default: "release"
|
default: "release"
|
||||||
type: string
|
type: string
|
||||||
|
build-args:
|
||||||
|
default: ""
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
unit-tests:
|
unit-tests:
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
@ -161,7 +165,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build (${{ inputs.profile }})
|
- name: Build (${{ inputs.profile }})
|
||||||
run: |
|
run: |
|
||||||
.\mach build --use-crown --locked --${{ inputs.profile }}
|
.\mach build --use-crown --locked --${{ inputs.profile }} ${{ inputs.build-args }}
|
||||||
cp C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows -Recurse
|
cp C:\a\servo\servo\target\cargo-timings C:\a\servo\servo\target\cargo-timings-windows -Recurse
|
||||||
- name: Copy resources
|
- name: Copy resources
|
||||||
if: ${{ runner.environment != 'self-hosted' }}
|
if: ${{ runner.environment != 'self-hosted' }}
|
||||||
|
|
|
@ -39,11 +39,12 @@ class JobConfig(object):
|
||||||
unit_tests: bool = False
|
unit_tests: bool = False
|
||||||
build_libservo: bool = False
|
build_libservo: bool = False
|
||||||
bencher: bool = False
|
bencher: bool = False
|
||||||
|
build_args: str = ""
|
||||||
wpt_args: str = ""
|
wpt_args: str = ""
|
||||||
number_of_wpt_chunks: int = 20
|
number_of_wpt_chunks: int = 20
|
||||||
# These are the fields that must match in between two JobConfigs for them to be able to be
|
# 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.
|
# 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_args']
|
||||||
|
|
||||||
def merge(self, other: JobConfig) -> bool:
|
def merge(self, other: JobConfig) -> bool:
|
||||||
"""Try to merge another job with this job. Returns True if merging is successful
|
"""Try to merge another job with this job. Returns True if merging is successful
|
||||||
|
@ -209,7 +210,8 @@ class TestParser(unittest.TestCase):
|
||||||
'build_libservo': False,
|
'build_libservo': False,
|
||||||
'workflow': 'linux',
|
'workflow': 'linux',
|
||||||
'wpt': False,
|
'wpt': False,
|
||||||
'wpt_args': ''
|
'wpt_args': '',
|
||||||
|
'build_args': ''
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -225,7 +227,8 @@ class TestParser(unittest.TestCase):
|
||||||
"unit_tests": True,
|
"unit_tests": True,
|
||||||
'build_libservo': False,
|
'build_libservo': False,
|
||||||
'bencher': True,
|
'bencher': True,
|
||||||
"wpt_args": ""
|
"wpt_args": "",
|
||||||
|
'build_args': ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "MacOS (Unit Tests)",
|
"name": "MacOS (Unit Tests)",
|
||||||
|
@ -236,7 +239,8 @@ class TestParser(unittest.TestCase):
|
||||||
"unit_tests": True,
|
"unit_tests": True,
|
||||||
'build_libservo': False,
|
'build_libservo': False,
|
||||||
'bencher': False,
|
'bencher': False,
|
||||||
"wpt_args": ""
|
"wpt_args": "",
|
||||||
|
'build_args': ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Windows (Unit Tests)",
|
"name": "Windows (Unit Tests)",
|
||||||
|
@ -247,7 +251,8 @@ class TestParser(unittest.TestCase):
|
||||||
"unit_tests": True,
|
"unit_tests": True,
|
||||||
'build_libservo': False,
|
'build_libservo': False,
|
||||||
'bencher': False,
|
'bencher': False,
|
||||||
"wpt_args": ""
|
"wpt_args": "",
|
||||||
|
'build_args': ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Android",
|
"name": "Android",
|
||||||
|
@ -258,7 +263,8 @@ class TestParser(unittest.TestCase):
|
||||||
"unit_tests": False,
|
"unit_tests": False,
|
||||||
'build_libservo': False,
|
'build_libservo': False,
|
||||||
'bencher': False,
|
'bencher': False,
|
||||||
"wpt_args": ""
|
"wpt_args": "",
|
||||||
|
'build_args': ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OpenHarmony",
|
"name": "OpenHarmony",
|
||||||
|
@ -269,7 +275,8 @@ class TestParser(unittest.TestCase):
|
||||||
"unit_tests": False,
|
"unit_tests": False,
|
||||||
'build_libservo': False,
|
'build_libservo': False,
|
||||||
'bencher': False,
|
'bencher': False,
|
||||||
"wpt_args": ""
|
"wpt_args": "",
|
||||||
|
'build_args': ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Lint",
|
"name": "Lint",
|
||||||
|
@ -280,7 +287,9 @@ class TestParser(unittest.TestCase):
|
||||||
"unit_tests": False,
|
"unit_tests": False,
|
||||||
'build_libservo': False,
|
'build_libservo': False,
|
||||||
'bencher': False,
|
'bencher': False,
|
||||||
"wpt_args": ""}
|
"wpt_args": "",
|
||||||
|
'build_args': ''
|
||||||
|
}
|
||||||
]})
|
]})
|
||||||
|
|
||||||
def test_job_merging(self):
|
def test_job_merging(self):
|
||||||
|
@ -295,7 +304,8 @@ class TestParser(unittest.TestCase):
|
||||||
'build_libservo': False,
|
'build_libservo': False,
|
||||||
'workflow': 'linux',
|
'workflow': 'linux',
|
||||||
'wpt': True,
|
'wpt': True,
|
||||||
'wpt_args': ''
|
'wpt_args': '',
|
||||||
|
'build_args': ''
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -327,6 +337,11 @@ class TestParser(unittest.TestCase):
|
||||||
self.assertFalse(a.merge(b), "Should not merge jobs that run different WPT tests.")
|
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))
|
self.assertEqual(a, JobConfig("Linux (Unit Tests)", Workflow.LINUX, unit_tests=True))
|
||||||
|
|
||||||
|
a = JobConfig("Linux (Unit Tests)", Workflow.LINUX, unit_tests=True)
|
||||||
|
b = JobConfig("Linux (Unit Tests)", Workflow.LINUX, unit_tests=True, build_args="--help")
|
||||||
|
self.assertFalse(a.merge(b), "Should not merge jobs with different build arguments.")
|
||||||
|
self.assertEqual(a, JobConfig("Linux (Unit Tests)", Workflow.LINUX, unit_tests=True))
|
||||||
|
|
||||||
def test_full(self):
|
def test_full(self):
|
||||||
self.assertDictEqual(json.loads(Config("full").to_json()),
|
self.assertDictEqual(json.loads(Config("full").to_json()),
|
||||||
json.loads(Config("").to_json()))
|
json.loads(Config("").to_json()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue