This repository has been archived by the owner on Oct 3, 2024. It is now read-only.
Add mr_create_context fn #89
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, dev ] | |
pull_request: | |
branches: [ main, dev ] | |
workflow_dispatch: | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
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 | |
cargo pgrx init --pg16 pg_config | |
cargo build | |
- name: Checkout and run the service | |
run: | | |
git clone --branch dev --depth 1 https://github.com/Intersubjective/meritrank-service-rust.git | |
cd meritrank-service-rust | |
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 | |
docker_build: | |
needs: [ build_and_test ] | |
if: success() | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Determine tag | |
shell: bash | |
run: | | |
export VER="v0.0" | |
export N=24 | |
while [ $(docker manifest inspect vbulavintsev/postgres-tentura:$VER.$N >/dev/null 2>&1; echo $?) -eq 0 ]; do | |
let N++ | |
done | |
echo "TAG=$VER.$N" >> $GITHUB_ENV | |
- name: Build docker image | |
run: | | |
docker build -t vbulavintsev/postgres-tentura:$TAG . | |
- name: Push docker image to Dockerhub | |
if: ${{ github.ref == 'refs/heads/main' }} | |
shell: bash | |
run: | | |
docker login -u vbulavintsev -p ${{ secrets.DOCKERHUB_TOKEN }} | |
docker image push vbulavintsev/postgres-tentura:$TAG |