This allows us to use `uv` for:
1. Installing a pinned Python version
2. Installing the dependency packages using `uv`'s pip compatible interface.
4. Bootstrapping `mach` without a Python installion on the host, using `uv
run`
This change also introduces a new 'composite' GitHub action to setup
python in the different CI workflows. There is no support for externally
managed python installations and virtual environments. These could be
added in the future.
Fixes#34095, #34547
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This patch switches servo to use `uv` for both installing a pinned
Python version as well as installing the dependency packages using
`uv`'s pip compatible interface. It also introduces a new 'composite'
GitHub action to setup python in the different CI workflows.
There is no support for externally managed python installations and
virtual environments. These could be added in the future.
Fixes#34095
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* CI: use self-hosted runners for Linux build jobs
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Set ccache and incremental env variables when not self-hosted
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Force GitHub-hosted runner when in upload mode
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Revert s/python/python3/ now that our image has python
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Remove stray comment in timeout workflow
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Update description of runner-select job
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Apply suggestions from code review
Address couple minor naming / formatting nits
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
---------
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* CI: use self-hosted Windows runners in main workflow
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Fix a couple of robustness issues by generating a unique build id
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Work around needs-context expressions being busted in concurrency
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* CI: use self-hosted Windows runners in try and try-label workflows
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Rename windows workflow back for simplicity
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Clarify why the copy resources step is for GitHub-hosted jobs only
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Fix cancelled status problem by dispatching instead of calling
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Tweak retry strategy to avoid hitting REST API rate limits
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Update dispatch-workflow.yml accordingly
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Rework to use simpler approach with runner labels
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Use org-scoped self-hosted runners
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Don’t run runner-timeout job when GitHub-hosted runner is selected
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Downgrade to Python 3.10
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Avoid failing when RUNNER_API_TOKEN is missing (such as in forks)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Fix undefined needs output when RUNNER_API_TOKEN is missing
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Reset working tree, in case it was dirty in the runner image
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Clearer runner assignment timeout jobs that fail and offer help
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Fix some other sources of incremental build breakage (but not PATH)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Log reasons why we fall back to GitHub-hosted runners
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Allow self-hosted runners to be disabled via repository variable
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Always install crown, even on self-hosted runners
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Rename incremental build debugging step
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Clean up job friendly names
Signed-off-by: Delan Azabani <dazabani@igalia.com>
* Reduce fetch depth, now that this job no longer lints
Signed-off-by: Delan Azabani <dazabani@igalia.com>
---------
Signed-off-by: Delan Azabani <dazabani@igalia.com>
This [issue][1] was reported by GitHub user @RedYetiDev via the Security
Advisory reporting mechanism on GitHub. The fix is also based on their
proposed solution.
The issue is that `refs/pull/{pr_number}/head` points to the latest
commit of a PR and so it could be different than the commit that was
reviewed when the try label was applied. The fix is to use the exact commit
sha at the point when the try job is triggered, which is available in
the `github` context as `github.event.pull_request.head.sha`.
[1]: https://github.com/servo/servo/security/advisories/GHSA-fxqr-xgh8-3577
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Aviv Keller <38299977+RedYetiDev@users.noreply.github.com>
* Make `crown` optional
Add the optional `--use-crown` flag to mach
* --use-crown for all platforms in CI
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
* Add documentation for `--use-crown`
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
* Update python/servo/command_base.py
Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* Raise Error if CARGO_BUILD_RUSTC conflicts with --use-crown
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
* add dummy RUSTFLAG to trigger re-checking
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
---------
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
Use the `cargo-install` action to cache the cargo-deny output.
`cargo-deny` is currently unconditionally installed during bootstrap,
and takes around 2 minutes to install, so caching should give a
significant speedup
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Thus the build will immediately fail if a PR modifies Cargo.toml but
forgets to include the changes in Cargo.lock
This was previously checked by lockfile_changed.sh after building
normally, wasting resources.
* ci: Switch to version 4 of GitHub artifact actions
This switches to version 4 of the GitHub artifact actions, which
requires producing a single artifact per job and adding merge steps. In
addition, the names of artifacts are standardized:
- Build: <profile>-binary-<platform>
- Full WPT results (only on failure): wpt-full-logs-<platform>-<layout>
- Filtered WPT results (only on failure): wpt-filtered-logs-<platform>-<layout>
* Delete merged build timings and combine with Result job
* Always archives logs even after test failures
* Correct the name of the log files for WPT import
* Matrix in CI and mach try with presets
* small fixups
* names in trigger try run comment
* let
* f
* rename step
* fix running try on win
* fix try branch full
* py3.10
* typo
* Make unit-tests default to false, except in basic os runs
Fixes https://github.com/servo/servo/issues/31174
* make full use linux-wpt & linux-wpt also include unit-tests
so full is equal to main workflow
* Stylish fixes
* cmp json as dict
* build: Add support for Visual Studio 2022 and VC143 DLLs
This change adds supports fot Visual Studio 2022 and the VC143 (current)
version of the Visual Studio CRT. In addition, it reworks the way that
Visual Studio is found, returning all installations in a generator,
separately finding it via vswhere.exe, searching paths, and via
environment variables.
All of these installations are searched for the DLLs with highest
priority given to the highest version of MS Visual Studio installed. The
hope is that this makes the process more robust and properly handles
having multiple versions installed, but only one with the correct
runtime DLLs.
* Update based on review comments
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
---------
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This makes it more foolproof to install crown from inside the Servo
directory, because the root Servo config.toml overrides the rustc to use
crown (an obvious circular dependency).
Make it so that all try builds go through try.yml and pass
workflow_call arguments as expected to subsequent workflows.
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
* Replace virtualenv with Python's built-in venv.
* Apply Delan's suggestions and make a couple small fixes
- Fix a tidy warning about directories that don't exist
- Use shutil instead of the redundant get_exec_path
- Miscellaneous cleanups
* Fix typo in environment variable
* fix bug where pip still tries to the wrong site-packages
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
* Remove script_plugins
* Use crown instead of script_plugins
* crown_is_not_used
* Use crown in command base
* bootstrap crown
* tidy happy
* disable sccache
* Bring crown in tree
* Install crown from tree
* fix windows ci
* fix warning
* fix mac
libscript_plugins.dylib is not available anymore
* Update components/script/lib.rs
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Update for nightly-2023-03-18
Mostly just based off https://github.com/servo/servo/pull/30630
* Always install crown
it's slow only when there is new version
* Run crown test with `mach test-unit`
* Small fixups; better trace_in_no_trace tests
* Better doc
* crown in config.toml
* Fix tidy for real
* no sccache on rustc_wrapper
* document rustc overrides
* fixup of compiletest
* Make a few minor comment adjustments
* Fix a typo in python/servo/platform/base.py
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
* Proper test types
* Ignore tidy on crown/tests
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Triggering from labels means that we have less actions running and less
false job failures spamming project members. Plus, we have more
flexibility with labels rather than the backward compatibility we have
set up for bors comments.
* Run main and try jobs with debug assertions
* use single quotes in workflow expressions
* set force-debug-assertions in main.yml
* set force-debug-assertions as part of decision job
* fix typo in MachCommands.build
* fix more hardcoded profile names
* fix tidy
* split cargo_profile_option on windows
* Fix running servoshell and unit tests through a symlink
* rename steps to make them less confusing
* fix more hardcoded cargo profile options
* fix missing inputs in linux-wpt and mac-wpt
* make filename an inherent method of Resource
* rework release-with-debug-assertions profile to production profile
* rework resource logic to eliminate std_test_override
* set production flag in nightly release builds
* clean up servobuild.example and windows.yml
* oops forgot to check in embedder_traits/build.rs
* fix mach test-unit behaviour through symlink
* unit tests only need current_dir and ancestors
* fix macOS package smoketest breakage
* expect css/css-color/currentcolor-003 to crash under layout 2013
* fix more references to {force,release-with}-debug-assertions
* fix local build failures under --profile production
This change adds and alternate method for triggering try changes.
Instead of comments, changes are triggered via applying labels to pull
requests. The action will remove the label from the request and start
the requested jobs.
This will require creating at least a few labels:
- T-full
- T-linux-wpt-2013
- T-linux-wpt-2020
- T-macos
- T-windows
More labels can be added as we support more configurations.
The good thing about this change is that try jobs against the actual
branch in the pull request instead of the master branch. This means
that changes to CI can be tested (unlike for comment processing).
One bit caveat with this change is that when adding multiple labels, a
CI job is triggered for each. Only one real build will run for each
label, but whether or more try jobs is triggered is a race condition.
The first CI job to successfully remove the label will actually trigger
the job. If the same job removes two compatible labels, then they can
share a build (for instance two types of WPT linux jobs). If not there
will be two. Note that this is at least as efficient as the current
behavior.
LLVM is the largest package that we get from servo-build-deps, so
installing it via chocolatey should reduce the amount of data that we
transfer from that source. In addition, it's one less dependency that we
have to manage.
It also seems that installing LLVM to the default location with choco
means that we no longer have to set the LIBCLANG_PATH environment
variable for bindgen.
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
There are currently two ways to run try. One is to push to the `try` or
`try-*` branches and the other is to trigger a workflow via GitHub
comment. This change combines these methods into one workflow. In
addition, WPT results are reported together rather than separately and
filtered results for all WPT tests are bundled together in the same
artifact.
There were some issues with the way that the `--release` and `--dev`
arguments were handled in mach commands.
- Not all commands accepted them in the same way. For instance `./mach
test-wpt` didn't really accept them at all.
- If you did not pass either of them, mach would try to guess which
build you meant. This guess was often quite surprising as it wasn't
printed and it depended on the state of the your target directory,
which is difficult to remember.
- The `dev` profile is colloquially called a "debug" profile and some
commands accepted `-d` or `--debug...` like arguments, but `--debug`
with `./mach run` meant run in a debugger. It was easy to mix this
up.
This change:
- Centralizes where build type argument processing happens. Now it the
same shared decorator in CommandBase.
- Uses a `BuildType` enum instead of passing around two different
booleans. This reduces the error checking for situations where both
are true.
- Be much less clever about guessing what build to use. Now if you
don't specify a build type, `--dev` is chosen. I think this behavior
matches cargo.
- Makes it so that `./mach test-wpt` accepts the exact same arguments
and has the same behavior as other commands. In addition, the suite
correct for `test-wpt` is removed. There are only two suites now and
it's quite unlikely that people will confuse WPT tests for rust unit
tests.