feat(examples): add examples #26
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: yarn | |
- run: yarn install --frozen-lockfile | |
- run: yarn lint | |
build: | |
timeout-minutes: 15 | |
needs: lint | |
services: | |
gaussdb: | |
image: opengauss/opengauss | |
env: | |
GS_USERNAME: ci_user | |
GS_PASSWORD: openGauss@123 | |
GS_USER_PASSWORD: openGauss@123 | |
POSTGRES_HOST_AUTH_METHOD: 'trust' | |
POSTGRES_INITDB_ARGS: "--auth-local=md5" | |
GS_DB: ci_db_test | |
ports: | |
- 5432:5432 | |
# options: --health-cmd "su - omm -c \"gs_ctl status\"" --health-interval 10s --health-timeout 5s --health-retries 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- '16' | |
- '18' | |
- '20' | |
- '22' | |
- '23' | |
- '24' | |
os: | |
- ubuntu-latest | |
name: Node.js ${{ matrix.node }} | |
runs-on: ubuntu-latest | |
env: | |
GAUSSUSER: ci_user | |
GAUSSPASSWORD: openGauss@123 | |
GAUSSHOST: localhost | |
GAUSSDATABASE: ci_db_test | |
GAUSSTESTNOSSL: 'true' | |
SHA256_TEST_GAUSSUSER: sha256_test | |
SHA256_TEST_GAUSSPASSWORD: test4@scram | |
steps: | |
- name: Show OS | |
run: | | |
uname -a | |
- name: Wait for GaussDB to be ready | |
run: | | |
timeout 60 bash -c 'until pg_isready -h localhost -p 5432; do sleep 2; done' | |
- name: Setup SHA256 authentication | |
run: | | |
# Wait for database to be fully started | |
sleep 15 | |
# Get container ID | |
CONTAINER_ID=$(docker ps --filter "ancestor=opengauss/opengauss" --format "{{.ID}}") | |
docker exec $CONTAINER_ID su - omm -c "gs_guc set -D /var/lib/opengauss/data/ -c 'password_encryption_type = 2'" | |
# Add SHA256 authentication rule to pg_hba.conf | |
docker exec $CONTAINER_ID su - omm -c "gs_guc set -D /var/lib/opengauss/data/ -h 'host all sha256_test 0.0.0.0/0 sha256'" | |
docker exec $CONTAINER_ID su - omm -c "gs_ctl reload -D /var/lib/opengauss/data/" | |
sleep 5 | |
PGPASSWORD=openGauss@123 psql -h localhost -U ci_user -d ci_db_test -c "CREATE ROLE sha256_test login password 'test4@scram';" | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: yarn | |
- run: yarn install --frozen-lockfile | |
- run: yarn test |