5151 default : " latest_official"
5252 required : false
5353
54+ permissions : {}
55+
5456env :
5557 BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
5658 TESTS_DIR : ${{ github.workspace }}/dbt-data-reliability/integration_tests
5961 test :
6062 runs-on : ubuntu-latest
6163 timeout-minutes : 60
64+ permissions :
65+ contents : read
66+ env :
67+ WAREHOUSE : ${{ inputs.warehouse-type }}
68+ DBT_VERSION : ${{ inputs.dbt-version }}
6269 concurrency :
6370 # Serialises runs for the same warehouse × dbt-version × branch.
6471 # The schema name is derived from a hash of this group (see "Write dbt profiles").
@@ -160,37 +167,43 @@ jobs:
160167
161168 - name : Install dbt-vertica
162169 if : inputs.warehouse-type == 'vertica' && inputs.dbt-version != 'fusion'
170+ env :
171+ DBT_CORE_PIN : ${{ (!startsWith(inputs.dbt-version, 'latest') && format('=={0}', inputs.dbt-version)) || '' }}
163172 run : |
164173 # dbt-vertica pins dbt-core~=1.8 which lacks native support for the
165174 # "arguments" test property used by the integration-test framework.
166175 # Install dbt-vertica without deps, then install the requested
167176 # dbt-core version separately (dbt-vertica works fine with newer
168177 # dbt-core versions).
169178 pip install dbt-vertica --no-deps
170- pip install vertica-python \
171- "dbt-core${{ (!startsWith(inputs.dbt-version, 'latest') && format('=={0}', inputs.dbt-version)) || '' }}"
179+ pip install vertica-python "dbt-core${DBT_CORE_PIN}"
172180
173181 - name : Install dbt
174182 if : ${{ inputs.dbt-version != 'fusion' && inputs.warehouse-type != 'vertica' }}
175- run :
176- pip install${{ (inputs.dbt-version == 'latest_pre' && ' --pre') || '' }}
177- " dbt-core${{ (!startsWith(inputs.dbt-version, 'latest') && format('=={0}', inputs.dbt-version)) || '' }}"
178- " dbt-${{ (inputs.warehouse-type == 'databricks_catalog' && 'databricks') || (inputs.warehouse-type == 'spark' && 'spark[PyHive]') || (inputs.warehouse-type == 'athena' && 'athena-community') || inputs.warehouse-type }}${{ (!startsWith(inputs.dbt-version, 'latest') && format('~={0}', inputs.dbt-version)) || '' }}"
183+ env :
184+ PIP_PRE_FLAG : ${{ (inputs.dbt-version == 'latest_pre' && '--pre') || '' }}
185+ DBT_CORE_PIN : ${{ (!startsWith(inputs.dbt-version, 'latest') && format('=={0}', inputs.dbt-version)) || '' }}
186+ DBT_ADAPTER_PKG : ${{ (inputs.warehouse-type == 'databricks_catalog' && 'databricks') || (inputs.warehouse-type == 'spark' && 'spark[PyHive]') || (inputs.warehouse-type == 'athena' && 'athena-community') || inputs.warehouse-type }}
187+ DBT_ADAPTER_PIN : ${{ (!startsWith(inputs.dbt-version, 'latest') && format('~={0}', inputs.dbt-version)) || '' }}
188+ run : |
189+ pip install $PIP_PRE_FLAG "dbt-core${DBT_CORE_PIN}" "dbt-${DBT_ADAPTER_PKG}${DBT_ADAPTER_PIN}"
179190
180191 - name : Install dbt-fusion
181192 if : inputs.dbt-version == 'fusion'
182193 run : |
183194 curl -fsSL https://public.cdn.getdbt.com/fs/install/install.sh | sh -s --
184195
185196 - name : Install Elementary
197+ env :
198+ ELEMENTARY_EXTRA : ${{ (inputs.warehouse-type == 'databricks_catalog' && 'databricks') || inputs.warehouse-type }}
186199 run : |
187200 # For Vertica, dbt-vertica is already installed with --no-deps above;
188201 # using ".[vertica]" would re-resolve dbt-vertica's deps and downgrade
189202 # dbt-core to ~=1.8. Install elementary without the adapter extra.
190- if [ "${{ inputs.warehouse-type }} " = "vertica" ]; then
203+ if [ "$WAREHOUSE " = "vertica" ]; then
191204 pip install "./elementary"
192205 else
193- pip install "./elementary[${{ (inputs.warehouse-type == 'databricks_catalog' && 'databricks') || inputs.warehouse-type } }]"
206+ pip install "./elementary[${ELEMENTARY_EXTRA }]"
194207 fi
195208
196209 - name : Write dbt profiles
@@ -205,24 +218,25 @@ jobs:
205218 # Budget (PostgreSQL 63-char limit):
206219 # dbt_(4) + timestamp(13) + _(1) + branch(≤18) + _(1) + hash(8) = 45
207220 # + _elementary(11) + _gw7(4) = 60
208- CONCURRENCY_GROUP="tests_${{ inputs.warehouse-type }} _dbt_${{ inputs.dbt-version } }_${BRANCH_NAME}"
221+ CONCURRENCY_GROUP="tests_${WAREHOUSE} _dbt_${DBT_VERSION }_${BRANCH_NAME}"
209222 SHORT_HASH=$(echo -n "$CONCURRENCY_GROUP" | sha256sum | head -c 8)
210223 SAFE_BRANCH=$(echo "${BRANCH_NAME}" | awk '{print tolower($0)}' | sed "s/[^a-z0-9]/_/g; s/__*/_/g" | head -c 18)
211224 DATE_STAMP=$(date -u +%y%m%d_%H%M%S)
212225 SCHEMA_NAME="dbt_${DATE_STAMP}_${SAFE_BRANCH}_${SHORT_HASH}"
213226
214227 echo "Schema name: $SCHEMA_NAME (branch='${BRANCH_NAME}', timestamp=${DATE_STAMP}, hash of concurrency group)"
215228
216- python "${{ github.workspace }} /dbt-data-reliability/integration_tests/profiles/generate_profiles.py" \
217- --template "${{ github.workspace }} /dbt-data-reliability/integration_tests/profiles/profiles.yml.j2" \
229+ python "$GITHUB_WORKSPACE /dbt-data-reliability/integration_tests/profiles/generate_profiles.py" \
230+ --template "$GITHUB_WORKSPACE /dbt-data-reliability/integration_tests/profiles/profiles.yml.j2" \
218231 --output ~/.dbt/profiles.yml \
219232 --schema-name "$SCHEMA_NAME"
220233
221234 - name : Install dependencies
222235 working-directory : ${{ env.TESTS_DIR }}
223236 run : |
224- ${{ (inputs.dbt-version == 'fusion' && '~/.local/bin/dbt') || 'dbt' }} deps --project-dir dbt_project
225- ln -sfn ${{ github.workspace }}/dbt-data-reliability dbt_project/dbt_packages/elementary
237+ if [ "$DBT_VERSION" = "fusion" ]; then DBT_BIN="$HOME/.local/bin/dbt"; else DBT_BIN="dbt"; fi
238+ "$DBT_BIN" deps --project-dir dbt_project
239+ ln -sfn "$GITHUB_WORKSPACE/dbt-data-reliability" dbt_project/dbt_packages/elementary
226240 pip install -r requirements.txt
227241
228242 - name : Start Vertica
@@ -240,15 +254,23 @@ jobs:
240254 - name : Check DWH connection
241255 working-directory : ${{ env.TESTS_DIR }}
242256 run : |
243- ${{ (inputs.dbt-version == 'fusion' && '~/.local/bin/dbt') || 'dbt' }} debug -t "${{ inputs.warehouse-type }}"
257+ if [ "$DBT_VERSION" = "fusion" ]; then DBT_BIN="$HOME/.local/bin/dbt"; else DBT_BIN="dbt"; fi
258+ "$DBT_BIN" debug -t "$WAREHOUSE"
244259
245260 - name : Test
246261 working-directory : " ${{ env.TESTS_DIR }}/tests"
247- run : py.test -n${{ (inputs.warehouse-type == 'spark' && '4') || '8' }} -vvv --target "${{ inputs.warehouse-type }}" --junit-xml=test-results.xml --html=detailed_report_${{ inputs.warehouse-type }}_dbt_${{ inputs.dbt-version }}.html --self-contained-html --clear-on-end ${{ (inputs.dbt-version == 'fusion' && '--runner-method fusion') || '' }}
262+ env :
263+ PYTEST_PARALLEL : ${{ (inputs.warehouse-type == 'spark' && '4') || '8' }}
264+ FUSION_RUNNER_FLAG : ${{ (inputs.dbt-version == 'fusion' && '--runner-method fusion') || '' }}
265+ run : |
266+ py.test -n"$PYTEST_PARALLEL" -vvv --target "$WAREHOUSE" \
267+ --junit-xml=test-results.xml \
268+ --html="detailed_report_${WAREHOUSE}_dbt_${DBT_VERSION}.html" \
269+ --self-contained-html --clear-on-end $FUSION_RUNNER_FLAG
248270
249271 - name : Upload test results
250272 if : always()
251- uses : pmeier/pytest-results-action@v0.8.0
273+ uses : pmeier/pytest-results-action@0841ca7226ab155943837380769373a5dd14d7ed # v0.8.0
252274 with :
253275 path : ${{ env.TESTS_DIR }}/tests/test-results.xml
254276 summary : true
@@ -269,6 +291,7 @@ jobs:
269291 working-directory : ${{ env.TESTS_DIR }}
270292 continue-on-error : true
271293 run : |
272- ${{ (inputs.dbt-version == 'fusion' && '~/.local/bin/dbt') || 'dbt' }} run-operation elementary_tests.drop_test_schemas \
294+ if [ "$DBT_VERSION" = "fusion" ]; then DBT_BIN="$HOME/.local/bin/dbt"; else DBT_BIN="dbt"; fi
295+ "$DBT_BIN" run-operation elementary_tests.drop_test_schemas \
273296 --project-dir dbt_project \
274- -t "${{ inputs.warehouse-type }} "
297+ -t "$WAREHOUSE "
0 commit comments