Skip to content

Commit 0fa9cfa

Browse files
authored
[CI] Add documentation for self-hosted runners (#211622)
This patch adds (work in progress) documentation for the various self-hosted runner groups we have access to in the LLVM monorepo.
1 parent d8d33ab commit 0fa9cfa

3 files changed

Lines changed: 113 additions & 0 deletions

File tree

‎llvm/docs/CIBestPractices.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ GitHub Actions Best Practices
1515
This section contains information on best practices/guidelines when working on
1616
LLVM's GitHub actions workflows.
1717

18+
For details on the runner pools these workflows execute on and their
19+
platform-specific constraints, see :doc:`GitHubActionsRunners`.
20+
1821
Disabling Jobs In Forks
1922
-----------------------
2023

‎llvm/docs/GitHubActionsRunners.rst‎

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
===========================
2+
LLVM GitHub Actions Runners
3+
===========================
4+
5+
.. contents::
6+
:local:
7+
8+
Overview
9+
========
10+
11+
LLVM's GitHub Actions workflows run on two kinds of runners:
12+
13+
- *GitHub-hosted runners*, which GitHub provisions on demand for each job.
14+
- *Self-hosted runners*, which are machines provided to the LLVM project and
15+
registered with the repository. They are used where GitHub-hosted runners are
16+
not sufficient, for example to provide hardware or operating systems that
17+
GitHub does not offer, or to provide additional capacity.
18+
19+
Self-hosted runners are organized into sets, and a job selects a set through its
20+
``runs-on`` labels. Since these machines are shared across the project and are
21+
available only in limited numbers, workflows that target them should be written
22+
to use them efficiently and to avoid consuming capacity unnecessarily.
23+
24+
The rest of this document describes the self-hosted runner sets and the
25+
constraints to keep in mind when writing workflows that target them.
26+
27+
Self-Hosted Linux Runners
28+
=========================
29+
30+
This section is a work in progress.
31+
32+
Self-Hosted Windows Runners
33+
===========================
34+
35+
This section is a work in progress.
36+
37+
Self-Hosted macOS Runners
38+
=========================
39+
40+
Self-hosted runners running macOS arm64 are provided by Apple. These runners can be targeted
41+
with the following expression ``runs-on: ["self-hosted", "macOS", "apple-runners"]``. Since
42+
these runners have a limited capacity, please contact the infrastructure team before adding
43+
new jobs that target these runners.
44+
45+
System Version and Architecture
46+
-------------------------------
47+
48+
All self-hosted macOS runners run the same version of macOS. However, that version
49+
is determined by the image used on the runners, which is not controllable from
50+
the workflow file. These runners will be kept at the latest released (non-beta)
51+
version of macOS, however jobs running on that infrastructure should not make
52+
assumptions about the macOS version and should strive to be robust to OS version
53+
changes.
54+
55+
All the self-hosted macOS runners run on Apple Silicon, however the exact chip
56+
version can differ from runner to runner. It is not currently possible to target
57+
a specific chip version.
58+
59+
Minimize Short-Lived Jobs
60+
-------------------------
61+
62+
The macOS runners are relatively expensive to bring up and tear down. Avoid scheduling
63+
trivial or short-lived work on these runners. For example, do not spin up a macOS runner
64+
just to perform a cheap check such as determining whether any relevant files have changed.
65+
Prefer inexpensive runners instead and only then dispatch a macOS job if testing is actually
66+
required.
67+
68+
Selecting the Xcode Version
69+
---------------------------
70+
71+
The macOS runners come with several versions of Xcode installed: the two latest releases of
72+
Xcode and the latest beta. You can select the version of Xcode by pointing ``DEVELOPER_DIR``
73+
to it. The toolchain (``clang``, ``xcrun``, the SDKs, and so on) is then taken from that
74+
Xcode. This can be done in an early step that writes the variable to ``$GITHUB_ENV`` so that
75+
it applies to all subsequent steps:
76+
77+
.. code-block:: yaml
78+
79+
- name: Select Xcode
80+
run: echo "DEVELOPER_DIR=/Applications/Xcode_26.5.app/Contents/Developer" >> $GITHUB_ENV
81+
82+
No Passwordless ``sudo``
83+
------------------------
84+
85+
The user that runs jobs on the macOS runners cannot use ``sudo``: there is no passwordless
86+
sudo, and jobs have no way to supply a password. Any step that requires root privileges will
87+
therefore fail.
88+
89+
Installing Tools via Homebrew
90+
-----------------------------
91+
92+
When a job needs a tool that is not already present on the runner, install it with Homebrew.
93+
Homebrew installs into a prefix owned by the runner account, so it does not require ``sudo``,
94+
and it provides self-contained tools. Also make sure you update Homebrew before installing.
95+
For example:
96+
97+
.. code-block:: yaml
98+
99+
- name: Install dependencies
100+
run: |
101+
brew update
102+
brew install ninja cmake
103+
104+
Version-specific formulae (for example ``python@3.12``) can be used when a job
105+
needs a particular version of a tool.

‎llvm/docs/Reference.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ ConvergenceAndUniformity
4949
MLGO
5050
ContentAddressableStorage
5151
CIBestPractices
52+
GitHubActionsRunners
5253
AIToolPolicy
5354
CallGraphSection
5455
InterfaceExportAnnotations
@@ -234,3 +235,7 @@ XRayFDRFormat
234235
{doc}`CIBestPractices`
235236
: A list of guidelines and best practices to use when working on LLVM's
236237
CI systems.
238+
239+
{doc}`GitHubActionsRunners`
240+
: A reference for LLVM's GitHub Actions runner pools and their
241+
platform-specific constraints.

0 commit comments

Comments
 (0)