Skip to content

Commit

Permalink
to-database: Add CI configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Dec 14, 2023
1 parent b6fd5ec commit 16fafe1
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: "Tests"

on:
pull_request: ~
push:
branches: [ main ]

# Allow job to be triggered manually.
workflow_dispatch:

# Run job each night after CrateDB nightly has been published.
schedule:
- cron: '0 3 * * *'

# Cancel in-progress jobs when pushing to the same branch.
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:

tests:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.11"]

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}

name: Python ${{ matrix.python-version }} on OS ${{ matrix.os }}
steps:

- name: Acquire sources
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
cache-dependency-path:
requirements.txt

- name: Set up PostgreSQL container.
run: |
docker compose -f docker-compose.yml up -d
- name: Set up project
run: |
# `setuptools 0.64.0` adds support for editable install hooks (PEP 660).
# https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v6400
pip install "setuptools>=64" --upgrade
# Install requirements.
pip install -r requirements.txt
- name: Verify "to-database"
run: |
cd to-database
meltano install
meltano run test
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Docker Compose file for pgvector -- open-source vector similarity search for PostgreSQL.
# https://github.com/pgvector/pgvector
---
# docker compose -f docker-compose.yml up
version: "2.1"
services:
postgres:
image: ankane/pgvector:latest
command: postgres -c log_statement=all
environment:
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "5432:5432"
File renamed without changes.
6 changes: 2 additions & 4 deletions to-database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ within `meltano.yml`.

Run a PostgreSQL server with pgvector extension.
```shell
docker run --rm -it --publish=5432:5432 \
--env "POSTGRES_HOST_AUTH_METHOD=trust" \
--volume "$(pwd)/init.sql:/docker-entrypoint-initdb.d/init.sql" \
ankane/pgvector postgres -c log_statement=all
docker compose -f docker-compose.yml up
```

In another shell, before running any `psql` command, define the authentication
Expand Down Expand Up @@ -48,6 +45,7 @@ psql postgresql://postgres@localhost/ --command '\d load_jsonl_array_jsonb.array
psql postgresql://postgres@localhost/ --command 'SELECT * from load_jsonl_array_jsonb.array_float;'
```

Run smoke tests.
```shell
meltano run tap-smoke-test target-postgres
psql postgresql://postgres@localhost/ --command '\dt tap_smoke_test.*'
Expand Down
7 changes: 7 additions & 0 deletions to-database/meltano.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,10 @@ plugins:
config:
sqlalchemy_url: postgresql://postgres@localhost/
add_record_metadata: true

jobs:
- name: test
tasks:
- tap-smoke-test target-postgres
- load-jsonl-array-jsonb target-postgres
- load-jsonl-array-vector target-postgres

0 comments on commit 16fafe1

Please sign in to comment.