Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04af0e51f8 | ||
|
|
7a37222fd3 | ||
|
|
8e49d7b9e9 | ||
|
|
98e258d50c | ||
|
|
cb190d3d99 | ||
|
|
2baf947bff | ||
|
|
a17b3f6b7b |
@@ -1,40 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ""
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ""
|
||||
labels: ""
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -1,20 +0,0 @@
|
||||
name: "Setup Pixi"
|
||||
description: "setup pixi"
|
||||
|
||||
inputs:
|
||||
environments:
|
||||
description: "The pixi environments to install (e.g. default, docs, test)"
|
||||
required: false
|
||||
default: "default"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup Pixi
|
||||
uses: prefix-dev/setup-pixi@v0.9.3
|
||||
with:
|
||||
pixi-version: v0.67.0
|
||||
environments: ${{ inputs.environments }}
|
||||
activate-environment: true
|
||||
cache: true
|
||||
locked: true
|
||||
@@ -1,44 +0,0 @@
|
||||
name: benchmark
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
benchmark:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-24.04, macos-15, windows-2025]
|
||||
runs-on: ${{ matrix.os }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
|
||||
- name: Build scan_benchmark
|
||||
run: |
|
||||
pixi run cmake-config RelWithDebInfo ON -- -DCLICE_ENABLE_BENCHMARK=ON
|
||||
cmake --build build/RelWithDebInfo --target scan_benchmark
|
||||
|
||||
- name: Clone LLVM
|
||||
run: git clone --depth 1 https://github.com/llvm/llvm-project.git
|
||||
|
||||
- name: Generate CDB
|
||||
run: |
|
||||
cmake -B llvm-build -G Ninja \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$(pwd)/cmake/toolchain.cmake" \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb;mlir;polly;flang;bolt" \
|
||||
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
|
||||
llvm-project/llvm
|
||||
|
||||
- name: Run benchmark
|
||||
run: ./build/RelWithDebInfo/bin/scan_benchmark --runs 20 llvm-build/compile_commands.json
|
||||
|
||||
- name: Stop sccache server
|
||||
if: runner.os == 'Windows'
|
||||
run: pixi run -- sccache --stop-server || true
|
||||
@@ -1,446 +0,0 @@
|
||||
name: build llvm
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
llvm_version:
|
||||
description: "LLVM version to build (e.g., 21.1.8)"
|
||||
required: true
|
||||
type: string
|
||||
skip_upload:
|
||||
description: "Skip upload and PR creation (build-only mode)"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
skip_pr:
|
||||
description: "Skip PR creation (upload only, no PR)"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
pull_request:
|
||||
# if you want to run this workflow, change the branch name to main,
|
||||
# if you want to turn off it, change it to non existent branch.
|
||||
branches: [main-turn-off]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Native builds
|
||||
- os: windows-2025
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
- os: windows-2025
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: Debug
|
||||
lto: OFF
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
- os: macos-15
|
||||
llvm_mode: Debug
|
||||
lto: OFF
|
||||
- os: macos-15
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
- os: macos-15
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
|
||||
# Cross-compilation builds
|
||||
# macOS x64 (from arm64 macos-15)
|
||||
- os: macos-15
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
target_triple: x86_64-apple-darwin
|
||||
- os: macos-15
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
target_triple: x86_64-apple-darwin
|
||||
|
||||
# Linux aarch64 (from x64 ubuntu-24.04)
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
target_triple: aarch64-linux-gnu
|
||||
pixi_env: cross-linux-aarch64
|
||||
- os: ubuntu-24.04
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
target_triple: aarch64-linux-gnu
|
||||
pixi_env: cross-linux-aarch64
|
||||
|
||||
# Windows arm64 (from x64 windows-2025)
|
||||
- os: windows-2025
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: OFF
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
pixi_env: cross-windows-arm64
|
||||
- os: windows-2025
|
||||
llvm_mode: RelWithDebInfo
|
||||
lto: ON
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
pixi_env: cross-windows-arm64
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Free Disk Space
|
||||
if: runner.os == 'Linux'
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
|
||||
- name: Increase Swap Space
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
echo "===== Initial Status ====="
|
||||
sudo swapon --show
|
||||
free -h
|
||||
|
||||
echo "===== Creating Swap File ====="
|
||||
sudo swapoff -a
|
||||
sudo fallocate -l 16G /mnt/swapfile
|
||||
sudo chmod 600 /mnt/swapfile
|
||||
sudo mkswap /mnt/swapfile
|
||||
sudo swapon /mnt/swapfile
|
||||
|
||||
echo "===== Final Status ====="
|
||||
sudo swapon --show
|
||||
free -h
|
||||
df -h
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: ${{ matrix.pixi_env || 'package' }}
|
||||
|
||||
- name: Clone llvm-project
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION="${{ inputs.llvm_version || '21.1.8' }}"
|
||||
echo "Cloning LLVM ${VERSION}..."
|
||||
git clone --branch "llvmorg-${VERSION}" --depth 1 https://github.com/llvm/llvm-project.git .llvm
|
||||
|
||||
- name: Validate distribution components
|
||||
shell: bash
|
||||
run: |
|
||||
python3 scripts/validate-llvm-components.py \
|
||||
--llvm-src=.llvm \
|
||||
--components-file=scripts/llvm-components.json
|
||||
|
||||
- name: Build LLVM (install-distribution)
|
||||
shell: bash
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'package' }}"
|
||||
EXTRA_ARGS=""
|
||||
if [[ -n "${{ matrix.target_triple }}" ]]; then
|
||||
EXTRA_ARGS="--target-triple=${{ matrix.target_triple }}"
|
||||
fi
|
||||
pixi run -e "$ENV" build-llvm \
|
||||
--llvm-src=.llvm \
|
||||
--mode="${{ matrix.llvm_mode }}" \
|
||||
--lto="${{ matrix.lto }}" \
|
||||
--build-dir=build \
|
||||
${EXTRA_ARGS}
|
||||
|
||||
- name: Build clice using installed LLVM
|
||||
if: ${{ !matrix.target_triple }}
|
||||
shell: bash
|
||||
run: |
|
||||
pixi run cmake-config ${{ matrix.llvm_mode }} ON -- \
|
||||
"-DCLICE_ENABLE_LTO=${{ matrix.lto }}" \
|
||||
"-DLLVM_INSTALL_PATH=.llvm/build-install"
|
||||
pixi run cmake-build ${{ matrix.llvm_mode }}
|
||||
|
||||
- name: Build clice using installed LLVM (cross-compile)
|
||||
if: ${{ matrix.target_triple }}
|
||||
shell: bash
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'package' }}"
|
||||
pixi run -e "$ENV" cmake-config ${{ matrix.llvm_mode }} ON -- \
|
||||
"-DCLICE_ENABLE_LTO=${{ matrix.lto }}" \
|
||||
"-DCLICE_TARGET_TRIPLE=${{ matrix.target_triple }}" \
|
||||
"-DLLVM_INSTALL_PATH=.llvm/build-install"
|
||||
pixi run -e "$ENV" cmake-build ${{ matrix.llvm_mode }}
|
||||
|
||||
- name: Verify cross-compiled binary architecture
|
||||
if: ${{ matrix.target_triple && runner.os != 'Windows' }}
|
||||
shell: bash
|
||||
run: |
|
||||
BINARY="build/${{ matrix.llvm_mode }}/bin/clice"
|
||||
echo "Binary info:"
|
||||
file "$BINARY"
|
||||
case "${{ matrix.target_triple }}" in
|
||||
aarch64-linux-gnu) file "$BINARY" | grep -q "aarch64" ;;
|
||||
x86_64-apple-darwin) file "$BINARY" | grep -q "x86_64" ;;
|
||||
esac
|
||||
|
||||
- name: Upload cross-compiled clice for functional test
|
||||
if: ${{ matrix.target_triple && matrix.lto == 'OFF' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cross-clice-${{ matrix.target_triple }}-${{ matrix.llvm_mode }}
|
||||
path: |
|
||||
build/${{ matrix.llvm_mode }}/bin/
|
||||
build/${{ matrix.llvm_mode }}/lib/
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
- name: Run tests
|
||||
if: ${{ !matrix.target_triple }}
|
||||
shell: bash
|
||||
run: pixi run test ${{ matrix.llvm_mode }}
|
||||
|
||||
# Prune is only supported for native builds (requires linking clice to test).
|
||||
# Cross-compiled targets reuse the native prune manifest of the same OS.
|
||||
- name: Prune LLVM static libraries (Debug/RelWithDebInfo no LTO)
|
||||
if: (!matrix.target_triple) && (matrix.llvm_mode == 'Debug' || (matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'))
|
||||
shell: bash
|
||||
run: |
|
||||
MANIFEST="pruned-libs-${{ matrix.os }}.json"
|
||||
echo "LLVM_PRUNED_MANIFEST=${MANIFEST}" >> "${GITHUB_ENV}"
|
||||
python3 scripts/prune-llvm-bin.py \
|
||||
--action discover \
|
||||
--install-dir ".llvm/build-install/lib" \
|
||||
--build-dir "build/${{ matrix.llvm_mode }}" \
|
||||
--max-attempts 60 \
|
||||
--sleep-seconds 60 \
|
||||
--manifest "${MANIFEST}"
|
||||
|
||||
- name: Upload pruned-libs manifest
|
||||
if: (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: llvm-pruned-libs-${{ matrix.os }}
|
||||
path: ${{ env.LLVM_PRUNED_MANIFEST }}
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
|
||||
- name: Apply pruned-libs manifest (RelWithDebInfo + LTO, native only)
|
||||
if: (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'ON'
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
MANIFEST="pruned-libs-${{ matrix.os }}.json"
|
||||
python3 scripts/prune-llvm-bin.py \
|
||||
--action apply \
|
||||
--manifest "${MANIFEST}" \
|
||||
--install-dir ".llvm/build-install/lib" \
|
||||
--build-dir "build/${{ matrix.llvm_mode }}" \
|
||||
--gh-run-id "${{ github.run_id }}" \
|
||||
--gh-artifact "llvm-pruned-libs-${{ matrix.os }}" \
|
||||
--gh-download-dir "artifacts" \
|
||||
--max-attempts 60 \
|
||||
--sleep-seconds 60
|
||||
|
||||
# For cross-compiled LTO builds, apply the native prune manifest.
|
||||
# The unused library set is arch-independent (same API surface).
|
||||
- name: Apply pruned-libs manifest (cross-compile + LTO)
|
||||
if: matrix.target_triple && matrix.lto == 'ON'
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
MANIFEST="pruned-libs-${{ matrix.os }}.json"
|
||||
python3 scripts/prune-llvm-bin.py \
|
||||
--action apply \
|
||||
--manifest "${MANIFEST}" \
|
||||
--install-dir ".llvm/build-install/lib" \
|
||||
--build-dir "build/${{ matrix.llvm_mode }}" \
|
||||
--gh-run-id "${{ github.run_id }}" \
|
||||
--gh-artifact "llvm-pruned-libs-${{ matrix.os }}" \
|
||||
--gh-download-dir "artifacts" \
|
||||
--max-attempts 60 \
|
||||
--sleep-seconds 60
|
||||
|
||||
- name: Package LLVM install directory
|
||||
shell: bash
|
||||
run: |
|
||||
MODE_TAG="releasedbg"
|
||||
if [[ "${{ matrix.llvm_mode }}" == "Debug" ]]; then
|
||||
MODE_TAG="debug"
|
||||
fi
|
||||
|
||||
# Determine arch/platform/toolchain from target triple or runner OS
|
||||
if [[ -n "${{ matrix.target_triple }}" ]]; then
|
||||
case "${{ matrix.target_triple }}" in
|
||||
x86_64-apple-darwin)
|
||||
ARCH="x64"; PLATFORM="macos"; TOOLCHAIN="clang" ;;
|
||||
aarch64-linux-gnu)
|
||||
ARCH="aarch64"; PLATFORM="linux"; TOOLCHAIN="gnu" ;;
|
||||
aarch64-pc-windows-msvc)
|
||||
ARCH="aarch64"; PLATFORM="windows"; TOOLCHAIN="msvc" ;;
|
||||
esac
|
||||
else
|
||||
ARCH="x64"
|
||||
PLATFORM="linux"
|
||||
TOOLCHAIN="gnu"
|
||||
if [[ "${{ matrix.os }}" == windows-* ]]; then
|
||||
PLATFORM="windows"
|
||||
TOOLCHAIN="msvc"
|
||||
elif [[ "${{ matrix.os }}" == macos-* ]]; then
|
||||
ARCH="arm64"
|
||||
PLATFORM="macos"
|
||||
TOOLCHAIN="clang"
|
||||
fi
|
||||
fi
|
||||
|
||||
SUFFIX=""
|
||||
if [[ "${{ matrix.lto }}" == "ON" ]]; then
|
||||
SUFFIX="-lto"
|
||||
fi
|
||||
if [[ "${{ matrix.llvm_mode }}" == "Debug" && "${{ matrix.os }}" != windows-* ]]; then
|
||||
SUFFIX="${SUFFIX}-asan"
|
||||
fi
|
||||
|
||||
ARCHIVE="${ARCH}-${PLATFORM}-${TOOLCHAIN}-${MODE_TAG}${SUFFIX}.tar.xz"
|
||||
|
||||
set -eo pipefail
|
||||
tar -C .llvm -cf - build-install | xz -T0 -9 -c > "${ARCHIVE}"
|
||||
echo "LLVM_INSTALL_ARCHIVE=${ARCHIVE}" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Upload LLVM install artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.LLVM_INSTALL_ARCHIVE }}
|
||||
path: ${{ env.LLVM_INSTALL_ARCHIVE }}
|
||||
if-no-files-found: error
|
||||
|
||||
test-cross:
|
||||
needs: build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: macos-15-intel
|
||||
llvm_mode: RelWithDebInfo
|
||||
target_triple: x86_64-apple-darwin
|
||||
- os: ubuntu-24.04-arm
|
||||
llvm_mode: RelWithDebInfo
|
||||
target_triple: aarch64-linux-gnu
|
||||
- os: windows-11-arm
|
||||
llvm_mode: RelWithDebInfo
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: test-run
|
||||
|
||||
- name: Download cross-compiled clice
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cross-clice-${{ matrix.target_triple }}-${{ matrix.llvm_mode }}
|
||||
path: build/${{ matrix.llvm_mode }}/
|
||||
|
||||
- name: Make binaries executable
|
||||
if: runner.os != 'Windows'
|
||||
run: chmod +x build/${{ matrix.llvm_mode }}/bin/*
|
||||
|
||||
- name: Run tests
|
||||
run: pixi run -e test-run test ${{ matrix.llvm_mode }}
|
||||
|
||||
upload:
|
||||
needs: build
|
||||
if: ${{ !cancelled() && inputs.llvm_version && !inputs.skip_upload }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download all build artifacts
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: scripts/download-llvm.sh "${{ github.run_id }}"
|
||||
|
||||
- name: Upload to clice-llvm
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.UPLOAD_LLVM }}
|
||||
TARGET_REPO: clice-io/clice-llvm
|
||||
run: python3 scripts/upload-llvm.py "${{ inputs.llvm_version }}" "${TARGET_REPO}" "${{ github.run_id }}"
|
||||
|
||||
- name: Save manifest for update-clice job
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: llvm-manifest-final
|
||||
path: artifacts/llvm-manifest.json
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
|
||||
update-clice:
|
||||
needs: upload
|
||||
if: ${{ !inputs.skip_pr }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download manifest
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: llvm-manifest-final
|
||||
path: .
|
||||
|
||||
- name: Update manifest and version
|
||||
run: |
|
||||
python3 scripts/update-llvm-version.py \
|
||||
--version "${{ inputs.llvm_version }}" \
|
||||
--manifest-src llvm-manifest.json \
|
||||
--manifest-dest config/llvm-manifest.json \
|
||||
--package-cmake cmake/package.cmake
|
||||
|
||||
- name: Create or update PR
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
VERSION="${{ inputs.llvm_version }}"
|
||||
BRANCH="chore/update-llvm-${VERSION}"
|
||||
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
RELEASE_URL="https://github.com/clice-io/clice-llvm/releases/tag/${VERSION}"
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git checkout -b "${BRANCH}"
|
||||
git add config/llvm-manifest.json cmake/package.cmake
|
||||
git commit -m "chore: update LLVM to ${VERSION}"
|
||||
git push --force-with-lease origin "${BRANCH}"
|
||||
|
||||
# Check if PR already exists for this branch
|
||||
EXISTING_PR=$(gh pr list --head "${BRANCH}" --json number --jq '.[0].number // empty')
|
||||
|
||||
BODY="$(cat <<EOF
|
||||
## Summary
|
||||
- Update LLVM prebuilt binaries to version ${VERSION}
|
||||
- Updated \`config/llvm-manifest.json\` with new SHA256 hashes
|
||||
- Updated \`cmake/package.cmake\` version string
|
||||
|
||||
**Artifacts:** [clice-llvm release](${RELEASE_URL})
|
||||
**Build:** [workflow run](${RUN_URL})
|
||||
|
||||
> Auto-generated by build-llvm workflow
|
||||
EOF
|
||||
)"
|
||||
|
||||
if [[ -n "${EXISTING_PR}" ]]; then
|
||||
echo "Updating existing PR #${EXISTING_PR}"
|
||||
gh pr edit "${EXISTING_PR}" --body "${BODY}"
|
||||
else
|
||||
gh pr create \
|
||||
--title "chore: update LLVM to ${VERSION}" \
|
||||
--body "${BODY}" \
|
||||
--base main
|
||||
fi
|
||||
@@ -1,40 +0,0 @@
|
||||
name: format
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
check-format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: format
|
||||
|
||||
- name: Validate update-llvm-version.py can still patch package.cmake
|
||||
run: |
|
||||
python3 scripts/update-llvm-version.py --check \
|
||||
--manifest-dest config/llvm-manifest.json \
|
||||
--package-cmake cmake/package.cmake
|
||||
|
||||
- name: Run formatter
|
||||
run: pixi run format
|
||||
continue-on-error: true
|
||||
|
||||
- name: Auto correct
|
||||
uses: huacnlee/autocorrect-action@v2
|
||||
with:
|
||||
args: --lint ./docs
|
||||
continue-on-error: true
|
||||
|
||||
- name: Check diff
|
||||
run: |
|
||||
if ! git diff --quiet; then
|
||||
echo "::error::Formatting changes detected. Please run 'pixi run format' and commit the result."
|
||||
git --no-pager diff --stat
|
||||
git --no-pager diff
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,30 +0,0 @@
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
deploy-docs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: node
|
||||
|
||||
- name: Build docs
|
||||
run: pixi run build-docs
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v4
|
||||
if: github.ref == 'refs/heads/main'
|
||||
with:
|
||||
personal_token: ${{ secrets.PUBLISH_DOCS }}
|
||||
external_repository: clice-io/docs
|
||||
publish_dir: ./docs/.vitepress/dist
|
||||
destination_dir: clice
|
||||
keep_files: true
|
||||
@@ -1,137 +0,0 @@
|
||||
name: main
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
format: ${{ steps.filter.outputs.format }}
|
||||
docs: ${{ steps.filter.outputs.docs }}
|
||||
clice: ${{ steps.filter.outputs.clice }}
|
||||
vscode: ${{ steps.filter.outputs.vscode }}
|
||||
cmake: ${{ steps.filter.outputs.cmake }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
format:
|
||||
- '**/*.{h,c,cpp,hpp,ts,js,lua,md,yml,yaml}'
|
||||
docs:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/deploy-docs.yml'
|
||||
clice:
|
||||
- 'src/**'
|
||||
- 'include/**'
|
||||
- 'CMakeLists.txt'
|
||||
- '.github/workflows/publish-clice.yml'
|
||||
vscode:
|
||||
- 'editors/vscode/**'
|
||||
- '.github/workflows/publish-vscode.yml'
|
||||
cmake:
|
||||
- 'CMakeLists.txt'
|
||||
- 'src/**'
|
||||
- 'include/**'
|
||||
- 'tests/**'
|
||||
- 'config/**'
|
||||
- '.github/workflows/test-cmake.yml'
|
||||
|
||||
conventional-commit:
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check conventional commit format
|
||||
env:
|
||||
IS_PR: ${{ github.event_name == 'pull_request' }}
|
||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||
COMMIT_MSG: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
pattern='^(feat|fix|refactor|chore|build|ci|docs|test|perf|style|revert)(\(.+\))?: .+'
|
||||
if [[ "$IS_PR" == "true" ]]; then
|
||||
subject="$PR_TITLE"
|
||||
label="PR title"
|
||||
else
|
||||
subject=$(echo "$COMMIT_MSG" | head -n1)
|
||||
label="Commit message"
|
||||
fi
|
||||
if [[ ! "$subject" =~ $pattern ]]; then
|
||||
echo "::error::$label must follow conventional commit format: type(scope)?: description"
|
||||
echo " Valid types: feat, fix, refactor, chore, build, ci, docs, test, perf, style, revert"
|
||||
echo " Got: '$subject'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
format:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.format == 'true' }}
|
||||
uses: ./.github/workflows/check-format.yml
|
||||
|
||||
deploy:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.docs == 'true' }}
|
||||
permissions:
|
||||
contents: write
|
||||
uses: ./.github/workflows/deploy-docs.yml
|
||||
secrets: inherit
|
||||
|
||||
# clice:
|
||||
# needs: changes
|
||||
# if: ${{ needs.changes.outputs.clice == 'true' }}
|
||||
# uses: ./.github/workflows/publish-clice.yml
|
||||
|
||||
vscode:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.vscode == 'true' }}
|
||||
uses: ./.github/workflows/publish-vscode.yml
|
||||
|
||||
cmake:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.cmake == 'true' }}
|
||||
uses: ./.github/workflows/test-cmake.yml
|
||||
|
||||
release-clice:
|
||||
permissions:
|
||||
contents: write
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: ./.github/workflows/publish-clice.yml
|
||||
secrets: inherit
|
||||
|
||||
release-vscode:
|
||||
permissions:
|
||||
contents: write
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: ./.github/workflows/publish-vscode.yml
|
||||
secrets: inherit
|
||||
|
||||
checks-passed:
|
||||
if: ${{ always() && !startsWith(github.ref, 'refs/tags/') }}
|
||||
needs:
|
||||
- conventional-commit
|
||||
- format
|
||||
- deploy
|
||||
# - clice
|
||||
- vscode
|
||||
- cmake
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check results
|
||||
uses: re-actors/alls-green@release/v1
|
||||
with:
|
||||
allowed-skips: conventional-commit,format,deploy,clice,vscode,cmake
|
||||
jobs: ${{ toJSON(needs) }}
|
||||
@@ -1,100 +0,0 @@
|
||||
name: clice
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
publish-clice:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Native builds
|
||||
- os: windows-2025
|
||||
artifact_name: clice.zip
|
||||
asset_name: clice-x64-windows-msvc.zip
|
||||
symbol_artifact_name: clice-symbol.zip
|
||||
symbol_asset_name: clice-x64-windows-msvc-symbol.zip
|
||||
|
||||
- os: ubuntu-24.04
|
||||
artifact_name: clice.tar.gz
|
||||
asset_name: clice-x86_64-linux-gnu.tar.gz
|
||||
symbol_artifact_name: clice-symbol.tar.gz
|
||||
symbol_asset_name: clice-x86_64-linux-gnu-symbol.tar.gz
|
||||
|
||||
- os: macos-15
|
||||
artifact_name: clice.tar.gz
|
||||
asset_name: clice-arm64-macos-darwin.tar.gz
|
||||
symbol_artifact_name: clice-symbol.tar.gz
|
||||
symbol_asset_name: clice-arm64-macos-darwin-symbol.tar.gz
|
||||
|
||||
# Cross-compilation builds
|
||||
- os: macos-15
|
||||
target_triple: x86_64-apple-darwin
|
||||
pixi_env: cross-macos-x64
|
||||
artifact_name: clice.tar.gz
|
||||
asset_name: clice-x86_64-macos-darwin.tar.gz
|
||||
symbol_artifact_name: clice-symbol.tar.gz
|
||||
symbol_asset_name: clice-x86_64-macos-darwin-symbol.tar.gz
|
||||
|
||||
- os: ubuntu-24.04
|
||||
target_triple: aarch64-linux-gnu
|
||||
pixi_env: cross-linux-aarch64
|
||||
artifact_name: clice.tar.gz
|
||||
asset_name: clice-aarch64-linux-gnu.tar.gz
|
||||
symbol_artifact_name: clice-symbol.tar.gz
|
||||
symbol_asset_name: clice-aarch64-linux-gnu-symbol.tar.gz
|
||||
|
||||
- os: windows-2025
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
pixi_env: cross-windows-arm64
|
||||
artifact_name: clice.zip
|
||||
asset_name: clice-aarch64-windows-msvc.zip
|
||||
symbol_artifact_name: clice-symbol.zip
|
||||
symbol_asset_name: clice-aarch64-windows-msvc-symbol.zip
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: ${{ matrix.pixi_env || 'package' }}
|
||||
|
||||
- name: Package (native)
|
||||
if: ${{ !matrix.target_triple }}
|
||||
run: pixi run package
|
||||
|
||||
- name: Package (cross-compile)
|
||||
if: ${{ matrix.target_triple }}
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env }}"
|
||||
pixi run -e "$ENV" package-config -- \
|
||||
"-DCLICE_TARGET_TRIPLE=${{ matrix.target_triple }}"
|
||||
pixi run -e "$ENV" cmake-build
|
||||
|
||||
- name: Upload Main Package to Release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/RelWithDebInfo/${{ matrix.artifact_name }}
|
||||
asset_name: ${{ matrix.asset_name }}
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
|
||||
- name: Upload Symbol Package to Release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: build/RelWithDebInfo/${{ matrix.symbol_artifact_name }}
|
||||
asset_name: ${{ matrix.symbol_asset_name }}
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
@@ -1,38 +0,0 @@
|
||||
name: vscode
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
publish-vscode:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: editors/vscode
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: node
|
||||
|
||||
- name: Publish and Package to Marketplace
|
||||
env:
|
||||
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
||||
run: |
|
||||
FLAG="${{ contains(github.ref_name, '-') && '--pre-release' || '' }}"
|
||||
pixi run build-vscode $FLAG
|
||||
|
||||
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
|
||||
pixi run publish-vscode -p "$VSCE_PAT" $FLAG
|
||||
fi
|
||||
|
||||
- name: Upload .vsix to Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
with:
|
||||
files: "editors/vscode/*.vsix"
|
||||
tag_name: ${{ github.ref }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,170 +0,0 @@
|
||||
name: cmake
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.cache/ccache
|
||||
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
|
||||
CCACHE_BASEDIR: ${{ github.workspace }}
|
||||
SCCACHE_BASEDIRS: ${{ github.workspace }}
|
||||
CCACHE_COMPILERCHECK: content
|
||||
CCACHE_MAXSIZE: 2G
|
||||
SCCACHE_CACHE_SIZE: 2G
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# Native builds
|
||||
- os: windows-2025
|
||||
build_type: RelWithDebInfo
|
||||
- os: ubuntu-24.04
|
||||
build_type: Debug
|
||||
- os: ubuntu-24.04
|
||||
build_type: RelWithDebInfo
|
||||
- os: macos-15
|
||||
build_type: Debug
|
||||
- os: macos-15
|
||||
build_type: RelWithDebInfo
|
||||
# Cross-compile (build only; tests run on native runners)
|
||||
- os: macos-15
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: x86_64-apple-darwin
|
||||
build_only: true
|
||||
- os: ubuntu-24.04
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: aarch64-linux-gnu
|
||||
build_only: true
|
||||
pixi_env: cross-linux-aarch64
|
||||
- os: windows-2025
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
build_only: true
|
||||
pixi_env: cross-windows-arm64
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: ${{ matrix.pixi_env || 'default' }}
|
||||
|
||||
- name: Restore compiler cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ runner.os == 'Windows' && '.cache/sccache' || '.cache/ccache' }}
|
||||
key: ${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.target_triple || 'native' }}-ccache-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.target_triple || 'native' }}-ccache-
|
||||
|
||||
- name: Zero cache stats
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'default' }}"
|
||||
if [ "$RUNNER_OS" = "Windows" ]; then
|
||||
pixi run -e "$ENV" -- sccache --stop-server || true
|
||||
pixi run -e "$ENV" -- sccache --zero-stats || true
|
||||
else
|
||||
pixi run -e "$ENV" -- ccache --zero-stats || true
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Build (native)
|
||||
if: ${{ !matrix.target_triple }}
|
||||
run: pixi run build ${{ matrix.build_type }} ON
|
||||
|
||||
- name: Build (cross-compile)
|
||||
if: ${{ matrix.target_triple }}
|
||||
shell: bash
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'default' }}"
|
||||
pixi run -e "$ENV" cmake-config ${{ matrix.build_type }} OFF -- \
|
||||
"-DCLICE_TARGET_TRIPLE=${{ matrix.target_triple }}"
|
||||
pixi run -e "$ENV" cmake-build ${{ matrix.build_type }}
|
||||
|
||||
- name: Upload cross-compiled binaries
|
||||
if: ${{ matrix.build_only }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cross-build-${{ matrix.target_triple }}
|
||||
path: |
|
||||
build/${{ matrix.build_type }}/bin/
|
||||
build/${{ matrix.build_type }}/lib/
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
- name: Unit tests
|
||||
if: ${{ !matrix.build_only }}
|
||||
timeout-minutes: 5
|
||||
run: pixi run unit-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Integration tests
|
||||
if: ${{ !matrix.build_only }}
|
||||
timeout-minutes: 20
|
||||
run: pixi run integration-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Smoke tests
|
||||
if: ${{ !matrix.build_only }}
|
||||
timeout-minutes: 15
|
||||
run: pixi run smoke-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Print cache stats and stop server
|
||||
if: always()
|
||||
run: |
|
||||
ENV="${{ matrix.pixi_env || 'default' }}"
|
||||
if [ "$RUNNER_OS" = "Windows" ]; then
|
||||
pixi run -e "$ENV" -- sccache --show-stats
|
||||
pixi run -e "$ENV" -- sccache --stop-server || true
|
||||
else
|
||||
pixi run -e "$ENV" -- ccache --show-stats
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test-cross:
|
||||
needs: build
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: macos-15-intel
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: x86_64-apple-darwin
|
||||
- os: ubuntu-24.04-arm
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: aarch64-linux-gnu
|
||||
- os: windows-11-arm
|
||||
build_type: RelWithDebInfo
|
||||
target_triple: aarch64-pc-windows-msvc
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: ./.github/actions/setup-pixi
|
||||
with:
|
||||
environments: test-run
|
||||
|
||||
- name: Download cross-compiled binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: cross-build-${{ matrix.target_triple }}
|
||||
path: build/${{ matrix.build_type }}/
|
||||
|
||||
- name: Make binaries executable
|
||||
if: runner.os != 'Windows'
|
||||
run: chmod +x build/${{ matrix.build_type }}/bin/*
|
||||
|
||||
- name: Unit tests
|
||||
timeout-minutes: 5
|
||||
run: pixi run -e test-run unit-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Integration tests
|
||||
timeout-minutes: 20
|
||||
run: pixi run -e test-run integration-test ${{ matrix.build_type }}
|
||||
|
||||
- name: Smoke tests
|
||||
timeout-minutes: 10
|
||||
run: pixi run -e test-run smoke-test ${{ matrix.build_type }}
|
||||
@@ -1,38 +0,0 @@
|
||||
name: upload-llvm
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# if you want to run this workflow, change the branch name to main,
|
||||
# if you want to turn off it, change it to non existent branch.
|
||||
branches: [main-turn-off]
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
workflow_id:
|
||||
description: "Workflow run ID to pull artifacts from"
|
||||
required: true
|
||||
type: string
|
||||
version:
|
||||
description: "Release version/tag to publish (e.g., v1.2.3)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download artifacts from workflow
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: scripts/download-llvm.sh "${{ inputs.workflow_id }}"
|
||||
|
||||
- name: Recreate release with artifacts
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.UPLOAD_LLVM }}
|
||||
TARGET_REPO: clice-io/clice-llvm
|
||||
run: python3 scripts/upload-llvm.py "${{ inputs.version }}" "${TARGET_REPO}" "${{ inputs.workflow_id }}"
|
||||
@@ -124,8 +124,31 @@ if(CLICE_CI_ENVIRONMENT)
|
||||
target_compile_definitions(clice_options INTERFACE CLICE_CI_ENVIRONMENT=1)
|
||||
endif()
|
||||
|
||||
set(CLICE_CLANG_TIDY_MODULE_LIBRARIES)
|
||||
set(CLICE_MISSING_CLANG_TIDY_MODULES)
|
||||
foreach(module IN LISTS CLICE_CLANG_TIDY_MODULE_COMPONENTS)
|
||||
find_library(CLICE_${module}_LIBRARY
|
||||
NAMES "${module}"
|
||||
PATHS "${LLVM_INSTALL_PATH}/lib"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if(CLICE_${module}_LIBRARY)
|
||||
list(APPEND CLICE_CLANG_TIDY_MODULE_LIBRARIES "${CLICE_${module}_LIBRARY}")
|
||||
else()
|
||||
list(APPEND CLICE_MISSING_CLANG_TIDY_MODULES "${module}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(CLICE_MISSING_CLANG_TIDY_MODULES)
|
||||
message(STATUS "Clang-tidy module libraries not available: ${CLICE_MISSING_CLANG_TIDY_MODULES}")
|
||||
else()
|
||||
target_compile_definitions(clice_options INTERFACE CLICE_HAS_CLANG_TIDY_MODULES=1)
|
||||
endif()
|
||||
|
||||
set(FBS_SCHEMA_FILE "${PROJECT_SOURCE_DIR}/src/index/schema.fbs")
|
||||
set(GENERATED_HEADER "${PROJECT_BINARY_DIR}/generated/schema_generated.h")
|
||||
set(CLANG_TIDY_CONFIG_SOURCE_FILE "${PROJECT_SOURCE_DIR}/config/clang-tidy-config.h")
|
||||
set(CLANG_TIDY_CONFIG_GENERATED_FILE "${PROJECT_BINARY_DIR}/generated/clang-tidy-config.h")
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
find_program(FLATC_EXECUTABLE flatc REQUIRED)
|
||||
@@ -143,10 +166,21 @@ add_custom_command(
|
||||
|
||||
add_custom_target(generate_flatbuffers_schema DEPENDS "${GENERATED_HEADER}")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${CLANG_TIDY_CONFIG_GENERATED_FILE}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${CLANG_TIDY_CONFIG_SOURCE_FILE}"
|
||||
"${CLANG_TIDY_CONFIG_GENERATED_FILE}"
|
||||
DEPENDS "${CLANG_TIDY_CONFIG_SOURCE_FILE}"
|
||||
COMMENT "Generating C++ header from ${CLANG_TIDY_CONFIG_SOURCE_FILE}"
|
||||
)
|
||||
|
||||
add_custom_target(generate_clang_tidy_config DEPENDS "${CLANG_TIDY_CONFIG_GENERATED_FILE}")
|
||||
|
||||
file(GLOB_RECURSE CLICE_CORE_SOURCES CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.cpp")
|
||||
add_library(clice-core STATIC ${CLICE_CORE_SOURCES})
|
||||
add_library(clice::core ALIAS clice-core)
|
||||
add_dependencies(clice-core generate_flatbuffers_schema)
|
||||
add_dependencies(clice-core generate_flatbuffers_schema generate_clang_tidy_config)
|
||||
|
||||
target_include_directories(clice-core PUBLIC
|
||||
"${PROJECT_SOURCE_DIR}/src"
|
||||
@@ -162,6 +196,9 @@ target_link_libraries(clice-core PUBLIC
|
||||
kota::codec::toml
|
||||
simdjson::simdjson
|
||||
)
|
||||
if(CLICE_CLANG_TIDY_MODULE_LIBRARIES)
|
||||
target_link_libraries(clice-core PUBLIC ${CLICE_CLANG_TIDY_MODULE_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_executable(clice "${PROJECT_SOURCE_DIR}/src/clice.cc")
|
||||
target_link_libraries(clice PRIVATE clice::core kota::deco)
|
||||
|
||||
@@ -1,5 +1,34 @@
|
||||
include_guard()
|
||||
|
||||
set(CLICE_CLANG_TIDY_MODULE_COMPONENTS
|
||||
# Keep this in sync with scripts/llvm-components.json and the old
|
||||
# ALL_CLANG_TIDY_CHECKS list. MPIModule is intentionally excluded because
|
||||
# clice disables static analyzer checks in ClangTidyForceLinker.h.
|
||||
clangTidyAndroidModule
|
||||
clangTidyAbseilModule
|
||||
clangTidyAlteraModule
|
||||
clangTidyBoostModule
|
||||
clangTidyBugproneModule
|
||||
clangTidyCERTModule
|
||||
clangTidyConcurrencyModule
|
||||
clangTidyCppCoreGuidelinesModule
|
||||
clangTidyDarwinModule
|
||||
clangTidyFuchsiaModule
|
||||
clangTidyGoogleModule
|
||||
clangTidyHICPPModule
|
||||
clangTidyLinuxKernelModule
|
||||
clangTidyLLVMModule
|
||||
clangTidyLLVMLibcModule
|
||||
clangTidyMiscModule
|
||||
clangTidyModernizeModule
|
||||
clangTidyObjCModule
|
||||
clangTidyOpenMPModule
|
||||
clangTidyPerformanceModule
|
||||
clangTidyPortabilityModule
|
||||
clangTidyReadabilityModule
|
||||
clangTidyZirconModule
|
||||
)
|
||||
|
||||
function(setup_llvm LLVM_VERSION)
|
||||
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
||||
|
||||
@@ -87,29 +116,6 @@ function(setup_llvm LLVM_VERSION)
|
||||
clangSerialization
|
||||
clangTidy
|
||||
clangTidyUtils
|
||||
clangTidyAndroidModule
|
||||
clangTidyAbseilModule
|
||||
clangTidyAlteraModule
|
||||
clangTidyBoostModule
|
||||
clangTidyBugproneModule
|
||||
clangTidyCERTModule
|
||||
clangTidyConcurrencyModule
|
||||
clangTidyCppCoreGuidelinesModule
|
||||
clangTidyDarwinModule
|
||||
clangTidyFuchsiaModule
|
||||
clangTidyGoogleModule
|
||||
clangTidyHICPPModule
|
||||
clangTidyLinuxKernelModule
|
||||
clangTidyLLVMModule
|
||||
clangTidyLLVMLibcModule
|
||||
clangTidyMiscModule
|
||||
clangTidyModernizeModule
|
||||
clangTidyObjCModule
|
||||
clangTidyOpenMPModule
|
||||
clangTidyPerformanceModule
|
||||
clangTidyPortabilityModule
|
||||
clangTidyReadabilityModule
|
||||
clangTidyZirconModule
|
||||
clangTooling
|
||||
clangToolingCore
|
||||
clangToolingInclusions
|
||||
|
||||
@@ -16,7 +16,10 @@ import subprocess
|
||||
import time
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Iterable, List, Optional
|
||||
from typing import Iterable, List, Optional, Set
|
||||
|
||||
|
||||
LLVM_COMPONENTS_FILE = Path(__file__).with_name("llvm-components.json")
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
@@ -102,12 +105,33 @@ def run_build(build_dir: Path) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def protected_library_names() -> Set[str]:
|
||||
data = json.loads(LLVM_COMPONENTS_FILE.read_text())
|
||||
components = data.get("components", [])
|
||||
if not isinstance(components, list):
|
||||
raise ValueError(f"{LLVM_COMPONENTS_FILE} missing 'components' list")
|
||||
|
||||
names: Set[str] = set()
|
||||
for component in components:
|
||||
if not isinstance(component, str):
|
||||
continue
|
||||
if not (component.startswith("clangTidy") and component.endswith("Module")):
|
||||
continue
|
||||
names.add(f"lib{component}.a")
|
||||
names.add(f"{component}.lib")
|
||||
return names
|
||||
|
||||
|
||||
def candidate_files(install_dir: Path) -> Iterable[Path]:
|
||||
if not install_dir.is_dir():
|
||||
raise FileNotFoundError(f"lib dir not found: {install_dir}")
|
||||
protected = protected_library_names()
|
||||
for path in sorted(install_dir.iterdir()):
|
||||
if not path.is_file():
|
||||
continue
|
||||
if path.name in protected:
|
||||
print(f"Keeping protected clang-tidy module library: {path.name}")
|
||||
continue
|
||||
if path.suffix.lower() in {".a", ".lib"}:
|
||||
yield path
|
||||
else:
|
||||
@@ -156,7 +180,11 @@ def apply_manifest(manifest: Path, install_dir: Path) -> None:
|
||||
removed = data.get("removed", [])
|
||||
if not isinstance(removed, list):
|
||||
raise ValueError("Manifest missing 'removed' list")
|
||||
protected = protected_library_names()
|
||||
for name in removed:
|
||||
if name in protected:
|
||||
print(f"Keeping protected clang-tidy module library from manifest: {name}")
|
||||
continue
|
||||
target = install_dir / name
|
||||
if target.exists():
|
||||
print(f"Deleting {target}")
|
||||
|
||||
@@ -53,7 +53,7 @@ struct Options {
|
||||
help =
|
||||
"Agentic method (compileCommand, symbolSearch, definition, references, "
|
||||
"documentSymbols, readSymbol, callGraph, typeHierarchy, projectFiles, "
|
||||
"fileDeps, impactAnalysis, status, shutdown)",
|
||||
"lint, fileDeps, impactAnalysis, status, shutdown)",
|
||||
required = false)
|
||||
<std::string> method;
|
||||
|
||||
|
||||
@@ -418,6 +418,8 @@ CompilationUnit compile(CompilationParams& params, PCMInfo& out) {
|
||||
}
|
||||
|
||||
CompilationUnit complete(CompilationParams& params, clang::CodeCompleteConsumer* consumer) {
|
||||
params.kind = CompilationKind::Completion;
|
||||
|
||||
auto& [file, offset] = params.completion;
|
||||
|
||||
/// The location of clang is 1-1 based.
|
||||
|
||||
@@ -65,7 +65,7 @@ struct PCMInfo : ModuleInfo {
|
||||
|
||||
struct CompilationParams {
|
||||
/// The kind of this compilation.
|
||||
CompilationKind kind;
|
||||
CompilationKind kind = CompilationKind::Content;
|
||||
|
||||
/// Whether to run clang-tidy.
|
||||
bool clang_tidy = false;
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
#include "clang-tidy/ClangTidyDiagnosticConsumer.h"
|
||||
#include "clang-tidy/ClangTidyModuleRegistry.h"
|
||||
#include "clang-tidy/ClangTidyOptions.h"
|
||||
#ifdef CLICE_HAS_CLANG_TIDY_MODULES
|
||||
#define CLANG_TIDY_DISABLE_STATIC_ANALYZER_CHECKS
|
||||
#include "clang-tidy/ClangTidyForceLinker.h"
|
||||
#endif
|
||||
|
||||
namespace clice::tidy {
|
||||
|
||||
|
||||
@@ -669,6 +669,7 @@ kota::task<> Compiler::run_compile(std::uint32_t pid, std::shared_ptr<Session::P
|
||||
params.path = file_path;
|
||||
params.version = sess->version;
|
||||
params.text = sess->text;
|
||||
params.clang_tidy = workspace.config.project.clang_tidy.value;
|
||||
if(!fill_compile_args(file_path, params.directory, params.arguments, sess)) {
|
||||
finish_compile();
|
||||
co_return;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "kota/ipc/lsp/protocol.h"
|
||||
#include "kota/ipc/protocol.h"
|
||||
|
||||
namespace clice::agentic {
|
||||
@@ -202,6 +203,13 @@ struct TypeHierarchyResult {
|
||||
std::vector<TypeHierarchyEntry> subtypes;
|
||||
};
|
||||
|
||||
struct LintParams {
|
||||
std::string path;
|
||||
std::optional<int> line;
|
||||
};
|
||||
|
||||
using LintResult = std::vector<kota::ipc::protocol::Diagnostic>;
|
||||
|
||||
struct StatusParams {};
|
||||
|
||||
struct StatusResult {
|
||||
@@ -283,6 +291,12 @@ struct RequestTraits<clice::agentic::TypeHierarchyParams> {
|
||||
constexpr inline static std::string_view method = "agentic/typeHierarchy";
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RequestTraits<clice::agentic::LintParams> {
|
||||
using Result = clice::agentic::LintResult;
|
||||
constexpr inline static std::string_view method = "agentic/lint";
|
||||
};
|
||||
|
||||
template <>
|
||||
struct RequestTraits<clice::agentic::StatusParams> {
|
||||
using Result = clice::agentic::StatusResult;
|
||||
|
||||
@@ -43,6 +43,7 @@ struct CompileParams {
|
||||
std::string text;
|
||||
std::string directory;
|
||||
std::vector<std::string> arguments;
|
||||
bool clang_tidy = false;
|
||||
std::pair<std::string, uint32_t> pch;
|
||||
std::unordered_map<std::string, std::string> pcms;
|
||||
};
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "compile/compilation.h"
|
||||
#include "feature/feature.h"
|
||||
#include "server/protocol/agentic.h"
|
||||
#include "server/service/master_server.h"
|
||||
#include "support/filesystem.h"
|
||||
#include "support/logging.h"
|
||||
|
||||
#include "kota/async/async.h"
|
||||
#include "kota/ipc/lsp/uri.h"
|
||||
#include "kota/meta/enum.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
@@ -769,6 +772,36 @@ AgentClient::AgentClient(MasterServer& server, kota::ipc::JsonPeer& peer) :
|
||||
co_return result;
|
||||
});
|
||||
|
||||
peer.on_request([&srv](RequestContext&, const LintParams& params) -> RequestResult<LintParams> {
|
||||
std::string directory;
|
||||
std::vector<std::string> arguments;
|
||||
if(!srv.compiler.fill_compile_args(params.path, directory, arguments)) {
|
||||
co_return kota::outcome_error(
|
||||
kota::ipc::Error{std::format("no compile command found for {}", params.path)});
|
||||
}
|
||||
|
||||
auto result = co_await kota::queue([path = params.path,
|
||||
directory = std::move(directory),
|
||||
arguments = std::move(arguments)]() mutable {
|
||||
CompilationParams cp;
|
||||
cp.kind = CompilationKind::Content;
|
||||
cp.clang_tidy = true;
|
||||
cp.directory = std::move(directory);
|
||||
for(auto& arg: arguments) {
|
||||
cp.arguments.push_back(arg.c_str());
|
||||
}
|
||||
|
||||
auto unit = compile(cp);
|
||||
if(!unit.completed() && !unit.fatal_error()) {
|
||||
LOG_WARN("Lint compilation failed: {}", path);
|
||||
return LintResult{};
|
||||
}
|
||||
|
||||
return feature::diagnostics(unit);
|
||||
});
|
||||
co_return result.value();
|
||||
});
|
||||
|
||||
peer.on_request([&srv](RequestContext&, const StatusParams&) -> RequestResult<StatusParams> {
|
||||
StatusResult result;
|
||||
result.idle = srv.indexer.is_idle();
|
||||
|
||||
@@ -85,6 +85,9 @@ static kota::task<> agentic_request(kota::ipc::JsonPeer& peer,
|
||||
.line = line,
|
||||
.direction = dir,
|
||||
});
|
||||
} else if(opts.method == "lint") {
|
||||
auto line = opts.line > 0 ? std::optional(opts.line) : std::nullopt;
|
||||
ok = co_await send_and_print(peer, agentic::LintParams{.path = opts.path, .line = line});
|
||||
} else if(opts.method == "fileDeps") {
|
||||
auto dir = opts.direction.empty() ? std::nullopt : std::optional(opts.direction);
|
||||
ok = co_await send_and_print(peer,
|
||||
|
||||
@@ -152,6 +152,7 @@ void StatefulWorker::register_handlers() {
|
||||
|
||||
CompilationParams cp;
|
||||
cp.kind = CompilationKind::Content;
|
||||
cp.clang_tidy = params.clang_tidy;
|
||||
fill_args(cp, doc->directory, doc->arguments);
|
||||
if(!doc->pch.first.empty()) {
|
||||
cp.pch = doc->pch;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "test/test.h"
|
||||
#include "compile/compilation.h"
|
||||
#include "compile/implement.h"
|
||||
|
||||
namespace clice::testing {
|
||||
namespace {
|
||||
@@ -7,6 +8,10 @@ namespace {
|
||||
TEST_SUITE(ClangTidy) {
|
||||
|
||||
TEST_CASE(FastCheck) {
|
||||
#ifdef CLICE_HAS_CLANG_TIDY_MODULES
|
||||
ASSERT_TRUE(tidy::is_registered_tidy_check("bugprone-integer-division"));
|
||||
#endif
|
||||
|
||||
// ASSERT_TRUE(tidy::is_fast_tidy_check("readability-misleading-indentation"));
|
||||
// ASSERT_TRUE(tidy::is_fast_tidy_check("bugprone-unused-return-value"));
|
||||
//
|
||||
@@ -22,6 +27,7 @@ TEST_CASE(Tidy) {
|
||||
|
||||
std::string main_path = TestVFS::path("main.cpp");
|
||||
CompilationParams params;
|
||||
params.kind = CompilationKind::Content;
|
||||
params.clang_tidy = true;
|
||||
params.vfs = vfs;
|
||||
params.arguments = {"clang++", "-ffreestanding", "-Xclang", "-undef", main_path.c_str()};
|
||||
@@ -30,6 +36,37 @@ TEST_CASE(Tidy) {
|
||||
ASSERT_FALSE(unit.diagnostics().empty());
|
||||
}
|
||||
|
||||
#ifdef CLICE_HAS_CLANG_TIDY_MODULES
|
||||
TEST_CASE(BugproneIntegerDivision) {
|
||||
auto vfs = llvm::makeIntrusiveRefCnt<TestVFS>();
|
||||
vfs->add("main.cpp",
|
||||
"int main() {"
|
||||
" double d;"
|
||||
" int i = 42;"
|
||||
" d = 32 * 8 / (2 + i);"
|
||||
" return static_cast<int>(d);"
|
||||
"}");
|
||||
|
||||
std::string main_path = TestVFS::path("main.cpp");
|
||||
CompilationParams params;
|
||||
params.kind = CompilationKind::Content;
|
||||
params.clang_tidy = true;
|
||||
params.vfs = vfs;
|
||||
params.arguments = {"clang++", "-ffreestanding", "-Xclang", "-undef", main_path.c_str()};
|
||||
auto unit = compile(params);
|
||||
ASSERT_TRUE(unit.completed());
|
||||
|
||||
bool found = false;
|
||||
for(auto& diagnostic: unit.diagnostics()) {
|
||||
if(llvm::StringRef(diagnostic.message).contains("integer division")) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(found);
|
||||
}
|
||||
#endif
|
||||
|
||||
}; // TEST_SUITE(ClangTidy)
|
||||
} // namespace
|
||||
} // namespace clice::testing
|
||||
|
||||
Reference in New Issue
Block a user