Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,33 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
# Use a fetch-depth of 2 to avoid error `fatal: origin/main...HEAD: no merge base`
# See https://github.com/googleapis/google-cloud-python/issues/12013
# and https://github.com/actions/checkout#checkout-head.
with:
fetch-depth: 2
# Use fetch-depth of 0 (full history) so Git can find the merge-base with the
# target branch and calculate the exact list of modified packages.
fetch-depth: 0
persist-credentials: false
# We must explicitly fetch and set the target branch reference (main, etc.)
# to perform a relative diff (target_branch...HEAD). Comparing against a generic "HEAD~1"
# is fragile and fails if developers merge main back into their PR, if the PR has
# multiple commits, or if running inside a Merge Queue (merge_group) environment.
- name: Set target branch ref
id: target
env:
TARGET_BRANCH: ${{ github.base_ref || github.event.merge_group.base_ref || 'main' }}
run: |
git fetch origin $TARGET_BRANCH
echo "branch=origin/$TARGET_BRANCH" >> "$GITHUB_OUTPUT"
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.10"
- name: Set number of files changes in packages and preview-packages directories
id: packages
env:
TARGET_BRANCH_REF: ${{ steps.target.outputs.branch }}
run: |
git diff HEAD~1 -- packages preview-packages > /dev/null
num_files_changed=$(git diff HEAD~1 -- packages preview-packages | wc -l | tr -d ' ')
git diff "$TARGET_BRANCH_REF"...HEAD -- packages preview-packages > /dev/null
num_files_changed=$(git diff "$TARGET_BRANCH_REF"...HEAD -- packages preview-packages | wc -l | tr -d ' ')
echo "num_files_changed=${num_files_changed}" >> "$GITHUB_OUTPUT"
- name: Install coverage
if: ${{ steps.packages.outputs.num_files_changed > 0 }}
Expand All @@ -91,9 +103,11 @@ jobs:
# TODO: default to 100% coverage after next gapic-generator release
# https://github.com/googleapis/google-cloud-python/issues/17459
DEFAULT_FAIL_UNDER: 99
TARGET_BRANCH_REF: ${{ steps.target.outputs.branch }}
run: |
target_ref="$TARGET_BRANCH_REF"
# Find all modified packages
modified_packages=$(git diff --name-only HEAD~1 -- packages preview-packages | cut -d/ -f1,2 | sort -u)
modified_packages=$(git diff --name-only ${target_ref}...HEAD -- packages preview-packages | cut -d/ -f1,2 | sort -u)

existing_modified_packages=()
for pkg in ${modified_packages}; do
Expand Down Expand Up @@ -122,7 +136,7 @@ jobs:
fi

# Find all modified packages
modified_packages=$(git diff --name-only HEAD~1 -- packages preview-packages | cut -d/ -f1,2 | sort -u)
modified_packages=$(git diff --name-only ${target_ref}...HEAD -- packages preview-packages | cut -d/ -f1,2 | sort -u)

failed_packages=()
passed_packages=()
Expand Down
1 change: 1 addition & 0 deletions packages/bigquery-magics/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ global-exclude __pycache__

# Exclude scripts for samples readmegen
prune scripts/readme-gen

1 change: 1 addition & 0 deletions packages/db-dtypes/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ filterwarnings =
# Remove once https://github.com/googleapis/python-db-dtypes-pandas/issues/227 is fixed
ignore:.*any.*with datetime64 dtypes is deprecated and will raise in a future version:FutureWarning
ignore:.*all.*with datetime64 dtypes is deprecated and will raise in a future version:FutureWarning

Loading