Skip to content

Commit fd86912

Browse files
committed
fix(ci): shard import-profiler workflow and set threshold to 120s
1 parent edc0423 commit fd86912

2 files changed

Lines changed: 48 additions & 6 deletions

File tree

.github/workflows/import-profiler.yml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ jobs:
1616
import-profile:
1717
runs-on: ubuntu-latest
1818
timeout-minutes: 60
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
shard: [0, 1, 2, 3, 4, 5, 6, 7] # 8 parallel shards
23+
name: import-profile (Shard ${{ matrix.shard }})
1924
steps:
2025
- name: Checkout
2126
uses: actions/checkout@v6
2227
with:
23-
fetch-depth: 2
28+
fetch-depth: 0 # Fetch git history to find changed packages
2429
- name: Setup Python
2530
uses: actions/setup-python@v6
2631
with:
@@ -34,5 +39,44 @@ jobs:
3439
PY_VERSION: "3.15"
3540
# Workaround: Allows libcst to compile on Python 3.15+ while PyO3 catches up
3641
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
42+
SHARD_INDEX: ${{ matrix.shard }}
43+
TOTAL_SHARDS: 8
3744
run: |
38-
ci/run_conditional_tests.sh
45+
TARGET_BRANCH=${TARGET_BRANCH:-main}
46+
git fetch origin "${TARGET_BRANCH}" --deepen=200 || true
47+
48+
# Get unique list of modified packages under packages/
49+
modified_packages=$(git diff --name-only origin/"${TARGET_BRANCH}"... | grep '^packages/' | cut -d/ -f1,2 | sort -u)
50+
51+
# Filter packages assigned to this specific shard index
52+
idx=0
53+
packages_to_test=""
54+
for pkg in $modified_packages; do
55+
if [ -d "$pkg" ]; then
56+
if [ $((idx % TOTAL_SHARDS)) -eq SHARD_INDEX ]; then
57+
packages_to_test="$packages_to_test $pkg"
58+
fi
59+
idx=$((idx + 1))
60+
fi
61+
done
62+
63+
# Run tests on the assigned packages
64+
if [ -n "$packages_to_test" ]; then
65+
echo "Shard ${{ matrix.shard }} running packages: $packages_to_test"
66+
PACKAGE_LIST="$packages_to_test" ci/run_conditional_tests.sh
67+
else
68+
echo "No packages assigned to Shard ${{ matrix.shard }}."
69+
fi
70+
71+
all-import-profiles:
72+
needs: import-profile
73+
if: always()
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Check import profile results
77+
run: |
78+
if [[ "${{ needs.import-profile.result }}" != "success" && "${{ needs.import-profile.result }}" != "skipped" ]]; then
79+
echo "Import profiles failed"
80+
exit 1
81+
fi
82+
echo "All import profiles passed or were skipped"

ci/run_single_test.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,11 @@ case ${TEST_TYPE} in
135135
echo "Could not find baseline commit for ${TARGET_BRANCH:-main}. Skipping baseline generation."
136136
fi
137137
fi
138-
139138
pip install -e .
140-
141139
if [ -f "${BASELINE_CSV}" ]; then
142-
python ${PROFILER_SCRIPT} --package ${PACKAGE_NAME} --iterations 11 --fail-threshold 5000 --diff-baseline "${BASELINE_CSV}" --diff-threshold 100
140+
python "${PROFILER_SCRIPT}" --package "${PACKAGE_NAME}" --iterations 11 --fail-threshold 120000 --diff-baseline "${BASELINE_CSV}" --diff-threshold 100
143141
else
144-
python ${PROFILER_SCRIPT} --package ${PACKAGE_NAME} --iterations 11 --fail-threshold 5000
142+
python "${PROFILER_SCRIPT}" --package "${PACKAGE_NAME}" --iterations 11 --fail-threshold 120000
145143
fi
146144
retval=$?
147145
deactivate

0 commit comments

Comments
 (0)