|
1 | 1 | version: 2 |
2 | 2 |
|
3 | 3 | jobs: |
4 | | - build: |
| 4 | + |
| 5 | + integration-postgres: |
5 | 6 | docker: |
6 | | - - image: cimg/python:3.9.9 |
| 7 | + - image: cimg/python:3.9 |
7 | 8 | - image: cimg/postgres:9.6 |
8 | 9 | environment: |
9 | 10 | POSTGRES_USER: root |
| 11 | + environment: |
| 12 | + POSTGRES_HOST: localhost |
| 13 | + POSTGRES_USER: root |
| 14 | + DBT_ENV_SECRET_POSTGRES_PASS: '' |
| 15 | + POSTGRES_PORT: 5432 |
| 16 | + POSTGRES_DATABASE: circle_test |
| 17 | + POSTGRES_SCHEMA: codegen_integration_tests_postgres |
| 18 | + |
10 | 19 | steps: |
11 | 20 | - checkout |
12 | | - |
13 | | - - run: |
14 | | - name: setup_creds |
15 | | - command: | |
16 | | - echo $BIGQUERY_SERVICE_ACCOUNT_JSON > ${HOME}/bigquery-service-key.json |
17 | | -
|
18 | | - - restore_cache: |
19 | | - key: deps1-{{ .Branch }} |
20 | | - |
21 | | - - run: |
22 | | - name: "Setup dbt" |
23 | | - command: | |
24 | | - python3 -m venv dbt_venv |
25 | | - . dbt_venv/bin/activate |
26 | | -
|
27 | | - python -m pip install --upgrade pip setuptools |
28 | | - python -m pip install --pre dbt-core dbt-postgres dbt-redshift dbt-snowflake dbt-bigquery |
29 | | -
|
| 21 | + - run: pip install --pre dbt-core dbt-postgres |
30 | 22 | - run: |
31 | 23 | name: "Run Tests - Postgres" |
32 | | - environment: |
33 | | - POSTGRES_HOST: localhost |
34 | | - POSTGRES_USER: root |
35 | | - DBT_ENV_SECRET_POSTGRES_PASS: "" |
36 | | - POSTGRES_PORT: 5432 |
37 | | - POSTGRES_DATABASE: circle_test |
38 | | - POSTGRES_SCHEMA: codegen_integration_tests_postgres |
39 | 24 | command: | |
40 | | - . dbt_venv/bin/activate |
41 | 25 | cd integration_tests |
42 | 26 | dbt --warn-error deps --target postgres |
43 | 27 | dbt --warn-error run-operation create_source_table --target postgres |
44 | 28 | dbt --warn-error seed --target postgres --full-refresh |
45 | 29 | dbt --warn-error run --target postgres |
46 | 30 | dbt --warn-error test --target postgres |
| 31 | + - store_artifacts: |
| 32 | + path: integration_tests/logs |
| 33 | + - store_artifacts: |
| 34 | + path: integration_tests/target |
| 35 | + |
| 36 | + # The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass |
| 37 | + resource_class: large |
47 | 38 |
|
| 39 | + integration-redshift: |
| 40 | + docker: |
| 41 | + - image: cimg/python:3.9 |
| 42 | + steps: |
| 43 | + - checkout |
| 44 | + - run: pip install --pre dbt-core dbt-redshift |
48 | 45 | - run: |
49 | 46 | name: "Run Tests - Redshift" |
50 | 47 | command: | |
51 | | - . dbt_venv/bin/activate |
52 | | - echo `pwd` |
53 | 48 | cd integration_tests |
54 | 49 | dbt --warn-error deps --target redshift |
55 | 50 | dbt --warn-error run-operation create_source_table --target redshift |
56 | 51 | dbt --warn-error seed --target redshift --full-refresh |
57 | 52 | dbt --warn-error run --target redshift |
58 | 53 | dbt --warn-error test --target redshift |
| 54 | + - store_artifacts: |
| 55 | + path: integration_tests/logs |
| 56 | + - store_artifacts: |
| 57 | + path: integration_tests/target |
| 58 | + # The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass |
| 59 | + resource_class: large |
59 | 60 |
|
| 61 | + integration-snowflake: |
| 62 | + docker: |
| 63 | + - image: cimg/python:3.9 |
| 64 | + steps: |
| 65 | + - checkout |
| 66 | + - run: pip install --pre dbt-core dbt-snowflake |
60 | 67 | - run: |
61 | 68 | name: "Run Tests - Snowflake" |
62 | 69 | command: | |
63 | | - . dbt_venv/bin/activate |
64 | | - echo `pwd` |
65 | 70 | cd integration_tests |
66 | 71 | dbt --warn-error deps --target snowflake |
67 | 72 | dbt --warn-error run-operation create_source_table --target snowflake |
68 | 73 | dbt --warn-error seed --target snowflake --full-refresh |
69 | 74 | dbt --warn-error run --target snowflake |
70 | 75 | dbt --warn-error test --target snowflake |
| 76 | + - store_artifacts: |
| 77 | + path: integration_tests/logs |
| 78 | + - store_artifacts: |
| 79 | + path: integration_tests/target |
| 80 | + # The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass |
| 81 | + resource_class: large |
71 | 82 |
|
| 83 | + integration-bigquery: |
| 84 | + environment: |
| 85 | + BIGQUERY_SERVICE_KEY_PATH: "/home/circleci/bigquery-service-key.json" |
| 86 | + docker: |
| 87 | + - image: cimg/python:3.9 |
| 88 | + steps: |
| 89 | + - checkout |
| 90 | + - run: pip install --pre dbt-core dbt-bigquery |
| 91 | + - run: |
| 92 | + name: Setup Environment Variables |
| 93 | + command: | |
| 94 | + echo $BIGQUERY_SERVICE_ACCOUNT_JSON > ${HOME}/bigquery-service-key.json |
| 95 | + echo 'export BIGQUERY_KEYFILE_JSON="$BIGQUERY_SERVICE_ACCOUNT_JSON"' >> "$BASH_ENV" |
72 | 96 | - run: |
73 | 97 | name: "Run Tests - BigQuery" |
74 | | - environment: |
75 | | - BIGQUERY_SERVICE_KEY_PATH: "/home/circleci/bigquery-service-key.json" |
76 | | - |
77 | 98 | command: | |
78 | | - . dbt_venv/bin/activate |
79 | | - echo `pwd` |
80 | 99 | cd integration_tests |
81 | 100 | dbt --warn-error deps --target bigquery |
82 | 101 | dbt --warn-error run-operation create_source_table --target bigquery |
83 | 102 | dbt --warn-error seed --target bigquery --full-refresh |
84 | 103 | dbt --warn-error run --target bigquery |
85 | 104 | dbt --warn-error test --target bigquery |
86 | | -
|
87 | | - - save_cache: |
88 | | - key: deps1-{{ .Branch }} |
89 | | - paths: |
90 | | - - "dbt_venv" |
| 105 | + - store_artifacts: |
| 106 | + path: integration_tests/logs |
| 107 | + - store_artifacts: |
| 108 | + path: integration_tests/target |
| 109 | + # The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass |
| 110 | + resource_class: large |
91 | 111 |
|
92 | 112 | workflows: |
93 | 113 | version: 2 |
94 | 114 | test-all: |
95 | 115 | jobs: |
96 | | - - build: |
97 | | - context: |
98 | | - - profile-redshift |
99 | | - - profile-snowflake |
100 | | - - profile-bigquery |
| 116 | + - integration-postgres: |
| 117 | + context: profile-postgres |
| 118 | + - integration-redshift: |
| 119 | + context: profile-redshift |
| 120 | + requires: |
| 121 | + - integration-postgres |
| 122 | + - integration-snowflake: |
| 123 | + context: profile-snowflake |
| 124 | + requires: |
| 125 | + - integration-postgres |
| 126 | + - integration-bigquery: |
| 127 | + context: profile-bigquery |
| 128 | + requires: |
| 129 | + - integration-postgres |
0 commit comments