Skip to content

Feat/eval similarity #808

Feat/eval similarity

Feat/eval similarity #808

Workflow file for this run

name: Lints-Tests
on:
push:
branches:
- main
- master
pull_request:
permissions:
contents: read
env:
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down
PYTHON_VERSION: "3.9"
jobs:
rust-lints-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: "3.x"
- name: Set up Rust
run: rustup override set stable && rustup update
- name: Install clippy
run: rustup component add clippy
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Run Lints
run: make lints
- name: Unit Tests
run: make test
env:
RUST_BACKTRACE: 1
- name: Setup Server
run: make start.server
env:
RUST_BACKTRACE: 1
- name: Test Events
run: make test.events
env:
RUST_BACKTRACE: 1
- name: Stop Server
if: always()
run: make stop.server
test-os:
name: test ${{ matrix.os }}-${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
python-version: ["3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}-latest
needs: [rust-lints-test]
steps:
- uses: actions/checkout@v4
- name: install rust stable
uses: dtolnay/rust-toolchain@stable
- name: cache rust
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.python-version }}-v1
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Create virtual environment
working-directory: ./py-scouter
run: make setup.project
- name: Lints
working-directory: ./py-scouter
run: make lints.ci
- name: Run tests and report coverage
working-directory: ./py-scouter
run: make test.unit
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-windows:
name: test ${{ matrix.os }}-${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
os: [windows]
python-version: ["3.10", "3.11", "3.12.6"]
runs-on: ${{ matrix.os }}-latest
needs: [rust-lints-test]
steps:
- uses: actions/checkout@v4
- name: install rust stable
uses: dtolnay/rust-toolchain@stable
- name: cache rust
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.python-version }}-v1
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Create virtual environment
working-directory: ./py-scouter
run: make setup.project
- name: Lints
working-directory: ./py-scouter
run: make lints.ci
- name: Run tests and report coverage
working-directory: ./py-scouter
run: make test.unit
test-os-integration:
needs: [test-os]
name: test integration
strategy:
fail-fast: false
matrix:
os: [ubuntu]
python-version: ["3.12"]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: install rust stable
uses: dtolnay/rust-toolchain@stable
- name: cache rust
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.python-version }}-v1
- name: Setup Backends
run: make build.all_backends
env:
RUST_BACKTRACE: 1
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Create virtual environment
working-directory: ./py-scouter
run: make setup.project
- name: Run tests
working-directory: ./py-scouter
run: |
make test.integration
- name: Stop Containers
if: always()
run: make build.shutdown
test-py-build-linux:
#needs: [test-os]
name: build - ubuntu - ${{ matrix.manylinux }} - ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
manylinux: auto
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- run: pip install -U twine
- name: Set OPENSSL_DIR environment variable
run: echo "OPENSSL_DIR=/usr" >> $GITHUB_ENV
- name: build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux }}
args: --release --out dist
rust-toolchain: stable
docker-options: -e CI
working-directory: ./py-scouter
# See: https://github.com/sfackler/rust-openssl/issues/2036#issuecomment-1724324145
before-script-linux: |
# If we're running on rhel centos, install needed packages.
if command -v yum &> /dev/null; then
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
# If we're running on i686 we need to symlink libatomic
# in order to build openssl with -latomic flag.
if [[ ! -d "/usr/lib64" ]]; then
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
fi
else
# If we're running on debian-based system.
apt update -y && apt-get install -y libssl-dev openssl pkg-config
fi
# Install bindgen CLI
cargo install --force --locked bindgen-cli
# Determine architecture (x86_64 or x86)
ARCH=$(uname -m)
echo "Detected architecture: $ARCH"
# Download the correct CMake version based on the architecture
if [[ "$ARCH" == "x86_64" ]]; then
echo "Downloading CMake for x86_64 architecture"
curl -L https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-x86_64.sh -o cmake.sh
chmod +x cmake.sh
./cmake.sh --skip-license --prefix=/usr/local
elif [[ "$ARCH" == "i686" ]]; then
echo "Downloading CMake for x86 architecture"
curl -L https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4.tar.gz -o cmake.tar.gz
tar -xzf cmake.tar.gz
cd cmake-3.26.4
./bootstrap --prefix=/usr/local
make -j$(nproc)
make install
cd ..
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
cmake --version
- name: Check dist
working-directory: ./py-scouter
run: ls -lh dist/
- name: Check wheel
working-directory: ./py-scouter
run: twine check --strict dist/*
test-py-build-linux-arm64:
name: build - linux-arm64
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install maturin
run: pip install maturin
- name: Build wheel
uses: PyO3/maturin-action@v1
with:
target: aarch64-unknown-linux-gnu
manylinux: "2_28"
args: --release --out dist
rust-toolchain: stable
docker-options: -e CI -e SIMSIMD_DISABLE_SVE=1 -e SIMSIMD_TARGET_SVE=0 -e SIMSIMD_TARGET_SVE2=0
working-directory: ./py-scouter
before-script-linux: |
# Install required packages
if command -v yum &> /dev/null; then
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic
else
apt update -y && apt-get install -y libssl-dev openssl pkg-config
fi
# Set environment variables for simsimd on ARM64
export SIMSIMD_DISABLE_SVE=1
export SIMSIMD_TARGET_SVE=0
export SIMSIMD_TARGET_SVE2=0
export SIMSIMD_TARGET_SVE_F16=0
export SIMSIMD_TARGET_SVE_BF16=0
export SIMSIMD_TARGET_SVE_I8=0
export CFLAGS="-march=armv8-a"
export CXXFLAGS="-march=armv8-a"
- name: Check wheel
working-directory: ./py-scouter
run: |
pip install twine
twine check --strict dist/*
test-build-rust-binaries:
needs: [rust-lints-test]
name: build - ${{ matrix.target }} - server
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
archive: tar.gz
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
archive: tar.xz
- os: macos-latest
target: aarch64-apple-darwin
archive: zip
env:
TARGET: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Rust
run: |
rustup override set stable
rustup update
rustup target add ${{ matrix.target }}
rustup component add rust-src
- name: Update apt repositories
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update -y
sudo apt-get install
- name: Build Scouter Server with Kakfa Binaries
run: cargo build -p scouter-server --features kafka --release --target ${{ matrix.target }}
- name: Build Scouter Server with RabbitMQ Binaries
run: cargo build -p scouter-server --features rabbitmq --release --target ${{ matrix.target }}