Implement kmeans with kmeans++ #116
This file contains 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 and test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
format_code: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run formatting in core | |
working-directory: ./core | |
run: | | |
cargo fmt | |
- name: Run formatting in service | |
working-directory: ./service | |
run: | | |
cargo fmt | |
- name: Run formatting in psql-connector | |
working-directory: ./psql-connector | |
run: | | |
cargo fmt | |
test_core: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./core | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
cargo build | |
- name: Run tests | |
run: | | |
cargo test -- --skip smoke_memory | |
test_memory_consumption: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./core | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and run the test | |
run: | | |
export MERITRANK_NO_ASSERT=1 | |
export MEM_KB=`/usr/bin/time -f "%M" cargo test smoke_memory --release --quiet 2>&1 1>/dev/null` | |
echo "Memory consumption is $MEM_KB KB" | |
if [ $MEM_KB -gt 550000 ]; then | |
exit 1 | |
fi | |
test_service: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./service | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build | |
run: cargo build | |
- name: Run tests | |
run: | | |
export MERITRANK_NUM_WALK=50 | |
cargo test | |
test_psql_connector: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./psql-connector | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PostgreSQL 16 | |
run: | | |
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install -y postgresql-16 postgresql-server-dev-16 | |
- name: Prepare env | |
run: | | |
sudo su - root -c "echo \"export MERITRANK_SERVICE_URL=tcp://127.0.0.1:10444\" >> /etc/environment" | |
- name: Build the connector | |
run: | | |
cargo install --locked cargo-pgrx --version 0.11.4 | |
cargo pgrx init --pg16 pg_config | |
cargo build | |
- name: Build and run the service | |
working-directory: ./service | |
run: | | |
cargo build --release | |
export MERITRANK_SERVICE_URL=tcp://127.0.0.1:10444 | |
export MERITRANK_NUM_WALK=500 | |
cargo run --release >/dev/null 2>&1 & | |
- name: Do the tests | |
run: | | |
export RUST_TEST_THREADS=1 | |
cargo pgrx test --runas postgres --pgdata /var/lib/postgresql/pgrx | |
test_docker_service: | |
needs: [ test_core, test_memory_consumption, test_service, test_psql_connector ] | |
if: success() | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./service | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docker image | |
run: | | |
docker build -f ./Dockerfile .. | |
test_docker_psql_connector: | |
needs: [ test_core, test_memory_consumption, test_service, test_psql_connector ] | |
if: success() | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./psql-connector | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build docker image | |
run: | | |
docker build -f ./Dockerfile .. |