Skip to content

feat: Thread support #267

feat: Thread support

feat: Thread support #267

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Install system dependencies
shell: bash
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt-get update
sudo apt-get install -y --no-install-recommends libclang-dev capnproto libcapnp-dev pkg-config
# Set environment variables for Rust/bindgen
LLVM_VERSION=$(ls /usr/lib/ | grep llvm | sort -V | tail -1)
echo "LIBCLANG_PATH=/usr/lib/$LLVM_VERSION/lib" >> $GITHUB_ENV
echo "CLANG_PATH=/usr/bin/clang" >> $GITHUB_ENV
elif [[ "$RUNNER_OS" == "macOS" ]]; then
brew install capnp pkg-config
elif [[ "$RUNNER_OS" == "Windows" ]]; then
# Install LLVM/Clang for Windows
choco install llvm -y
# Install vcpkg for Cap'n Proto on Windows
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat
./vcpkg install capnproto:x64-windows
echo "VCPKG_ROOT=$(pwd)" >> $GITHUB_ENV
echo "CMAKE_TOOLCHAIN_FILE=$(pwd)/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV
cd ..
fi
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install Ruby dependencies
run: bundle install
- name: Setup just
uses: extractions/setup-just@v1
- name: Build extension
run: just build-extension
- name: Run tests
run: just test
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Install system dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends libclang-dev capnproto libcapnp-dev pkg-config
# Set environment variables for Rust/bindgen
LLVM_VERSION=$(ls /usr/lib/ | grep llvm | sort -V | tail -1)
echo "LIBCLANG_PATH=/usr/lib/$LLVM_VERSION/lib" >> $GITHUB_ENV
echo "CLANG_PATH=/usr/bin/clang" >> $GITHUB_ENV
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Ruby dependencies
run: bundle install
- name: Setup just
uses: extractions/setup-just@v1
- name: Build extension
run: just build-extension
- name: Run benchmarks and generate report
run: just bench heavy_work reports/benchmark_report.svg
- name: Post or update PR comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const path = 'reports/benchmark_report.svg';
let content = fs.readFileSync(path, 'utf8');
content = '<details>\n<summary>Benchmark Report</summary>\n\n' +
content + '\n</details>';
const issue_number = context.payload.pull_request.number;
const header = '<!-- benchmark-report -->\n';
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number
});
const existing = comments.data.find(c => c.body.startsWith(header));
const body = header + content;
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number,
body
});
}
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-24.05
extra_nix_config: |
experimental-features = nix-command flakes
- name: Build extension via Nix
run: nix develop -c just build-extension
- name: Run tests via Nix
run: nix develop -c just test