Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .circleci/config.yml #161

Merged
merged 19 commits into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: 2.1

jobs:

integration-tests:
docker:
- image: cimg/python:3.9.9
- image: cimg/postgres:14.0

resource_class: small

environment:
DBT_PROFILES_DIR: ./integration_tests/ci
DBT_PROJECT_DIR: ./integration_tests
BIGQUERY_SERVICE_KEY_PATH: "/home/circleci/bigquery-service-key.json"

steps:
- checkout
- run:
name: Install Python packages
command: |
python3 -m venv venv
. venv/bin/activate
pip install -U pip setuptools wheel
pip install dbt-core dbt-postgres dbt-bigquery dbt-snowflake

- run:
name: Install dbt dependencies
command: |
. venv/bin/activate
dbt deps --project-dir $DBT_PROJECT_DIR

- run:
name: "Run Tests - Postgres"
environment:
POSTGRES_HOST: localhost
POSTGRES_TEST_USER: postgres
POSTGRES_TEST_PASSWORD: ''
POSTGRES_TEST_PORT: 5432
POSTGRES_TEST_DATABASE: circle_test
command: |
. venv/bin/activate
dbt build -t postgres --project-dir $DBT_PROJECT_DIR

- run:
name: "Set up GCP credentials"
command: |
echo "Writing to $BIGQUERY_SERVICE_KEY_PATH"
echo $BIGQUERY_SERVICE_KEY > $BIGQUERY_SERVICE_KEY_PATH
FILESIZE=$(stat -c%s "$BIGQUERY_SERVICE_KEY_PATH")
echo "Size of $BIGQUERY_SERVICE_KEY_PATH = $FILESIZE bytes."
echo "BIGQUERY_TEST_DATABASE = $BIGQUERY_TEST_DATABASE"

- run:
name: "Run Tests - BigQuery"
command: |
. venv/bin/activate
dbt build -t bigquery --project-dir $DBT_PROJECT_DIR

- run:
name: "Run Tests - Snowflake"
command: |
. venv/bin/activate
dbt build -t snowflake --project-dir $DBT_PROJECT_DIR

- store_artifacts:
path: ./logs

workflows:
version: 2
test-all:
jobs:
- integration-tests
88 changes: 0 additions & 88 deletions .github/workflows/pr_to_main.yml

This file was deleted.

36 changes: 36 additions & 0 deletions integration_tests/ci/profiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
config:
send_anonymous_usage_stats: False
use_colors: True

integration_tests:
outputs:
postgres:
type: postgres
host: "{{ env_var('POSTGRES_HOST') }}"
user: "{{ env_var('POSTGRES_TEST_USER') }}"
pass: "{{ env_var('POSTGRES_TEST_PASSWORD') }}"
port: "{{ env_var('POSTGRES_TEST_PORT') | as_number }}"
dbname: "{{ env_var('POSTGRES_TEST_DATABASE') }}"
schema: dbt_utils_integration_tests_postgres
threads: 5

bigquery:
type: bigquery
method: service-account
keyfile: "{{ env_var('BIGQUERY_SERVICE_KEY_PATH') }}"
project: "{{ env_var('BIGQUERY_TEST_DATABASE') }}"
schema: "{{ env_var('BIGQUERY_TEST_SCHEMA') }}"
threads: 10

snowflake:
type: snowflake
account: "{{ env_var('SNOWFLAKE_ACCOUNT') }}"
user: "{{ env_var('SNOWFLAKE_TEST_USER') }}"
password: "{{ env_var('SNOWFLAKE_TEST_PASSWORD') }}"
role: "{{ env_var('SNOWFLAKE_TEST_ROLE') }}"
database: "{{ env_var('SNOWFLAKE_TEST_DATABASE') }}"
warehouse: "{{ env_var('SNOWFLAKE_TEST_WAREHOUSE') }}"
schema: "{{ env_var('SNOWFLAKE_TEST_SCHEMA') }}"
threads: 10

target: postgres
49 changes: 0 additions & 49 deletions integration_tests/ci/sample.profiles.yml

This file was deleted.

38 changes: 0 additions & 38 deletions profiles.yml

This file was deleted.