Skip to content

Commit bd231da

Browse files
[libc][workflow] address permission concern and add more comments (#119320)
This patch limits the permission of pre-commit libc pipelines. It also adds detailed comments to help future modifications.
1 parent df4c5d5 commit bd231da

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

.github/workflows/libc-fullbuild-tests.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This workflow is for pre-commit testing of the LLVM-libc project.
22
name: LLVM-libc Pre-commit Fullbuild Tests
3-
3+
permissions:
4+
contents: read
45
on:
56
pull_request:
67
branches: [ "main" ]
@@ -22,14 +23,24 @@ jobs:
2223
# cpp_compiler: g++
2324
steps:
2425
- uses: actions/checkout@v4
25-
26+
27+
# Libc's build is relatively small comparing with other components of LLVM.
28+
# A fresh fullbuild takes about 190MiB of uncompressed disk space, which can
29+
# be compressed into ~40MiB. Limiting the cache size to 1G should be enough.
30+
# Prefer sccache as it is more modern.
31+
# Do not use direct GHAC access even though it is supported by sccache. GHAC rejects
32+
# frequent small object writes.
2633
- name: Setup ccache
2734
uses: hendrikmuhs/[email protected]
2835
with:
2936
max-size: 1G
3037
key: libc_fullbuild_${{ matrix.c_compiler }}
3138
variant: sccache
3239

40+
# Notice:
41+
# - MPFR is required by some of the mathlib tests.
42+
# - Debian has a multilib setup, so we need to symlink the asm directory.
43+
# For more information, see https://wiki.debian.org/Multiarch/LibraryPathOverview
3344
- name: Prepare dependencies (Ubuntu)
3445
run: |
3546
sudo apt-get update
@@ -42,7 +53,9 @@ jobs:
4253
run: |
4354
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
4455
echo "build-install-dir=${{ github.workspace }}/install" >> "$GITHUB_OUTPUT"
45-
56+
57+
# Configure libc fullbuild with scudo.
58+
# Use MinSizeRel to reduce the size of the build.
4659
- name: Configure CMake
4760
run: >
4861
cmake -B ${{ steps.strings.outputs.build-output-dir }}

.github/workflows/libc-overlay-tests.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This workflow is for pre-commit testing of the LLVM-libc project.
22
name: LLVM-libc Pre-commit Overlay Tests
3-
3+
permissions:
4+
contents: read
45
on:
56
pull_request:
67
branches: [ "main" ]
@@ -32,20 +33,30 @@ jobs:
3233

3334
steps:
3435
- uses: actions/checkout@v4
35-
36+
37+
# Libc's build is relatively small comparing with other components of LLVM.
38+
# A fresh linux overlay takes about 180MiB of uncompressed disk space, which can
39+
# be compressed into ~40MiB. MacOS and Windows overlay builds are less than 10MiB
40+
# after compression. Limiting the cache size to 1G should be enough.
41+
# Prefer sccache as it is modern and it has a guarantee to work with MSVC.
42+
# Do not use direct GHAC access even though it is supported by sccache. GHAC rejects
43+
# frequent small object writes.
3644
- name: Setup ccache
3745
uses: hendrikmuhs/ccache-action@v1
3846
with:
3947
max-size: 1G
4048
key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }}
4149
variant: sccache
4250

51+
# MPFR is required by some of the mathlib tests.
4352
- name: Prepare dependencies (Ubuntu)
4453
if: runner.os == 'Linux'
4554
run: |
4655
sudo apt-get update
4756
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build
4857
58+
# Chocolatey is shipped with Windows runners. Windows Server 2025 recommends WinGet.
59+
# Consider migrating to WinGet when Windows Server 2025 is available.
4960
- name: Prepare dependencies (Windows)
5061
if: runner.os == 'Windows'
5162
run: |
@@ -62,6 +73,9 @@ jobs:
6273
run: |
6374
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
6475
76+
# Use MinSizeRel to reduce the size of the build.
77+
# Notice that CMP0141=NEW and MSVC_DEBUG_INFORMATION_FORMAT=Embedded are required
78+
# by the sccache tool.
6579
- name: Configure CMake
6680
run: >
6781
cmake -B ${{ steps.strings.outputs.build-output-dir }}

0 commit comments

Comments
 (0)