Skip to content

DEBUG: Ignore errors #24

DEBUG: Ignore errors

DEBUG: Ignore errors #24

Workflow file for this run

name: Test database creation and TAP_SCHEMA upload
on: [push]
jobs:
postgresql:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: rubin
POSTGRES_PASSWORD: rubin
POSTGRES_DB: sdm_schemas_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip uv
uv pip install --system -r requirements.txt
- name: Set engine URL
run: echo "FELIS_ENGINE_URL=postgresql+psycopg2://rubin:rubin@localhost:5432/sdm_schemas_test" >> $GITHUB_ENV
# Create databases from YAML files. Drop existing databases since some of
# the schema names are duplicated and also ignore constraints since many
# schemas are missing required indices for FK constraints.
- name: Create databases
run: |
for file in yml/*.yaml; do
echo "Creating database from $file..."
felis --log-level ERROR create --drop --ignore-constraints "$file"
echo "Done creating database from $file"
done
- name: Create SQL files
run: |
for file in yml/*.yaml; do
echo "Creating SQL from $file..."
felis --log-level ERROR create --engine-url=postgresql+psycopg2:// --output-file "${file%.yaml}.sql" "$file"
echo "Done creating SQL from $file"
done
- name: Initialize TAP_SCHEMA database
run: |
felis init-tap $FELIS_ENGINE_URL
# Upload to TAP_SCHEMA database. Clear the tables after each upload to
# avoid conflicts between schemas. Skip consdb schemas since they are
# currently incompatible.
- name: Upload to TAP_SCHEMA database
run: |
for file in yml/*.yaml; do
filename=$(basename "$file")
if [[ $filename == cdb_* ]]; then
echo "Skipping TAP_SCHEMA upload of $file"
continue
fi
echo "Uploading to TAP_SCHEMA from $file..."
felis --log-level ERROR load-tap "$file"
echo "Done uploading to TAP_SCHEMA from $file"
psql postgresql://rubin:rubin@localhost/sdm_schemas_test -q -c "TRUNCATE TABLE columns, key_columns, keys, schemas, tables;"
done
mysql:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: sdm_schemas_test
MYSQL_USER: rubin
MYSQL_PASSWORD: rubin
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip uv
uv pip install --system -r requirements.txt
- name: Grant privileges to MySQL user
run: |
mysql -h 127.0.0.1 -P 3306 -u root -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'rubin'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES;"
- name: Set engine URL
run: echo "FELIS_ENGINE_URL=mysql+pymysql://rubin:rubin@localhost:3306" >> $GITHUB_ENV
# Create databases from YAML files. Drop existing databases since some of
# the schema names are duplicated and also ignore constraints since many
# schemas are missing required indices for FK constraints.
- name: Create databases
run: |
set +e
for file in yml/*.yaml; do
filename=$(basename "$file")
if [[ $filename == "apdb.yaml" ]]; then
echo "Skipping TAP_SCHEMA upload of $file"
continue
fi
echo "Creating database from $file..."
felis --log-level ERROR create --drop --ignore-constraints "$file"
echo "Done creating database from $file"
done
set -e
- name: Create SQL files
run: |
for file in yml/*.yaml; do
echo "Creating SQL from $file..."
felis --log-level ERROR create --engine-url=mysql+pymysql:// --output-file "${file%.yaml}.sql" "$file"
echo "Done creating SQL from $file"
done
- name: Initialize TAP_SCHEMA database
run: |
felis init-tap $FELIS_ENGINE_URL
# Upload to TAP_SCHEMA database. Clear the tables after each upload to
# avoid conflicts between schemas. Skip consdb schemas since they are
# currently incompatible.
- name: Upload to TAP_SCHEMA database
run: |
for file in yml/*.yaml; do
filename=$(basename "$file")
if [[ $filename == cdb_* ]]; then
echo "Skipping TAP_SCHEMA upload of $file"
continue
fi
echo "Uploading to TAP_SCHEMA from $file..."
felis --log-level ERROR load-tap "$file"
echo "Done uploading to TAP_SCHEMA from $file"
mysql -u rubin -prubin -h localhost sdm_schemas_test -e "TRUNCATE TABLE columns, key_columns, keys, schemas, tables;"
done