From 1ea66b3783c7ad5e209da4e14fafc2b404c5d840 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 08:35:00 +0000 Subject: [PATCH 1/8] Modernize test-github-action.yml to use e2e_dbt_project - Replace deprecated dbt-data-reliability integration tests with the newer e2e_dbt_project (matching test-warehouse.yml approach) - Use generate_profiles.py + profiles.yml.j2 instead of the TEST_GITHUB_ACTION_PROFILES_YML secret - Update run-elementary-action from v1.8 to v1.12 - Add concurrency management and schema cleanup - Add generate-data workflow input - Temporarily add pull_request trigger for CI testing Co-Authored-By: Itamar Hartstein --- .github/workflows/test-github-action.yml | 114 +++++++++++++++++++---- 1 file changed, 95 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-github-action.yml b/.github/workflows/test-github-action.yml index 8fe162d3e..42915170a 100644 --- a/.github/workflows/test-github-action.yml +++ b/.github/workflows/test-github-action.yml @@ -1,5 +1,6 @@ name: Test elementary GitHub action on: + pull_request: schedule: - cron: "0 0 * * *" workflow_dispatch: @@ -16,9 +17,16 @@ on: type: string required: false description: dbt's version to test with + generate-data: + type: boolean + required: false + default: false + description: Whether to generate new data env: - DBT_PKG_INTEG_TESTS_DIR: ${{ github.workspace }}/dbt-data-reliability/integration_tests/deprecated_tests + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + ELEMENTARY_DBT_PACKAGE_PATH: ${{ github.workspace }}/dbt-data-reliability + E2E_DBT_PROJECT_DIR: ${{ github.workspace }}/elementary/tests/e2e_dbt_project jobs: test: @@ -26,6 +34,9 @@ jobs: defaults: run: working-directory: elementary + concurrency: + group: test_action_snowflake_dbt_${{ inputs.dbt-version }}_${{ github.head_ref || github.ref_name }} + cancel-in-progress: true steps: - name: Checkout Elementary uses: actions/checkout@v4 @@ -40,29 +51,39 @@ jobs: path: dbt-data-reliability ref: ${{ inputs.dbt-data-reliability-ref }} - - name: Write dbt profiles - id: profiles - env: - PROFILES_YML: ${{ secrets.TEST_GITHUB_ACTION_PROFILES_YML }} - run: | - mkdir -p ~/.dbt - echo "$PROFILES_YML" > ~/.dbt/profiles.yml - - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dbt - run: pip install --pre + run: > + pip install "dbt-core${{ inputs.dbt-version && format('=={0}', inputs.dbt-version) }}" - "dbt-snowflake${{ inputs.dbt-version && format('<={0}', inputs.dbt-version) }}" + "dbt-snowflake${{ inputs.dbt-version && format('~={0}', inputs.dbt-version) }}" - name: Install Elementary run: | pip install -r dev-requirements.txt pip install ".[snowflake]" + - name: Write dbt profiles + env: + CI_WAREHOUSE_SECRETS: ${{ secrets.CI_WAREHOUSE_SECRETS || '' }} + run: | + CONCURRENCY_GROUP="test_action_snowflake_dbt_${{ inputs.dbt-version }}_${BRANCH_NAME}" + SHORT_HASH=$(echo -n "$CONCURRENCY_GROUP" | sha256sum | head -c 8) + SAFE_BRANCH=$(echo "${BRANCH_NAME}" | awk '{print tolower($0)}' | sed "s/[^a-z0-9]/_/g; s/__*/_/g" | head -c 19) + DATE_STAMP=$(date -u +%y%m%d_%H%M%S) + SCHEMA_NAME="ga_${DATE_STAMP}_${SAFE_BRANCH}_${SHORT_HASH}" + + echo "Schema name: $SCHEMA_NAME (branch='${BRANCH_NAME}', timestamp=${DATE_STAMP}, hash of concurrency group)" + + python "${{ github.workspace }}/elementary/tests/profiles/generate_profiles.py" \ + --template "${{ github.workspace }}/elementary/tests/profiles/profiles.yml.j2" \ + --output ~/.dbt/profiles.yml \ + --schema-name "$SCHEMA_NAME" + - name: Install dbt package run: | ELEMENTARY_PKG_LOCATION=$(pip show elementary-data | grep -i location | awk '{print $2}') @@ -72,21 +93,69 @@ jobs: rm -rf "$DBT_PKGS_PATH/elementary" ln -vs "$GITHUB_WORKSPACE/dbt-data-reliability" "$DBT_PKGS_PATH/elementary" - - name: Run dbt package integration tests - working-directory: ${{ env.DBT_PKG_INTEG_TESTS_DIR }} + - name: Run deps for E2E dbt project + working-directory: ${{ env.E2E_DBT_PROJECT_DIR }} + env: + ELEMENTARY_DBT_PACKAGE_PATH: ${{ env.ELEMENTARY_DBT_PACKAGE_PATH }} run: | dbt deps - python run_e2e_tests.py -t "snowflake" --clear-tests "True" -e "regular" + + - name: Seed e2e dbt project + working-directory: ${{ env.E2E_DBT_PROJECT_DIR }} + if: inputs.generate-data + run: | + python generate_data.py + dbt seed -f --target snowflake + + - name: Run e2e dbt project + working-directory: ${{ env.E2E_DBT_PROJECT_DIR }} + run: | + dbt run --target snowflake || true + + # Validate run_results.json: only error_model should be non-success + jq -e ' + [.results[] | select(.status != "success") | .unique_id] + | length == 1 and .[0] == "model.elementary_integration_tests.error_model" + ' target/run_results.json > /dev/null + jq_exit=$? + + if [ $jq_exit -eq 0 ]; then + echo "Validation passed: only error_model failed." + else + echo "Validation failed. Unexpected failures:" + jq '[.results[] | select(.status != "success") | .unique_id] | join(", ")' target/run_results.json + fi + + exit $jq_exit + + - name: Test e2e dbt project + working-directory: ${{ env.E2E_DBT_PROJECT_DIR }} + continue-on-error: true + run: | + dbt test --target snowflake + + - name: Read generated profiles + id: profiles + run: | + { + echo "profiles_yml<> "$GITHUB_OUTPUT" - name: Run Elementary - uses: elementary-data/run-elementary-action@v1.8 + uses: elementary-data/run-elementary-action@v1.12 with: warehouse-type: snowflake - profiles-yml: ${{ secrets.TEST_GITHUB_ACTION_PROFILES_YML }} - edr-command: - edr monitor -t "snowflake" --slack-token "${{ secrets.CI_SLACK_TOKEN }}" --slack-channel-name data-ops + profile-target: snowflake + profiles-yml: ${{ steps.profiles.outputs.profiles_yml }} + edr-command: > + edr monitor + -t snowflake + --slack-token "${{ secrets.CI_SLACK_TOKEN }}" + --slack-channel-name data-ops && - edr report + edr monitor report --file-path "report.html" - name: Upload report @@ -102,6 +171,13 @@ jobs: name: edr.log path: edr_target/edr.log + - name: Drop test schemas + if: always() + working-directory: ${{ env.E2E_DBT_PROJECT_DIR }} + continue-on-error: true + run: | + dbt run-operation elementary_integration_tests.drop_test_schemas --target snowflake + notify_failures: name: Notify Slack needs: test From eb9e013992d46a62590528fe96bba0210d2b282c Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 08:41:55 +0000 Subject: [PATCH 2/8] Add masking for profiles.yml credentials in GITHUB_OUTPUT Co-Authored-By: Itamar Hartstein --- .github/workflows/test-github-action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test-github-action.yml b/.github/workflows/test-github-action.yml index 42915170a..feaa9531a 100644 --- a/.github/workflows/test-github-action.yml +++ b/.github/workflows/test-github-action.yml @@ -137,6 +137,10 @@ jobs: - name: Read generated profiles id: profiles run: | + # Mask credentials so they don't appear in logs + while IFS= read -r line; do + echo "::add-mask::$line" + done < ~/.dbt/profiles.yml { echo "profiles_yml< Date: Sun, 1 Mar 2026 08:46:34 +0000 Subject: [PATCH 3/8] Fix jq validation to work correctly under bash -e Co-Authored-By: Itamar Hartstein --- .github/workflows/test-github-action.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-github-action.yml b/.github/workflows/test-github-action.yml index feaa9531a..3e552a9a7 100644 --- a/.github/workflows/test-github-action.yml +++ b/.github/workflows/test-github-action.yml @@ -113,21 +113,17 @@ jobs: dbt run --target snowflake || true # Validate run_results.json: only error_model should be non-success - jq -e ' + if jq -e ' [.results[] | select(.status != "success") | .unique_id] | length == 1 and .[0] == "model.elementary_integration_tests.error_model" - ' target/run_results.json > /dev/null - jq_exit=$? - - if [ $jq_exit -eq 0 ]; then + ' target/run_results.json > /dev/null; then echo "Validation passed: only error_model failed." else echo "Validation failed. Unexpected failures:" jq '[.results[] | select(.status != "success") | .unique_id] | join(", ")' target/run_results.json + exit 1 fi - exit $jq_exit - - name: Test e2e dbt project working-directory: ${{ env.E2E_DBT_PROJECT_DIR }} continue-on-error: true From 27d1b3b313a009b28ad0190172ec26aa99ebb388 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 09:03:48 +0000 Subject: [PATCH 4/8] Temporarily point action at Python 3.10 fix branch The run-elementary-action Docker image uses Python 3.9, but elementary-data 0.22.0 dropped Python 3.9 support. Point at the fix branch (devin/1772355616-fix-python-version) which updates the Dockerfile to Python 3.10. This should be updated to the new release tag once elementary-data/run-elementary-action#15 is merged and tagged. Co-Authored-By: Itamar Hartstein --- .github/workflows/test-github-action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-github-action.yml b/.github/workflows/test-github-action.yml index 3e552a9a7..124cf1f1c 100644 --- a/.github/workflows/test-github-action.yml +++ b/.github/workflows/test-github-action.yml @@ -144,7 +144,7 @@ jobs: } >> "$GITHUB_OUTPUT" - name: Run Elementary - uses: elementary-data/run-elementary-action@v1.12 + uses: elementary-data/run-elementary-action@devin/1772355616-fix-python-version with: warehouse-type: snowflake profile-target: snowflake From 3e38a971fd2441e91e65be4dd2409f23e89eaf26 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 09:09:28 +0000 Subject: [PATCH 5/8] Update run-elementary-action to v1.13 (with Python 3.10 fix) Replace temporary branch reference with the official v1.13 release tag which includes the Python 3.10 Dockerfile fix. Co-Authored-By: Itamar Hartstein --- .github/workflows/test-github-action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-github-action.yml b/.github/workflows/test-github-action.yml index 124cf1f1c..ec0fc55c5 100644 --- a/.github/workflows/test-github-action.yml +++ b/.github/workflows/test-github-action.yml @@ -144,7 +144,7 @@ jobs: } >> "$GITHUB_OUTPUT" - name: Run Elementary - uses: elementary-data/run-elementary-action@devin/1772355616-fix-python-version + uses: elementary-data/run-elementary-action@v1.13 with: warehouse-type: snowflake profile-target: snowflake From aa4030b569069774dfd7773090ddf212fcdc93de Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 09:24:25 +0000 Subject: [PATCH 6/8] Add -t snowflake to edr monitor report command Co-Authored-By: Itamar Hartstein --- .github/workflows/test-github-action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-github-action.yml b/.github/workflows/test-github-action.yml index ec0fc55c5..d3c904351 100644 --- a/.github/workflows/test-github-action.yml +++ b/.github/workflows/test-github-action.yml @@ -156,6 +156,7 @@ jobs: --slack-channel-name data-ops && edr monitor report + -t snowflake --file-path "report.html" - name: Upload report From e8570d401f2c552382fb4055c19ce87788dba19b Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 09:56:52 +0000 Subject: [PATCH 7/8] Remove temporary pull_request trigger Co-Authored-By: Itamar Hartstein --- .github/workflows/test-github-action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-github-action.yml b/.github/workflows/test-github-action.yml index d3c904351..7a7a9fac8 100644 --- a/.github/workflows/test-github-action.yml +++ b/.github/workflows/test-github-action.yml @@ -1,6 +1,5 @@ name: Test elementary GitHub action on: - pull_request: schedule: - cron: "0 0 * * *" workflow_dispatch: From deaf6ae4decf4cb9d4c69e470f1010fc77e9181b Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 1 Mar 2026 10:05:19 +0000 Subject: [PATCH 8/8] Remove Notify Slack job Co-Authored-By: Itamar Hartstein --- .github/workflows/test-github-action.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/test-github-action.yml b/.github/workflows/test-github-action.yml index 7a7a9fac8..172c9572e 100644 --- a/.github/workflows/test-github-action.yml +++ b/.github/workflows/test-github-action.yml @@ -177,18 +177,3 @@ jobs: continue-on-error: true run: | dbt run-operation elementary_integration_tests.drop_test_schemas --target snowflake - - notify_failures: - name: Notify Slack - needs: test - if: | - always() && - ! cancelled() && - ! contains(needs.test.result, 'success') && - ! contains(needs.test.result, 'cancelled') && - ${{ github.event_name == 'schedule' }} - uses: ./.github/workflows/notify_slack.yml - with: - result: "failure" - run_id: ${{ github.run_id }} - workflow_name: "Test Elementary GitHub action"