Skip to content

Commit

Permalink
Add package test for dbt-metricflow
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed Jan 29, 2025
1 parent 910aafb commit 95369de
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-metricflow-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,5 @@ jobs:
}
- name: Run Package-Build Tests
shell: bash
run: "make test-build-packages"
21 changes: 21 additions & 0 deletions scripts/ci_tests/dbt_metricflow_package_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import annotations

import subprocess
from pathlib import Path

if __name__ == "__main__":
# Check that the `mf` command is installed.
print(f"Running from {Path.cwd().as_posix()}")
print("Checking path to python")
subprocess.check_call("which python", shell=True)
subprocess.check_call("mf", shell=True)
# Run the tutorial using `--yes` to create the sample project without user interaction.
subprocess.check_call("mf tutorial --yes", shell=True)
tutorial_directory = Path.cwd().joinpath("mf_tutorial_project").as_posix()

# Run the first few tutorial steps.
subprocess.check_call("dbt seed", cwd=tutorial_directory, shell=True)
subprocess.check_call("dbt build", cwd=tutorial_directory, shell=True)
subprocess.check_call(
"mf query --metrics transactions --group-by metric_time --order metric_time", cwd=tutorial_directory, shell=True
)
9 changes: 7 additions & 2 deletions scripts/ci_tests/run_package_build_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,15 @@ class PackageBuildTestFailureException(Exception): # noqa: D101
package_test_script=metricflow_repo_directory.joinpath("scripts/ci_tests/metricflow_package_test.py"),
)

# Test building `metricflow-semantics` package.
# Test building the `metricflow-semantics` package.
_run_package_build_test(
package_directory=metricflow_repo_directory.joinpath("metricflow-semantics"),
package_test_script=metricflow_repo_directory.joinpath("scripts/ci_tests/metricflow_semantics_package_test.py"),
)

# Add entry for `dbt-metricflow` once build issues are resolved.
# Test building the `dbt-metricflow` package.
_run_package_build_test(
package_directory=metricflow_repo_directory.joinpath("dbt-metricflow"),
package_test_script=metricflow_repo_directory.joinpath("scripts/ci_tests/dbt_metricflow_package_test.py"),
optional_package_dependencies_to_install=("dbt-duckdb",),
)

0 comments on commit 95369de

Please sign in to comment.