Skip to content

Commit

Permalink
Hide PR information from GitHub event path
Browse files Browse the repository at this point in the history
Signed-off-by: Wei-Chun, Chang <wcchang@infuseai.io>
  • Loading branch information
wcchang1115 committed Dec 18, 2024
1 parent 4406a2e commit 4e81228
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
66 changes: 35 additions & 31 deletions integration_tests/dbt/smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ cd "$SCRIPT_DIR"
pwd

# Prepare env
# git restore models/customers.sql
# dbt --version
# dbt deps
# dbt seed --target-path target-base
# dbt run --target-path target-base
# dbt docs generate --target-path target-base

# echo "where customer_id > 0" >> models/customers.sql
# dbt run
# dbt docs generate
# git restore models/customers.sql
git restore models/customers.sql
dbt --version
dbt deps
dbt seed --target-path target-base
dbt run --target-path target-base
dbt docs generate --target-path target-base

echo "where customer_id > 0" >> models/customers.sql
dbt run
dbt docs generate
git restore models/customers.sql

# Recce Run
mkdir -p ~/.recce
Expand All @@ -30,20 +30,20 @@ assert_string_value() {
fi
}

# recce run
# if ! [ -e recce_state.json ]; then
# echo "recce_state.json not found"
# exit 1
# fi
recce run
if ! [ -e recce_state.json ]; then
echo "recce_state.json not found"
exit 1
fi

# model=$(cat recce_state.json | jq '.runs[0].result | keys | .[0]' | tr -d '"')
# run_type=$(cat recce_state.json | jq '.runs[0]'.type | tr -d '"')
# assert_string_value $model "customers"
# assert_string_value $run_type "row_count_diff"
model=$(cat recce_state.json | jq '.runs[0].result | keys | .[0]' | tr -d '"')
run_type=$(cat recce_state.json | jq '.runs[0]'.type | tr -d '"')
assert_string_value $model "customers"
assert_string_value $run_type "row_count_diff"

# Recce Summary
# recce summary ./recce_state.json | tee recce_summary.md
# cat ./recce_summary.md | grep -q customers
recce summary ./recce_state.json | tee recce_summary.md
cat ./recce_summary.md | grep -q customers

# Recce Server
function check_server_status() {
Expand All @@ -63,13 +63,13 @@ function check_server_status() {
echo "Server stopped."
}

# echo "Starting the server..."
# recce server &
# check_server_status
echo "Starting the server..."
recce server &
check_server_status

# echo "Starting the server (review mode)..."
# recce server --review recce_state.json &
# check_server_status
echo "Starting the server (review mode)..."
recce server --review recce_state.json &
check_server_status


# Clone jaffle_shop_duckdb
Expand All @@ -81,15 +81,19 @@ GIT_REPO="https://github.com/DataRecce/jaffle_shop_duckdb.git"
GIT_BRANCH="fix/customer-lifetime-value"

git clone --depth 1 --branch $GIT_BRANCH $GIT_REPO
ls -al
cd jaffle_shop_duckdb || exit

echo $GIT_DIR
echo
# Hide PR information from GitHub Action
HOLD_GITHUB_EVENT_PATH="$GITHUB_EVENT_PATH"
unset GITHUB_EVENT_PATH

# Recce Summary - Cloud
recce summary --cloud | tee recce_summary.md
cat ./recce_summary.md | grep -q customers

# Recce Server - Cloud
echo "Starting the server (cloud and review mode)..."
recce server --cloud --review &
check_server_status

export GITHUB_EVENT_PATH="$HOLD_GITHUB_EVENT_PATH"
2 changes: 0 additions & 2 deletions recce/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ def hosting_repo(remote: str = 'origin'):
# Handle https://github.com/user/repo.git or http://github.com/user/repo.git
remote_repo = '/'.join(origin_url.split('/')[-2:]).replace('.git', '')

print('remote', remote_repo)
return remote_repo
except ValueError:
repo = Repo(search_parent_directories=True)
toplevel_dir = repo.git.rev_parse("--show-toplevel")

print('top', toplevel_dir)
return os.path.basename(toplevel_dir)
except InvalidGitRepositoryError:
return None

0 comments on commit 4e81228

Please sign in to comment.