Skip to content

docs: fix the readme file #24

docs: fix the readme file

docs: fix the readme file #24

Workflow file for this run

---
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
# @see https://docs.github.com/en/actions/guides/creating-postgresql-service-containers
# @see https://github.com/actions/virtual-environments
# @see https://www.postgresql.jp/document/11/html/app-pgrestore.html
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
name: Test
timeout-minutes: 5
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
postgres:
- 10-alpine
- 11-alpine
- 12-alpine
- 13-alpine
- 14-alpine
- 15-alpine
- 16-alpine
services:
postgres:
image: postgres:${{ matrix.postgres }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_PASSWORD: postgres
POSTGRES_INITDB_ARGS: '--auth-host=scram-sha-256'
env:
PGHOST: 127.0.0.1
PGPORT: 5432
PGDATABASE: postgres
steps:
- name: Install PostgreSQL clients
run: sudo apt update && sudo apt install -y --no-install-recommends postgresql-client
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache: true
- name: Build
run: make
- name: Create role for test
run: |
echo -n "CREATE ROLE test WITH LOGIN PASSWORD " >> $SQL_FILE_PATH
echo -n "'" >> $SQL_FILE_PATH
./cmd/tool/encrypt test | tr -d '\n' >> $SQL_FILE_PATH
echo "';" >> $SQL_FILE_PATH
cat $SQL_FILE_PATH | tee /dev/stderr | psql
env:
SQL_FILE_PATH: /tmp/create_role.sql
PGUSER: postgres
PGPASSWORD: postgres
- name: Check roles out
run: psql -c 'SELECT usename, passwd FROM pg_catalog.pg_shadow'
env:
PGUSER: postgres
PGPASSWORD: postgres
- name: Test login success
run: psql -c 'SELECT user'
env:
PGUSER: test
PGPASSWORD: test
- name: Test login fail
run: psql -c 'SELECT user' || echo 'fail ok'
env:
PGUSER: test
PGPASSWORD: wrong