120 lines
4.1 KiB
YAML
120 lines
4.1 KiB
YAML
name: cmake
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- "docs"
|
|
- "scripts"
|
|
- ".clang-format"
|
|
- ".clangd"
|
|
- ".gitignore"
|
|
- "LICENSE"
|
|
- "README.md"
|
|
- ".github/workflows/xmake.yml"
|
|
- "xmake.lua"
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-24.04, windows-2025, macos-15]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Setup ninja
|
|
if: matrix.os == 'windows-2025'
|
|
uses: MinoruSekine/setup-scoop@v4.0.1
|
|
with:
|
|
buckets: main
|
|
apps: ninja
|
|
|
|
- name: Setup llvm & libstdc++ & cmake & ninja
|
|
if: matrix.os == 'ubuntu-24.04'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y gcc-14 g++-14 libstdc++-14-dev
|
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
|
|
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
|
|
sudo update-alternatives --set gcc /usr/bin/gcc-14
|
|
sudo update-alternatives --set g++ /usr/bin/g++-14
|
|
|
|
wget https://apt.llvm.org/llvm.sh
|
|
chmod +x llvm.sh
|
|
sudo ./llvm.sh 20 all
|
|
|
|
sudo apt install -y cmake ninja-build
|
|
|
|
- name: Setup llvm@20 and lld
|
|
if: matrix.os == 'macos-15'
|
|
run: |
|
|
brew install llvm@20 lld@20
|
|
|
|
- name: Set up Python
|
|
if: matrix.os == 'windows-2025'
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup llvm binary
|
|
if: matrix.os == 'windows-2025'
|
|
run: |
|
|
curl -O -L "https://github.com/clice-project/llvm-binary/releases/download/20.1.5/x64-windows-msvc-release.7z"
|
|
7z x x64-windows-msvc-release.7z "-o.llvm"
|
|
|
|
- name: Setup llvm binary
|
|
if: matrix.os == 'ubuntu-24.04'
|
|
run: |
|
|
mkdir -p ./.llvm
|
|
curl -L "https://github.com/clice-project/llvm-binary/releases/download/20.1.5/x86_64-linux-gnu-debug.tar.xz" | tar -xJ -C ./.llvm
|
|
|
|
- name: Setup llvm binary
|
|
if: matrix.os == 'macos-15'
|
|
run: |
|
|
mkdir -p ./.llvm
|
|
curl -L "https://github.com/clice-project/llvm-binary/releases/download/20.1.5/arm64-macosx-apple-debug.tar.xz" | tar -xJ -C ./.llvm
|
|
|
|
- name: Setup msvc sysroot for cmake
|
|
if: matrix.os == 'windows-2025'
|
|
uses: ilammy/msvc-dev-cmd@v1
|
|
|
|
- name: Build clice (release, windows)
|
|
if: matrix.os == 'windows-2025'
|
|
run: |
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_INSTALL_PATH="./.llvm" -DCLICE_ENABLE_TEST=ON
|
|
cmake --build build
|
|
|
|
- name: Build clice (debug, linux)
|
|
if: matrix.os == 'ubuntu-24.04'
|
|
run: |
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DLLVM_INSTALL_PATH="./.llvm" -DCLICE_ENABLE_TEST=ON
|
|
cmake --build build
|
|
|
|
- name: Build clice (debug, macos)
|
|
if: matrix.os == 'macos-15'
|
|
run: |
|
|
export PATH="/opt/homebrew/opt/llvm@20/bin:/opt/homebrew/opt/lld@20/bin:$PATH"
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_INSTALL_PATH="./.llvm" -DCLICE_ENABLE_TEST=ON
|
|
cmake --build build
|
|
|
|
- name: Install Python dependencies
|
|
run: pip install pytest pytest-asyncio pytest-xdist
|
|
|
|
- name: Run tests
|
|
if: matrix.os == 'windows-2025'
|
|
run: |
|
|
./build/bin/unit_tests.exe --test-dir="./tests/data" --resource-dir="./.llvm/lib/clang/20"
|
|
pytest -s --log-cli-level=INFO tests/integration --executable=./build/bin/clice.exe --resource-dir="./.llvm/lib/clang/20"
|
|
|
|
- name: Run tests
|
|
if: matrix.os == 'ubuntu-24.04' || matrix.os == 'macos-15'
|
|
run: |
|
|
./build/bin/unit_tests --test-dir="./tests/data" --resource-dir="./.llvm/lib/clang/20"
|
|
pytest -s --log-cli-level=INFO tests/integration --executable=./build/bin/clice --resource-dir="./.llvm/lib/clang/20"
|