Skip to content

Commit

Permalink
Support SSL connection. v0.5.0 (#49)
Browse files Browse the repository at this point in the history
Example: sqlant postgresql://sql:sql@localhost/sql?sslmode=require
  • Loading branch information
kurotych authored Feb 2, 2025
1 parent 0ed97a0 commit dfbf271
Show file tree
Hide file tree
Showing 8 changed files with 402 additions and 16 deletions.
31 changes: 29 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
version: 2.1

jobs:
build_musl_and_test_ssl:
docker:
- image: cimg/rust:1.83-node
- image: cimg/postgres:17.1
environment:
POSTGRES_USER: sql
POSTGRES_PASSWORD: sql
POSTGRES_DB: sql
entrypoint: bash
command: >
-c '
openssl req -nodes -new -x509 -subj "/CN=localhost" -keyout /tmp/server.key -out /tmp/server.crt &&
chown postgres /tmp/server.key &&
chmod 600 /tmp/server.key &&
exec /docker-entrypoint.sh -c ssl=on -c ssl_cert_file=/tmp/server.crt -c ssl_key_file=/tmp/server.key
'
steps:
- checkout
- run: sudo apt update
- run: sudo apt-get install -y musl-tools
- run: rustup target add x86_64-unknown-linux-musl
- run: cargo build --release --target x86_64-unknown-linux-musl
- run: psql -d postgresql://sql:sql@localhost/sql?sslmode=require -f ./tests/test_db.sql
- run: ./target/x86_64-unknown-linux-musl/release/sqlant postgresql://sql:sql@localhost/sql?sslmode=require
resource_class: small

run_integration_and_smoke_tests:
docker:
- image: cimg/rust:1.77-node
- image: cimg/rust:1.83-node
environment:
TEST_DATABASE_URL: postgresql://sql:sql@localhost/sql
- image: cimg/postgres:14.2
- image: cimg/postgres:17.1
environment:
POSTGRES_USER: sql
POSTGRES_PASSWORD: sql
Expand Down Expand Up @@ -67,4 +93,5 @@ jobs:
workflows:
default:
jobs:
- build_musl_and_test_ssl
- run_integration_and_smoke_tests
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Run Docker Image

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:15-3.3
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Build Docker Image
run: docker build -t sqlant .

- name: Setup Apt packages
run: sudo apt update && sudo apt install -y postgresql-client

- name: Setup DB schema
run: psql -d postgresql://user:password@localhost/db -f ./tests/test_db.sql

- name: Run Docker Image
run: docker run --network host sqlant postgresql://user:password@localhost/db
Loading

0 comments on commit dfbf271

Please sign in to comment.