Skip to content

chore: add kubernetes deployment example with initContainer #18

chore: add kubernetes deployment example with initContainer

chore: add kubernetes deployment example with initContainer #18

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libsqlite3-dev libpq-dev pkg-config
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: make
- name: Run Rust Unit Tests
run: cd sql_translator && cargo test
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries
path: |
sqlite_hook.so
test_sqlite
test_sqlite_wrapper.sh
build-arch:
runs-on: ubuntu-24.04
container:
image: archlinux:base-devel
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm sqlite postgresql-libs rust
- name: Build
run: make
- name: Run Rust Unit Tests
run: cd sql_translator && cargo test
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-arch
path: |
sqlite_hook.so
test_sqlite
test_sqlite_wrapper.sh
test-postgres:
needs: build
runs-on: ubuntu-24.04
strategy:
matrix:
postgres-version: [14, 15, 16, 17, 18]
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install runtime dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsqlite3-dev libpq-dev postgresql-client
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: binaries
- name: Wait for Postgres
run: |
until PGPASSWORD=password pg_isready -h 127.0.0.1 -U postgres; do
echo "Waiting for Postgres..."
sleep 2
done
- name: Set permissions
run: chmod +x test_sqlite test_sqlite_wrapper.sh
- name: Run C Integration Test
env:
PG_CONNINFO: "host=127.0.0.1 user=postgres password=password dbname=postgres"
PGPASSWORD: "password"
run: |
# Run and show output, but fail if connection message is missing
./test_sqlite_wrapper.sh
release:
needs: [test-postgres, build-arch]
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
permissions:
contents: write
pull-requests: write
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: simple
- uses: actions/checkout@v4
- name: Download ubuntu binaries
uses: actions/download-artifact@v4
with:
name: binaries
path: binaries-ubuntu
- name: Download arch binaries
uses: actions/download-artifact@v4
with:
name: binaries-arch
path: binaries-arch
- name: Rename binaries
run: |
mv binaries-ubuntu/sqlite_hook.so binaries-ubuntu/sqlite_hook-ubuntu.so
mv binaries-arch/sqlite_hook.so binaries-arch/sqlite_hook-arch.so
- name: Create Release
if: ${{ steps.release.outputs.release_created }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release.outputs.tag_name }}
files: |
binaries-ubuntu/sqlite_hook-ubuntu.so
binaries-arch/sqlite_hook-arch.so