Skip to content

1657 allow the contributor to self assign the issue #1

1657 allow the contributor to self assign the issue

1657 allow the contributor to self assign the issue #1

Workflow file for this run

# workflows/test-paradedb.yml
#
# Test ParadeDB
# Test building the ParadeDB Docker Image using Docker Compose.
name: Test ParadeDB
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
- dev
paths:
- ".github/workflows/test-paradedb.yml"
- "docker/**"
- "pg_analytics/**"
- "!pg_analytics/README.md"
- "pg_search/**"
- "!pg_search/README.md"
- "shared/**"
- "tokenizers/**"
workflow_dispatch:
concurrency:
group: test-paradedb-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test-paradedb:
name: Test ParadeDB on PostgreSQL ${{ matrix.pg_version }} for ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
if: github.event.pull_request.draft == false
strategy:
matrix:
include:
- runner: depot-ubuntu-latest-8
pg_version: 16
arch: amd64
- runner: depot-ubuntu-latest-arm-8
pg_version: 16
arch: arm64
steps:
- name: Checkout Git Repository
uses: actions/checkout@v4
- name: Set Environment
id: env
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "environment=prod" >> $GITHUB_OUTPUT
echo "Using prod configuration..."
else
echo "environment=dev" >> $GITHUB_OUTPUT
echo "Using dev configuration..."
fi
- name: Configure Depot CLI
if: steps.env.outputs.environment == 'prod'
uses: depot/setup-action@v1
# We only build with Depot when promoting to `main` as doing so requires access to GitHub Secrets,
# which community contributors don't have access to.
#
# We keep PARADEDB_TELEMETRY=true to test the telemetry feature, even though this isn't real usage.
- name: Build the ParadeDB Docker Image via Depot (prod only)
if: steps.env.outputs.environment == 'prod'
uses: depot/build-push-action@v1
with:
context: .
build-args: |
POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}
POSTHOG_HOST=${{ secrets.POSTHOG_HOST }}
COMMIT_SHA=testcommitsha
PARADEDB_TELEMETRY=true
platforms: linux/${{ matrix.arch }}
file: docker/Dockerfile
push: false # Don't push to Docker Hub
load: true # Load the image into the Docker daemon of the runner
project: ${{ secrets.DEPOT_PROJECT }}
token: ${{ secrets.DEPOT_TOKEN }}
tags: paradedb/paradedb:latest # Tag the local image as latest so it gets picked up by Docker Compose
# On any branch other than `main`, we build the ParadeDB Docker Image using Docker Compose so that community
# contributors can trigger the workflow without needing access to GitHub Secrets.
#
# In this environment, PARADEDB_TELEMETRY is set to false to avoid sending misleading telemetry data to PostHog.
- name: Build the ParadeDB Docker Image via Docker Compose (dev only)
if: steps.env.outputs.environment == 'dev'
working-directory: docker/
run: docker build --file Dockerfile --tag paradedb/paradedb:latest ..
# Sleep 10 seconds to give time for Postgres to start inside the container. The docker-compose.yml file
# will use the local ParadeDB image that we just built.
- name: Start the ParadeDB Docker Image
working-directory: docker/
run: docker compose -f docker-compose.yml up -d && sleep 10
# We run the container in detached mode, and grep for the word ERROR to see if it failed to start correctly
- name: Check for Errors in the ParadeDB Docker Image
working-directory: docker/
run: |
CONTAINER_ID=$(docker ps -aq --filter "name=paradedb")
CONTAINER_STATUS=$(docker inspect -f '{{.State.Status}}' $CONTAINER_ID)
echo "paradedb container ID: $CONTAINER_ID"
echo "Container status: $CONTAINER_STATUS"
echo ""
echo "Printing logs for the ParadeDB Docker container..."
docker logs $CONTAINER_ID
# Fail the run if the container failed to start
if [ "$CONTAINER_STATUS" = "exited" ]; then
echo "Error: Container failed to start properly"
exit 1
fi
# Fail the run if there are any Postgres ERRORs in the logs
if docker logs $CONTAINER_ID | grep -q ERROR; then
echo "Error: ParadeDB Docker container logs contain an error"
exit 1
fi
# Only run this job on the `main` branch since it requires access to GitHub Secrets, which
# community contributors don't have access to.
test-paradedb-helm-chart:
name: Test ParadeDB Helm Chart
runs-on: depot-ubuntu-latest-2
if: github.event.pull_request.draft == false && github.event.pull_request.base.ref == 'main'
steps:
- name: Trigger paradedb/charts Test Workflow
uses: benc-uk/[email protected]
with:
token: ${{ secrets.GHA_CREATE_RELEASE_PAT }}
workflow: paradedb-test-eks.yml
repo: paradedb/charts
ref: main
- name: Wait for paradedb/charts Test Workflow to Complete
run: |
workflow_run_id=""
while [ -z "$workflow_run_id" ]; do
workflow_run_id=$(curl -s -H "Authorization: token ${{ secrets.GHA_CREATE_RELEASE_PAT }}" \
https://api.github.com/repos/paradedb/charts/actions/workflows/paradedb-test-eks.yml/runs?event=workflow_dispatch \
| jq -r '.workflow_runs[] | select(.status == "in_progress" or .status == "queued") | .id' | head -n 1)
if [ -z "$workflow_run_id" ]; then
echo "Waiting for workflow run to start..."
sleep 10
fi
done
status="in_progress"
while [ "$status" != "completed" ]; do
status=$(curl -s -H "Authorization: token ${{ secrets.GHA_CREATE_RELEASE_PAT }}" \
https://api.github.com/repos/paradedb/charts/actions/runs/$workflow_run_id \
| jq -r '.status')
echo "Current status: $status"
if [ "$status" != "completed" ]; then
sleep 10
fi
done
conclusion=$(curl -s -H "Authorization: token ${{ secrets.GHA_CREATE_RELEASE_PAT }}" \
https://api.github.com/repos/paradedb/charts/actions/runs/$workflow_run_id \
| jq -r '.conclusion')
echo "Workflow completed with conclusion: $conclusion"
if [ "$conclusion" != "success" ]; then
exit 1
fi