Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
TEST_ALL_PACKAGES: ${{ steps.check-label.outputs.is_full_run }}
run: |
if [ -n "$TARGET_BRANCH" ]; then
git fetch origin "$TARGET_BRANCH" --deepen=200 || true
git fetch --no-tags --quiet origin "$TARGET_BRANCH" --deepen=200 || true
fi
python3 ci/get_package_shards.py

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
PACKAGE_WEIGHTS: ${{ env.PACKAGE_WEIGHTS }}
run: |
if [ -n "$TARGET_BRANCH" ]; then
git fetch origin "$TARGET_BRANCH" --depth=1 || true
git fetch --no-tags --quiet origin "$TARGET_BRANCH" --depth=1 || true
fi
python3 ci/get_package_shards.py

Expand Down
33 changes: 23 additions & 10 deletions ci/run_conditional_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ elif [[ ${BUILD_TYPE} == "presubmit" ]]; then
# common commit in the target branch.
if [ -n "${TARGET_BRANCH}" ]; then
if [[ "${TEST_TYPE}" == "import_profile" ]]; then
git fetch origin "${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}" || true
git fetch --no-tags --quiet origin "${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}" || true
else
git fetch origin "${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}" --depth=200 || true
git fetch --no-tags --quiet origin "${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}" --depth=200 || true
fi
fi
GIT_DIFF_ARG="origin/${TARGET_BRANCH}..."
Expand All @@ -78,21 +78,34 @@ run_test_in_dir() {
local log_file="/tmp/test_log_${PY_VERSION}_${pkg_name_clean}.log"
export COVERAGE_FILE="${PROJECT_ROOT}/.coverage.${PY_VERSION}.${pkg_name_clean}"

echo "============================================================"
echo "Starting tests in ${d}"
echo "============================================================"

pushd ${d} > /dev/null
set +e
${test_script} > "${log_file}" 2>&1
local ret=$?
if [ "${PARALLEL_WORKERS}" = "1" ]; then
# When running with a single worker, stream output in real-time while capturing to log file
${test_script} 2>&1 | tee "${log_file}"
local ret=${PIPESTATUS[0]}
else
# When running multiple workers in parallel, buffer output to prevent interleaved log lines
${test_script} > "${log_file}" 2>&1
local ret=$?
echo "============================================================"
echo "Finished tests in ${d} (exit code: ${ret})"
echo "============================================================"
cat "${log_file}"
fi
set -e
popd > /dev/null

echo "============================================================"
echo "Running tests in ${d}"
echo "============================================================"
cat "${log_file}"
rm -f "${log_file}"

if [ ${ret} -ne 0 ]; then
exit ${ret}
echo "❌ Tests failed in ${d} with exit code ${ret}"
exit 255 # Cancel xargs parallel jobs
else
echo "✅ Tests passed in ${d}"
fi
}
export -f run_test_in_dir
Expand Down
14 changes: 7 additions & 7 deletions ci/run_single_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,28 @@ case ${TEST_TYPE} in
unit)
case ${PY_VERSION} in
"3.10")
nox -s unit-3.10
nox --stop-on-first-error -s unit-3.10
retval=$?
;;
"3.11")
nox -s unit-3.11
nox --stop-on-first-error -s unit-3.11
retval=$?
;;
"3.12")
nox -s unit-3.12
nox --stop-on-first-error -s unit-3.12
retval=$?
;;
"3.13")
nox -s unit-3.13
nox --stop-on-first-error -s unit-3.13
retval=$?
;;
"3.14")
nox -s unit-3.14
nox --stop-on-first-error -s unit-3.14
retval=$?
;;
"3.15")
# This is needed to speed up builds
nox --force-venv-backend uv -s unit-3.15
nox --stop-on-first-error --force-venv-backend uv -s unit-3.15
retval=$?
;;
*)
Expand Down Expand Up @@ -212,7 +212,7 @@ case ${TEST_TYPE} in
fi
;;
*)
nox -s ${TEST_TYPE}
nox --stop-on-first-error -s ${TEST_TYPE}
retval=$?
;;
esac
Expand Down
Loading