-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a CI test for the
dbt-metricflow
package (#1653)
This PR adds a test in CI that checks if the `dbt-metricflow` package builds properly. The check is accomplished by running the tutorial and then running the sample query.
- Loading branch information
Showing
3 changed files
with
89 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,4 +93,5 @@ jobs: | |
} | ||
- name: Run Package-Build Tests | ||
shell: bash | ||
run: "make test-build-packages" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from __future__ import annotations | ||
|
||
import subprocess | ||
import textwrap | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
|
||
def _run_shell_command(command: str, cwd: Optional[Path] = None) -> None: | ||
if cwd is None: | ||
cwd = Path.cwd() | ||
|
||
print( | ||
textwrap.dedent( | ||
f"""\ | ||
Running via shell: | ||
command: {command!r} | ||
cwd: {cwd.as_posix()!r} | ||
""" | ||
).rstrip() | ||
) | ||
subprocess.check_call(command, shell=True, cwd=cwd.as_posix()) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Check that the `mf` command is installed. | ||
_run_shell_command("which python") | ||
_run_shell_command("which mf") | ||
_run_shell_command("mf") | ||
# Run the tutorial using `--yes` to create the sample project without user interaction. | ||
_run_shell_command("mf tutorial --yes") | ||
tutorial_directory = Path.cwd().joinpath("mf_tutorial_project") | ||
|
||
# Run the first few tutorial steps. | ||
_run_shell_command("dbt seed", cwd=tutorial_directory) | ||
_run_shell_command("dbt build", cwd=tutorial_directory) | ||
_run_shell_command( | ||
"mf query --metrics transactions --group-by metric_time --order metric_time", | ||
cwd=tutorial_directory, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters