This is needed for #187905. Unless we disable the check, Zizmor will flag uses of `actions/checkout` without an explicit `persist-credentials` setting. Of course, some workflows could rely on the credentials persisted by `actions/checkout`. I asked Claude to check each affected job, and it flagged only `prune-branches.yml`. The script `prune-unused-branches.py` relies on the persisted credentials, so I've left that as `persist-credentials: true` for now.
117 lines
3.9 KiB
YAML
117 lines
3.9 KiB
YAML
# This workflow is for pre-commit testing of the LLVM-libc project.
|
|
name: LLVM-libc Pre-commit Overlay Tests
|
|
permissions:
|
|
contents: read
|
|
on:
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
paths:
|
|
- 'libc/**'
|
|
- '.github/workflows/libc-overlay-tests.yml'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2022, windows-2025, macos-15]
|
|
include:
|
|
# TODO: add linux gcc when it is fixed
|
|
- os: ubuntu-24.04
|
|
compiler:
|
|
c_compiler: clang
|
|
cpp_compiler: clang++
|
|
- os: ubuntu-24.04-arm
|
|
compiler:
|
|
c_compiler: clang
|
|
cpp_compiler: clang++
|
|
- os: windows-2022
|
|
compiler:
|
|
c_compiler: clang-cl
|
|
cpp_compiler: clang-cl
|
|
- os: windows-2025
|
|
compiler:
|
|
c_compiler: clang-cl
|
|
cpp_compiler: clang-cl
|
|
- os: macos-15
|
|
compiler:
|
|
c_compiler: clang
|
|
cpp_compiler: clang++
|
|
|
|
steps:
|
|
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
# Libc's build is relatively small comparing with other components of LLVM.
|
|
# A fresh linux overlay takes about 180MiB of uncompressed disk space, which can
|
|
# be compressed into ~40MiB. MacOS and Windows overlay builds are less than 10MiB
|
|
# after compression. Limiting the cache size to 1G should be enough.
|
|
# Prefer sccache as it is modern and it has a guarantee to work with MSVC.
|
|
# Do not use direct GHAC access even though it is supported by sccache. GHAC rejects
|
|
# frequent small object writes.
|
|
- name: Setup ccache
|
|
uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
|
|
with:
|
|
max-size: 1G
|
|
key: libc_overlay_build_${{ matrix.os }}_${{ matrix.compiler.c_compiler }}
|
|
variant: sccache
|
|
|
|
# MPFR is required by some of the mathlib tests.
|
|
- name: Prepare dependencies (Ubuntu)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build
|
|
|
|
# Chocolatey is shipped with Windows runners. Windows Server 2025 recommends WinGet.
|
|
# Consider migrating to WinGet when Windows Server 2025 is available.
|
|
- name: Prepare dependencies (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
choco install ninja
|
|
|
|
- name: Prepare dependencies (macOS)
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew install ninja
|
|
|
|
- name: Set reusable strings
|
|
id: strings
|
|
shell: bash
|
|
run: |
|
|
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
|
|
|
|
# Use MinSizeRel to reduce the size of the build.
|
|
# Notice that CMP0141=NEW and MSVC_DEBUG_INFORMATION_FORMAT=Embedded are required
|
|
# by the sccache tool.
|
|
- name: Configure CMake
|
|
run: >
|
|
cmake -B ${{ steps.strings.outputs.build-output-dir }}
|
|
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
|
|
-DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
|
|
-DCMAKE_BUILD_TYPE=Debug
|
|
-DCMAKE_C_COMPILER_LAUNCHER=sccache
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
|
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW
|
|
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
|
|
-DLLVM_ENABLE_RUNTIMES=libc
|
|
-G Ninja
|
|
-S ${{ github.workspace }}/runtimes
|
|
|
|
- name: Build
|
|
run: >
|
|
cmake
|
|
--build ${{ steps.strings.outputs.build-output-dir }}
|
|
--parallel
|
|
--target libc
|
|
|
|
- name: Test
|
|
run: >
|
|
cmake
|
|
--build ${{ steps.strings.outputs.build-output-dir }}
|
|
--parallel
|
|
--target check-libc
|