Skip to content

Commit

Permalink
feat: SchemaSpy shared workflow (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts authored Nov 13, 2024
1 parent f83e917 commit d358366
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 9 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/.schema-spy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: .Schema-Spy

on:
workflow_call:
inputs:
### Typical / recommended
flyway_args:
description: 'Flyway arguments'
default: 'info migrate info'
required: false
type: string
flyway_locations:
description: 'Flyway migrations location'
default: 'filesystem:./migrations'
required: false
type: string
flyway_schema:
description: 'Flyway default schema'
default: 'users'
required: false
type: string
schemaspy_schema:
description: 'SchemaSpy default schema'
default: 'users'
required: false
type: string

jobs:
schemaspy:
name: Generate Documentation
runs-on: ubuntu-24.04
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_DB: default
POSTGRES_USER: postgres
POSTGRES_PASSWORD: default
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- name: Flyway
uses: docker://flyway/flyway:10
env:
FLYWAY_URL: jdbc:postgresql://postgres:5432/default
FLYWAY_USER: postgres
FLYWAY_PASSWORD: default
FLYWAY_LOCATIONS: ${{ inputs.flyway_locations }}
FLYWAY_DEFAULT_SCHEMA: ${{ inputs.flyway_schema }}
with:
args: ${{ inputs.flyway_args }}

- name: Create Output Folder
run: |
mkdir -p output/schema
chmod a+rwx -R output
- name: Run Schemaspy
run: docker run --network host -v "$PWD/output:/output" schemaspy/schemaspy:6.2.4 -t pgsql11 -db default -host 127.0.0.1 -port 5432 -u postgres -p default -schemas ${{ inputs.schemaspy_schema }}

- name: Deploy to Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: output
14 changes: 5 additions & 9 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ concurrency:
cancel-in-progress: true

jobs:
testing:
name: Testing
uses: ./.github/workflows/.pr-close.yml
with:
remove_pvc: |
frontend,
backend
schema-spy:
name: Schema Spy
uses: ./.github/workflows/.schema-spy.yml

validate:
name: Validate
Expand Down Expand Up @@ -52,15 +48,15 @@ jobs:
deploys:
name: Deploys
needs: [builds, validate]
needs: [builds]
uses: ./.github/workflows/.deployer.yml
secrets:
oc_namespace: ${{ secrets.oc_namespace }}
oc_token: ${{ secrets.oc_token }}

results:
name: Results
needs: [deploys]
needs: [deploys, schema-spy, validate]
runs-on: ubuntu-24.04
steps:
- if: needs.deploys.outputs.triggered == 'true'
Expand Down

0 comments on commit d358366

Please sign in to comment.