add a gitignore #2
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: Test NDC Test Cases (Relational DB) | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: 'Branch, tag or SHA to test' | |
required: true | |
default: 'main' | |
type: string | |
push: | |
branches: | |
- main | |
paths: | |
- 'relational/**' | |
- 'static/relational/**' | |
jobs: | |
validate-test-cases: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ndc-test-cases | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.ref || github.ref }} | |
- name: Setup Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Start PostgreSQL | |
working-directory: static/relational/postgres | |
run: | | |
docker compose up -d postgres | |
# Wait for PostgreSQL to be healthy | |
until docker compose ps postgres | grep "healthy"; do | |
echo "Waiting for PostgreSQL..." | |
sleep 5 | |
done | |
- name: Setup NDC Postgres | |
working-directory: static/relational/postgres | |
run: | | |
# Get latest NDC Postgres version | |
NDC_POSTGRES_VERSION=$(curl -s https://api.github.com/repos/hasura/ndc-postgres/releases/latest | jq -r .tag_name) | |
echo "Using NDC Postgres version: ${NDC_POSTGRES_VERSION}" | |
# Download and setup NDC Postgres | |
BINARY_URL="https://github.com/hasura/ndc-postgres/releases/download/${NDC_POSTGRES_VERSION}/ndc-postgres-cli-x86_64-unknown-linux-gnu" | |
curl -L --fail -o ndc-postgres-cli "${BINARY_URL}" | |
chmod +x ndc-postgres-cli | |
# Initialize and configure NDC using existing metadata | |
./ndc-postgres-cli update | |
# Start NDC service | |
docker compose up -d connector | |
# Wait for NDC service to be healthy | |
until docker compose ps connector | grep "healthy"; do | |
echo "Waiting for NDC service..." | |
sleep 5 | |
if docker compose ps connector | grep -q "(Exit"; then | |
echo "Error: NDC service failed to start" | |
docker compose logs connector | |
exit 1 | |
fi | |
done | |
- name: Download and Setup NDC Test | |
working-directory: static/relational/postgres | |
run: | | |
curl -L --fail -o ndc-test https://github.com/hasura/ndc-spec/releases/download/v0.1.6/ndc-test-x86_64-unknown-linux-gnu | |
chmod +x ndc-test | |
- name: Run Tests | |
working-directory: static/relational/postgres | |
run: | | |
./ndc-test replay --endpoint http://localhost:8080 --snapshots-dir ../../relational | |
- name: Collect Logs on Failure | |
if: failure() | |
working-directory: static/relational/postgres | |
run: | | |
mkdir -p logs | |
docker compose logs postgres > logs/postgres.log | |
docker compose logs connector > logs/connector.log | |
- name: Upload Logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-logs | |
path: static/relational/postgres/logs/ | |
retention-days: 7 | |
permissions: | |
contents: read | |
pull-requests: read |