build: add system libtree-sitter dependency across builds #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Test | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| release: | |
| types: [published] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-22.04, macos-14, windows-2022] | |
| include: | |
| - os: ubuntu-22.04 | |
| cc: gcc | |
| cxx: g++ | |
| ext: .so | |
| - os: macos-14 | |
| cc: clang | |
| cxx: clang++ | |
| ext: .so | |
| - os: windows-2022 | |
| cc: gcc | |
| cxx: g++ | |
| ext: .dll | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake ninja-build libsqlite3-dev nodejs npm git curl libtree-sitter-dev | |
| - name: Install dependencies (macOS) | |
| if: matrix.os == 'macos-14' | |
| run: | | |
| brew install cmake ninja sqlite node git curl tree-sitter | |
| - name: Install dependencies (Windows) | |
| if: matrix.os == 'windows-2022' | |
| shell: pwsh | |
| run: | | |
| choco install -y cmake ninja nodejs git mingw curl 2>$null | Out-Null | |
| - name: Download tree-sitter grammars | |
| run: | | |
| cd grammars | |
| bash download_grammars_v2.sh || bash build_ci.sh | |
| - name: Build C++ engine | |
| env: | |
| CC: ${{ matrix.cc }} | |
| CXX: ${{ matrix.cxx }} | |
| run: | | |
| cmake -B engine/build -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_C_COMPILER=${{ matrix.cc }} \ | |
| -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ | |
| engine/ | |
| cmake --build engine/build --target astgraph_engine | |
| - name: Build Rust server | |
| run: | | |
| cargo build --release --bin codescope | |
| - name: Run tests | |
| run: | | |
| cargo test --release | |
| - name: Upload binary (Linux) | |
| if: matrix.os == 'ubuntu-22.04' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codescope-linux-x86_64 | |
| path: | | |
| target/release/codescope | |
| grammars/*.so | |
| - name: Upload binary (macOS) | |
| if: matrix.os == 'macos-14' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codescope-macos-arm64 | |
| path: | | |
| target/release/codescope | |
| grammars/*.so | |
| - name: Upload binary (Windows) | |
| if: matrix.os == 'windows-2022' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: codescope-windows-x86_64 | |
| path: | | |
| target/release/codescope.exe | |
| grammars/*.dll | |
| - name: Check grammars | |
| run: | | |
| echo "Built grammars:" | |
| ls -lh grammars/*${{ matrix.ext }} 2>/dev/null || dir grammars\*.dll |