Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/CheckNonDocChanges/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Check for non-doc changes
description: >
Compare the ELD checkout to qualcomm/eld's PR base and set skip_build when
the PR only touches docs/. Shared by ci.yml, ci-macos.yml, and ci-win.yml.

inputs:
base-branch:
description: "Base branch on qualcomm/eld (e.g. main)"
required: true
base-sha:
description: "github.event.pull_request.base.sha — the base commit GitHub already resolved"
required: true
eld-root:
description: >
ELD checkout root (the directory that contains .git). Required when this
action is staged away from <eld>/.github/workflows/CheckNonDocChanges,
because uses: cannot interpolate github/env into a local path.
required: false
default: ''

outputs:
skip_build:
description: "true if only docs changed; false otherwise"
value: ${{ steps.file-check.outputs.skip_build }}

runs:
using: composite
steps:
- name: Check for non-doc changes
id: file-check
shell: bash
env:
BASE_BRANCH_NAME: ${{ inputs.base-branch }}
BASE_SHA: ${{ inputs.base-sha }}
# Default: action lives at <eld>/.github/workflows/CheckNonDocChanges.
# ci.yml stages a copy at the workspace root, so it passes eld-root.
working-directory: ${{ inputs.eld-root || format('{0}/../../..', github.action_path) }}
run: |
set -euo pipefail
# We need the base commit from qualcomm/eld, not from the fork.
git remote add QC https://github.com/qualcomm/eld.git
# Prefer the event SHA (one commit, no history walk). Fall back to the
# branch tip if the remote will not serve a raw SHA.
git fetch --no-tags --depth=1 QC "${BASE_SHA}" || \
git fetch --no-tags --depth=1 QC "${BASE_BRANCH_NAME}"
if git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then
BASE="${BASE_SHA}"
elif git rev-parse --verify "QC/${BASE_BRANCH_NAME}^{commit}" >/dev/null 2>&1; then
BASE="QC/${BASE_BRANCH_NAME}"
else
echo "::error::Could not resolve base ${BASE_SHA} or QC/${BASE_BRANCH_NAME}"
git rev-parse HEAD
git remote -v
exit 1
fi
# Two-dot tree diff: both objects exist after the fetch, so this does
# not need merge-base (which fails on a depth-1 QC/main vs a fork HEAD).
CHANGED_FILES=$(git diff --name-only "${BASE}" HEAD)
echo "diff-base: ${BASE}"
echo "Changed files: ${CHANGED_FILES}"
for file in $CHANGED_FILES; do
if [[ ! "$file" =~ ^docs/ && ! "$file" =~ \.md$ ]]; then
echo "skip_build=false" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "Only docs changed. Skipping build."
echo "skip_build=true" >> "$GITHUB_OUTPUT"
169 changes: 169 additions & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: macOS CI

# GitHub-hosted Darwin host build of ld.eld (ELF linker, not a Mach-O target).

on:
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- '.github/workflows/sanitize.yml'
- '.github/workflows/reviter.yml'
- '.github/workflows/docs.yaml'
- '.github/workflows/docs-multiversion.yaml'
- '.github/workflows/ci.yml'
- '.github/workflows/ci-win.yml'
- '.github/workflows/clang-cross-schedule.yml'
- '.github/workflows/DownloadClangCrossToolchain/action.yaml'
- '.github/workflows/DownloadLatestBusybox/action.yaml'
- '.github/workflows/busybox.yml'
- '.github/workflows/linux-kernel-nightly.yml'
- '.github/workflows/linux-kernel-run.yml'
- '.github/workflows/linux-kernel-pr.yml'
- '.github/workflows/nightly-musl-builder.yml'
- '.github/workflows/picolibc-builder.yml'
- '.github/workflows/nightly-test.yml'
- '.github/workflows/update-build-dashboard-data.yml'
- '.github/workflows/scripts/record_builds.py'
- '.github/workflows/BuildStatusDataRecorder/action.yaml'
- '.github/workflows/clang-format-pr.yml'
- '.github/workflows/cpp-linter-pr.yml'
- 'etc/**/*.sh'
workflow_dispatch: {}

permissions:
contents: read

jobs:
build-macos:
name: macOS
runs-on: macos-latest
timeout-minutes: 180
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
env:
BASE_BRANCH_NAME: ${{ github.event.pull_request.base.ref || 'main' }}
ELD_REPO: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ELD_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
CCACHE_DIR: ${{ github.workspace }}/obj/ccache
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPILERCHECK: content
CCACHE_NOHASHDIR: true

steps:
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 #v7.0.0
with:
python-version: '3.14'

- name: Install build tools
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
command -v ninja >/dev/null || brew install ninja
command -v ccache >/dev/null || brew install ccache
python3 -m pip install pyyaml
echo "cmake $(cmake --version | head -n1)"
echo "ninja $(ninja --version)"
echo "ccache $(ccache --version | head -n1)"
echo "clang $(clang --version | head -n1)"
echo "python $(python3 --version) from $(which python3)"
sysctl hw.ncpu hw.physicalcpu hw.memsize || true
df -h .

- name: Checkout llvm-project
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: llvm/llvm-project
ref: ${{ env.BASE_BRANCH_NAME }}
path: llvm-project
fetch-depth: 1

- name: Checkout ELD
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ env.ELD_REPO }}
ref: ${{ env.ELD_REF }}
path: llvm-project/llvm/tools/eld
fetch-depth: 0

- name: Check for non-doc changes
id: file-check
if: github.event_name == 'pull_request'
uses: ./llvm-project/llvm/tools/eld/.github/workflows/CheckNonDocChanges
with:
base-branch: ${{ env.BASE_BRANCH_NAME }}
base-sha: ${{ github.event.pull_request.base.sha }}

- name: Restore ccache
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0
with:
path: ${{ github.workspace }}/obj/ccache
key: macos-eld-ccache-${{ runner.arch }}-${{ github.run_id }}
restore-keys: |
macos-eld-ccache-${{ runner.arch }}-

- name: Configure CMake
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
working-directory: ${{ github.workspace }}
run: |
set -euo pipefail
test -f llvm-project/cmake/Modules/CMakePolicy.cmake
test -d llvm-project/clang
test -d llvm-project/third-party/unittest
test -d llvm-project/llvm/tools/eld
mkdir -p "$CCACHE_DIR" obj
ccache --zero-stats || true
cmake -G Ninja -S llvm-project/llvm -B obj \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON \
-DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_ENABLE_ASSERTIONS:BOOL=ON \
-DLLVM_ENABLE_LLD:BOOL=OFF \
-DLLVM_TARGETS_TO_BUILD="ARM;AArch64;RISCV;Hexagon;X86" \
-DELD_TARGETS_TO_BUILD='ARM;AArch64;RISCV;Hexagon;X86;Template' \
-DCMAKE_C_COMPILER="$(xcrun --find clang)" \
-DCMAKE_CXX_COMPILER="$(xcrun --find clang++)" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DLLVM_PARALLEL_LINK_JOBS=1 \
-DLLVM_CCACHE_BUILD:BOOL=ON \
-DLLVM_CCACHE_DIR:STRING="$CCACHE_DIR" \
-DELD_ENABLE_SYMBOL_VERSIONING=ON

- name: Build
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
working-directory: ${{ github.workspace }}/obj
# Full tree so lit finds opt and other LLVM tools. `ninja ld.eld clang`
# leaves those missing, and the set of tools tests need can grow.
run: ninja

- name: Cache usage after build
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
run: ccache --show-stats --dir="$CCACHE_DIR" || true

- name: Run tests
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
working-directory: ${{ github.workspace }}/obj
run: ninja check-eld

- name: Summarize test results
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
working-directory: ${{ github.workspace }}/obj
run: ninja check-eld-summary

- name: Prune ccache before save
if: always() && (github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false')
run: ccache --evict-older-than 7200s --dir="$CCACHE_DIR" || true

- name: Save ccache
if: always() && (github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false')
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0
with:
path: ${{ github.workspace }}/obj/ccache
key: macos-eld-ccache-${{ runner.arch }}-${{ github.run_id }}

- name: Clean up
if: always()
run: rm -rf llvm-project obj
13 changes: 13 additions & 0 deletions .github/workflows/ci-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ jobs:
path: nightly/llvm-project/llvm/tools/eld
fetch-depth: 0

- name: Check for non-doc changes
id: file-check
if: github.event_name == 'pull_request'
uses: ./nightly/llvm-project/llvm/tools/eld/.github/workflows/CheckNonDocChanges
with:
base-branch: ${{ env.BASE_BRANCH_NAME }}
base-sha: ${{ github.event.pull_request.base.sha }}

- name: Record pre-build entry
if: github.event_name == 'schedule'
uses: ./nightly/llvm-project/llvm/tools/eld/.github/workflows/BuildStatusDataRecorder
Expand All @@ -80,6 +88,7 @@ jobs:
branch-name: "${{ env.ELD_REF }}"

- name: Configure CMake
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
working-directory: nightly
shell: bash
run: |
Expand All @@ -95,22 +104,26 @@ jobs:
../llvm-project/llvm

- name: Build
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
working-directory: nightly/obj
shell: bash
run: cmake --build . --config Release

- name: Install PyYAML
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
shell: bash
run: |
echo "Installing dependencies using $(python --version) at $(which python)"
python -m pip install pyyaml psutil

- name: Run tests
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
working-directory: nightly/obj
shell: bash
run: cmake --build . --config Release --target check-eld

- name: Summarize test results
if: github.event_name != 'pull_request' || steps.file-check.outputs.skip_build == 'false'
working-directory: nightly/obj
shell: bash
run: cmake --build . --config Release --target check-eld-summary
Expand Down
31 changes: 14 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- '.github/workflows/docs.yaml'
- '.github/workflows/docs-multiversion.yaml'
- '.github/workflows/ci-win.yml'
- '.github/workflows/ci-macos.yml'
- '.github/workflows/clang-cross-schedule.yml'
- '.github/workflows/DownloadClangCrossToolchain/action.yaml'
- '.github/workflows/DownloadLatestBusybox/action.yaml'
Expand Down Expand Up @@ -74,24 +75,20 @@ jobs:
- name: Setup musl environment
run: echo "/opt/musl/bin" >> $GITHUB_PATH

# uses: cannot contain ${{ github.* }} or ${{ env.* }}; stage a static path.
- name: Stage CheckNonDocChanges
run: |
rm -rf CheckNonDocChanges
cp -R "pr-${PR_NUMBER}/llvm-project/llvm/tools/eld/.github/workflows/CheckNonDocChanges" \
CheckNonDocChanges

- name: Check for non-doc changes
id: file-check
working-directory: pr-${{ env.PR_NUMBER }}/llvm-project/llvm/tools/eld
run: |
# We need to use base branch from qualcomm/eld
git remote add QC https://github.com/qualcomm/eld.git
git fetch QC ${{ env.BASE_BRANCH_NAME }} --depth=1
MERGE_BASE=$(git merge-base QC/${{ env.BASE_BRANCH_NAME }} HEAD)
CHANGED_FILES=$(git diff --name-only "$MERGE_BASE" HEAD)
echo "Changed files: $CHANGED_FILES"
for file in $CHANGED_FILES; do
if [[ ! "$file" =~ ^docs/ && ! "$file" =~ \.md$ ]]; then
echo "skip_build=false" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "Only docs changed. Skipping build."
echo "skip_build=true" >> "$GITHUB_OUTPUT"
uses: ./CheckNonDocChanges
with:
base-branch: ${{ env.BASE_BRANCH_NAME }}
base-sha: ${{ github.event.pull_request.base.sha }}
eld-root: ${{ github.workspace }}/pr-${{ env.PR_NUMBER }}/llvm-project/llvm/tools/eld

- name: Run CMake
if: steps.file-check.outputs.skip_build == 'false'
Expand Down Expand Up @@ -216,4 +213,4 @@ jobs:
- name: Clean up
if: always()
run: |
rm -rf "pr-${PR_NUMBER}"
rm -rf "pr-${PR_NUMBER}" CheckNonDocChanges
Loading
Loading