Skip to content

Input with PostgreSQL #149

Input with PostgreSQL

Input with PostgreSQL #149

name: Input with PostgreSQL
on:
pull_request:
push:
schedule:
- cron: "0 18 * * *" # 3am in Asia/Tokyo
jobs:
input-with-postgresql:
# push: always run.
# pull_request: run only when the PR is submitted from a forked repository, not within this repository.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
java: [ 8, 11, 17, 21 ]
postgres: [ "postgres:12", "postgres:13", "postgres:14", "postgres:15", "postgres:16" ]
runs-on: ubuntu-latest
services:
# scram-sha-256 is default in PostgreSQL 14+, but needs the newer JDBC driver.
postgres:
image: ${{ matrix.postgres }}
ports:
- "5432:5432"
env:
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: "md5"
POSTGRES_INITDB_ARGS: "--auth-host=md5"
steps:
- uses: actions/checkout@v4
- name: Set up OpenJDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: "temurin"
- name: Download Embulk
uses: ./.github/actions/install-embulk
- name: List files under the user home directory
run: ls -la "$HOME"
- name: Install embulk-input-postgresql
run: java -jar "embulk.jar" install "org.embulk:embulk-input-postgresql:0.13.2"
- name: List files under the Embulk home directory
run: ls -laR "$HOME/.embulk/"
- name: Create a table in PostgreSQL
run: psql -h localhost -U postgres -d postgres -f "input-postgresql/create-table.sql"
env:
PGPASSWORD: postgres
- name: Insert data in PostgreSQL
run: psql -h localhost -U postgres -d postgres -f "input-postgresql/insert-data.sql"
env:
PGPASSWORD: postgres
- name: Show data in PostgreSQL
run: psql -h localhost -U postgres -d postgres -c "select * from test;"
env:
PGPASSWORD: postgres
- name: Run Embulk
run: java -jar "embulk.jar" run "input-postgresql/postgresql.yml"