|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +jobs: |
| 4 | + |
| 5 | + integration-tests: |
| 6 | + docker: |
| 7 | + - image: cimg/python:3.9.9 |
| 8 | + - image: cimg/postgres:14.0 |
| 9 | + |
| 10 | + resource_class: small |
| 11 | + |
| 12 | + environment: |
| 13 | + DBT_PROFILES_DIR: ./integration_tests/ci |
| 14 | + DBT_PROJECT_DIR: ./integration_tests |
| 15 | + BIGQUERY_SERVICE_KEY_PATH: "/home/circleci/bigquery-service-key.json" |
| 16 | + |
| 17 | + steps: |
| 18 | + - checkout |
| 19 | + - run: |
| 20 | + name: Install Python packages |
| 21 | + command: | |
| 22 | + python3 -m venv venv |
| 23 | + . venv/bin/activate |
| 24 | + pip install -U pip setuptools wheel |
| 25 | + pip install dbt-core dbt-postgres dbt-bigquery dbt-snowflake |
| 26 | +
|
| 27 | + - run: |
| 28 | + name: Install dbt dependencies |
| 29 | + command: | |
| 30 | + . venv/bin/activate |
| 31 | + dbt deps --project-dir $DBT_PROJECT_DIR |
| 32 | +
|
| 33 | + - run: |
| 34 | + name: "Run Tests - Postgres" |
| 35 | + environment: |
| 36 | + POSTGRES_HOST: localhost |
| 37 | + POSTGRES_TEST_USER: postgres |
| 38 | + POSTGRES_TEST_PASSWORD: '' |
| 39 | + POSTGRES_TEST_PORT: 5432 |
| 40 | + POSTGRES_TEST_DATABASE: circle_test |
| 41 | + command: | |
| 42 | + . venv/bin/activate |
| 43 | + dbt build -t postgres --project-dir $DBT_PROJECT_DIR |
| 44 | +
|
| 45 | + - run: |
| 46 | + name: "Set up GCP credentials" |
| 47 | + command: | |
| 48 | + echo "Writing to $BIGQUERY_SERVICE_KEY_PATH" |
| 49 | + echo $BIGQUERY_SERVICE_KEY > $BIGQUERY_SERVICE_KEY_PATH |
| 50 | + FILESIZE=$(stat -c%s "$BIGQUERY_SERVICE_KEY_PATH") |
| 51 | + echo "Size of $BIGQUERY_SERVICE_KEY_PATH = $FILESIZE bytes." |
| 52 | + echo "BIGQUERY_TEST_DATABASE = $BIGQUERY_TEST_DATABASE" |
| 53 | +
|
| 54 | + - run: |
| 55 | + name: "Run Tests - BigQuery" |
| 56 | + command: | |
| 57 | + . venv/bin/activate |
| 58 | + dbt build -t bigquery --project-dir $DBT_PROJECT_DIR |
| 59 | +
|
| 60 | + - run: |
| 61 | + name: "Run Tests - Snowflake" |
| 62 | + command: | |
| 63 | + . venv/bin/activate |
| 64 | + dbt build -t snowflake --project-dir $DBT_PROJECT_DIR |
| 65 | +
|
| 66 | + - store_artifacts: |
| 67 | + path: ./logs |
| 68 | + |
| 69 | +workflows: |
| 70 | + version: 2 |
| 71 | + test-all: |
| 72 | + jobs: |
| 73 | + - integration-tests |
0 commit comments