diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0f390bcc7..a12e16a452 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -588,6 +588,55 @@ jobs: RESOURCE_PREFIX: ${{ steps.set-resource-prefix.outputs.prefix }} + Run-Telemetry-Tests: + needs: [Authorize, Check-changed-files] + if: needs.Check-changed-files.outputs.code_changed == 'true' + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + fail-fast: false + matrix: + python-version: ["3.11"] + airflow-version: ["2.10"] + dbt-version: ["1.9"] + env: + SCARF_NO_ANALYTICS: "false" + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + persist-credentials: false + + - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: | + ~/.cache/pip + .local/share/hatch/ + key: telemetry-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('cosmos/__init__.py') }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Install packages and dependencies + run: | + python -m pip install uv + uv pip install --system "hatch>=1.14.2" + hatch -e tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }} run pip freeze + + - name: Run telemetry tests + run: | + hatch run tests.py${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }}:test-telemetry + + - name: Upload coverage to Github + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: coverage-telemetry-test-${{ matrix.python-version }}-${{ matrix.airflow-version }}-${{ matrix.dbt-version }} + path: .coverage + include-hidden-files: true + Run-Performance-Tests: needs: [Authorize, Check-changed-files] if: needs.Check-changed-files.outputs.code_changed == 'true' @@ -744,6 +793,7 @@ jobs: - Run-Integration-Tests - Run-Integration-Tests-Expensive - Run-Kubernetes-Tests + - Run-Telemetry-Tests runs-on: ubuntu-latest permissions: contents: read diff --git a/pyproject.toml b/pyproject.toml index ac67e17358..9ee9dc0be1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -194,6 +194,7 @@ test-integration-dbtf = 'sh scripts/test/integration-dbtf.sh' test-integration-dbt-1-5-4 = 'sh scripts/test/integration-dbt-1-5-4.sh' test-integration-dbt-async = 'sh scripts/test/integration-dbt-async.sh {matrix:dbt}' test-integration-expensive = 'sh scripts/test/integration-expensive.sh' +test-telemetry = 'sh scripts/test/telemetry.sh' test-performance = 'sh scripts/test/performance.sh' test-performance-setup = 'sh scripts/test/performance-setup.sh {matrix:dbt}' diff --git a/scripts/test/integration.sh b/scripts/test/integration.sh index efd6c9ade7..dbe37f8103 100644 --- a/scripts/test/integration.sh +++ b/scripts/test/integration.sh @@ -24,4 +24,5 @@ pytest -vv \ --ignore=tests/test_example_k8s_dags.py \ --ignore=tests/operators/test_watcher_kubernetes_integration.py \ --ignore=dev/dags/cross_project_dbt_ls_dag.py \ + --ignore=tests/test_telemetry.py \ -k 'not (simple_dag_async or example_cosmos_python_models or example_virtualenv or jaffle_shop_kubernetes or jaffle_shop_watcher_kubernetes)' diff --git a/scripts/test/telemetry.sh b/scripts/test/telemetry.sh new file mode 100755 index 0000000000..15ef05d519 --- /dev/null +++ b/scripts/test/telemetry.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -x +set -e + +pytest -vv \ + --cov=cosmos \ + --cov-report=term-missing \ + --cov-report=xml \ + --durations=0 \ + -m integration \ + tests/test_telemetry.py