Files
clice/.github/workflows/cmake.yml
ykiko 836d9dc988 Add basic test client (#156)
Co-authored-by: star9029 <hengxings783@gmail.com>
2025-07-21 17:55:10 +08:00

113 lines
3.3 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 == 'ubuntu-24.04'
run: |
mkdir -p ./.llvm
curl -L "https://github.com/clice-project/llvm-binary/releases/download/20.0.0/x86_64-linux-gnu-debug.tar.xz" | tar -xJ -C ./.llvm
- name: Setup llvm binary
if: matrix.os == 'windows-2025'
run: |
curl -O -L "https://github.com/clice-project/llvm-binary/releases/download/20.0.0/x64-windows-msvc-release.7z"
7z x x64-windows-msvc-release.7z "-o.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 (debug)
if: matrix.os == 'ubuntu-24.04'
run: |
cmake --preset debug
cmake --build --preset debug -v
- 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 --preset debug
cmake --build --preset debug -v
- name: Build clice (release)
if: matrix.os == 'windows-2025'
run: |
cmake --preset release
cmake --build --preset release
- name: Install Python dependencies
run: pip install pytest pytest-asyncio pytest-xdist
- name: Run tests
run: |
./build/bin/unit_tests --test-dir="./tests/data" --resource-dir="./.llvm/lib/clang/20"
pytest -s tests/integration --executable=./build/bin/clice