Skip to content
File

Blob: .github/actions/setup-runner/action.yml

yaml87 lines
1name: 'Setup runner environment'
2description: 'Sets up runner environment with proper toolchain for building workerd'
3inputs:
4 GOOGLESOURCE_COOKIE:
5 description: 'Cookie for googlesource.com'
6 required: true
7runs:
8 using: 'composite'
9 steps:
10 - name: Setup Linux
11 shell: bash
12 if: runner.os == 'Linux'
13 run: |
14 export DEBIAN_FRONTEND=noninteractive
15 wget https://apt.llvm.org/llvm.sh
16 sed -i '/apt-get install/d' llvm.sh
17 chmod +x llvm.sh
18 sudo ./llvm.sh 19
19 # keep in sync with build/ci.bazelrc
20 sudo apt-get install -y -qq --no-install-recommends \
21 clang-19 \
22 lld-19 \
23 libunwind-19 \
24 libc++abi1-19 \
25 libc++1-19 \
26 libc++-19-dev \
27 libclang-rt-19-dev \
28 llvm-19
29 sudo ln -s /usr/bin/llvm-symbolizer-19 /usr/bin/llvm-symbolizer
30 sudo ln -s /usr/bin/llvm-profdata-19 /usr/bin/llvm-profdata
31 sudo ln -s /usr/bin/llvm-cov-19 /usr/bin/llvm-cov
32 echo "build:linux --repo_env=CC=/usr/lib/llvm-19/bin/clang" >> .bazelrc
33 echo "build:linux --linkopt=--ld-path=/usr/lib/llvm-19/bin/ld.lld" >> .bazelrc
34 echo "build:linux --host_linkopt=--ld-path=/usr/lib/llvm-19/bin/ld.lld" >> .bazelrc
35 echo "build:linux --repo_env=AR=/usr/lib/llvm-19/bin/llvm-ar" >> .bazelrc
36 - name: Setup Windows
37 shell: pwsh
38 env:
39 GOOGLESOURCE_COOKIE: ${{ inputs.GOOGLESOURCE_COOKIE }}
40 if: runner.os == 'Windows'
41 # Set a custom output root directory to avoid long file name issues.
42 # TODO(cleanup): According to https://github.com/actions/runner-images/blob/win25/20251216.149/images/windows/scripts/build/Configure-DeveloperMode.ps1#L13,
43 # this should already be set on the build image, but prior testing indicated CI speedups with
44 # it, check if it is actually having any effect.
45 run: |
46 # Enable Developer Mode to allow Bazel to create real symlinks
47 reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
48 git config --global core.symlinks true
49 git config --show-scope --show-origin core.symlinks
50 git config --system core.longpaths true
51 [System.IO.File]::WriteAllLines((Join-Path -Path $env:USERPROFILE -ChildPath '.bazelrc'), 'startup --output_user_root=\\\\?\\C:\\tmp')
52 - name: Setup macOS
53 if: runner.os == 'macOS'
54 shell: bash
55 env:
56 GOOGLESOURCE_COOKIE: ${{ inputs.GOOGLESOURCE_COOKIE }}
57 run: |
58 # Build using Xcode 16.3 (equivalent to Clang 19)
59 sudo xcode-select -s "/Applications/Xcode_16.3.app"
60 - name: Configure git hooks
61 shell: bash
62 # Configure git to quell an irrelevant warning for runners (they never commit / push).
63 run: git config core.hooksPath githooks
64 # Skip when the cookie is empty (forks, Dependabot PRs, local runs). Bazel will
65 # fall back to the unauthenticated googlesource endpoint, which is slower / more
66 # rate-limited but works without credentials.
67 - name: Configure Googlesource credentials (Unix)
68 shell: bash
69 if: inputs.GOOGLESOURCE_COOKIE != '' && runner.os != 'Windows'
70 env:
71 GOOGLESOURCE_COOKIE: ${{ inputs.GOOGLESOURCE_COOKIE }}
72 run: |
73 git config --global --add url."https://chromium.googlesource.com/a/".insteadOf "https://chromium.googlesource.com/"
74 git config --global http.cookiefile ~/.gitcookies
75 tr , \\t <<__END__ >>~/.gitcookies
76 .googlesource.com,TRUE,/,TRUE,2147483647,o,$GOOGLESOURCE_COOKIE
77 __END__
78 - name: Configure Googlesource credentials (Windows)
79 shell: pwsh
80 if: inputs.GOOGLESOURCE_COOKIE != '' && runner.os == 'Windows'
81 env:
82 GOOGLESOURCE_COOKIE: ${{ inputs.GOOGLESOURCE_COOKIE }}
83 run: |
84 git config --global --add url."https://chromium.googlesource.com/a/".insteadOf "https://chromium.googlesource.com/"
85 git config --global http.cookiefile "$env:USERPROFILE\.gitcookies"
86 Write-Output ".googlesource.com`tTRUE`t/`tTRUE`t2147483647`to`t$env:GOOGLESOURCE_COOKIE" >> "$env:USERPROFILE\.gitcookies"
87