moving dbt automation into backend repo #3
Workflow file for this run
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: Dalgo UI4T Integration Tests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [main] | |
jobs: | |
tests: | |
env: | |
TEST_PG_DBHOST: localhost | |
TEST_PG_DBPORT: 5555 | |
TEST_PG_DBUSER: dbt_automation_user | |
TEST_PG_DBPASSWORD: ${{ secrets.CI_DBPASSWORD }} | |
TEST_PG_DBNAME: ${{ secrets.CI_DBNAME }} | |
TEST_PG_DBSCHEMA_SRC: pytest_staging | |
TEST_BG_SERVICEJSON: ${{ secrets.TEST_BG_SERVICEJSON }} | |
TEST_BG_LOCATION: ${{ secrets.TEST_BG_LOCATION }} | |
TEST_BG_DATASET_SRC: ${{ secrets.TEST_BG_DATASET_SRC }} | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_USER: dbt_automation_user | |
POSTGRES_PASSWORD: ${{ secrets.CI_DBPASSWORD }} | |
POSTGRES_DB: ${{ secrets.CI_DBNAME }} | |
ports: | |
- 5555:5432 | |
options: --health-cmd "pg_isready -U dbt_automation_user" --health-interval 10s --health-timeout 5s --health-retries 5 | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# - name: Create known_hosts file | |
# run: | | |
# mkdir -p ~/.ssh | |
# touch ~/.ssh/known_hosts | |
# - name: Add remote host key to known_hosts | |
# run: ssh-keyscan ${{ secrets.SERVERIP }} >> ~/.ssh/known_hosts | |
# - name: Login to the jump server and port forward to connect to the postgres warehouse | |
# run: | | |
# eval `ssh-agent -s` | |
# ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" | |
# ssh -L 5555:${{ secrets.TEST_PG_DBHOST }}:${{ secrets.TEST_PG_DBPORT }} -N -f ${{ secrets.SSH_USERNAME }}@${{ secrets.SERVERIP }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Create logs directory | |
run: mkdir -p ddpui/logs | |
- name: Seed data in test warehouse | |
run: | | |
export PYTHONPATH=$(pwd) | |
python ddpui/dbt_automation/seeds/seed.py --warehouse postgres | |
python ddpui/dbt_automation/seeds/seed.py --warehouse bigquery | |
- name: Run dbt automation (ui4t) integration tests | |
run: | | |
pytest ddpui/tests/integration_tests/dbt_automation/*.py -s |