Release R2.6.0 #3170
This file contains 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: Make-docs-to-webpage | |
# Trigger whenever changes are made to the main branch | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
make_docs: | |
name: Update DB schema files in webpage | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14.8 | |
env: | |
POSTGRES_DB: caseflow_certification_test | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
ports: ["5432:5432"] | |
redis: | |
image: redis:2.8.23 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: ["6379:6379"] | |
steps: | |
- name: Debugging info | |
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: | | |
# prints GITHUB_CONTEXT env variable | |
env | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Ruby and install gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Setup test database | |
env: | |
RAILS_ENV: make_docs | |
POSTGRES_HOST: localhost | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
run: | | |
echo "::group::Set up Caseflow DB" | |
bin/rails db:create:primary && bin/rails db:schema:load:primary | |
echo "::endgroup::" | |
echo "::group::Set up Caseflow ETL DB" | |
bundle exec rake db:create:etl db:schema:load:etl | |
echo "::endgroup::" | |
# Skipping VACOLS since Oracle DB is not set up | |
# bundle exec rake spec:setup_vacols | |
# Need graphviz to create ERDs | |
- name: Setup Graphviz | |
uses: ts-graphviz/setup-graphviz@v1 | |
- name: Create DB schema documentation | |
env: | |
RAILS_ENV: make_docs | |
POSTGRES_HOST: localhost | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
UPDATE_SCHEMA_ERD_IMAGES: true | |
run: | | |
ln -s Makefile.example Makefile | |
echo "::group::Caseflow schema" | |
make erd-caseflow doc-schema-caseflow | |
echo "::endgroup::" | |
echo "::group::Caseflow ETL schema" | |
make erd-etl doc-schema-etl | |
echo "::endgroup::" | |
# Skipping VACOLS since Oracle DB is not set up | |
# make erd-vacols | |
# The following is adapted from: https://github.com/SwiftDocOrg/github-wiki-publish-action/blob/v1/entrypoint.sh | |
# and https://github.com/Andrew-Chen-Wang/github-wiki-action/blob/master/entrypoint.sh | |
# and https://github.community/t/how-to-updade-repo-wiki-from-github-actions/121151/7 | |
- name: Checkout branch main-gh-pages | |
uses: actions/checkout@v4 | |
with: | |
ref: main-gh-pages | |
path: main-gh-pages_checkout | |
- name: Copy results of `make docs` to checkout of main-gh-pages | |
run: | | |
rsync -av --exclude .git --exclude .keep "docs/schema/" "main-gh-pages_checkout/schema/make_docs/" | |
- name: Update Jailer-generated DB schema docs for Caseflow using results of `make docs` | |
env: | |
POSTGRES_DB: caseflow_certification_test | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
run: | | |
CASEFLOW_HOME=`pwd` | |
cd main-gh-pages_checkout/schema/bin | |
sh ./gen_jailer_schema_docs.sh "$CASEFLOW_HOME" ../make_docs/caseflow-jailer_polymorphic_associations.csv | |
- name: Compare (and locally commit) generated docs against main-gh-pages branch | |
id: compare_docs | |
env: | |
WIKI_COMMIT_MESSAGE: '`make docs` GH Action: automatically update DB schema documentation files' | |
WIKI_COMMIT_USER_EMAIL: '[email protected]' | |
WIKI_COMMIT_USER_NAME: 'samantha-quillman' | |
run: | | |
cd main-gh-pages_checkout | |
make github_action_pre_commit_hook | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "name=changes_docs::false" >> $GITHUB_OUTPUT | |
echo "::group::No changes to make_docs" | |
ls -alR schema/make_docs | |
echo "::endgroup::" | |
else | |
echo "name=changes_docs::true" >> $GITHUB_OUTPUT | |
echo "::group::Committing changes locally" | |
git config --local user.email "$WIKI_COMMIT_USER_EMAIL" | |
git config --local user.name "$WIKI_COMMIT_USER_NAME" | |
git commit -m "$WIKI_COMMIT_MESSAGE" && git push | |
echo "::endgroup::" | |
fi |