Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/actions/check-shard-status/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ runs:
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
per_page: 100,
});
const nodeVersion = '${{ inputs.node-version }}';
const shardJobs = jobs.filter(j => j.name.includes(`units (Node ${nodeVersion},`));
Expand Down
6 changes: 2 additions & 4 deletions .github/actions/run-unit-tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ runs:
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
key: ${{ runner.os }}-turbo-shard-${{ inputs.shard-index }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-shard-${{ inputs.shard-index }}-
${{ runner.os }}-turbo-
- name: Compile Workspace (Turborepo Caching)
run: pnpm run compile || pnpm run compile
shell: bash
- run: node --version
shell: bash
- name: Run unit tests
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/presubmit-bun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ jobs:
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
key: ${{ runner.os }}-turbo-shard-${{ matrix.shard-index }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-shard-${{ matrix.shard-index }}-
${{ runner.os }}-turbo-
- name: Compile Workspace (Turborepo Caching)
run: pnpm run compile
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: ${{ matrix.bun-version }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ jobs:
restore-keys: |
${{ runner.os }}-turbo-
- name: Compile Workspace (Turborepo Caching)
run: pnpm run compile
run: |
# Skip pnpm run compile in the lint job when no .ts files changed
if [ -n "$(git diff --name-only --diff-filter=ACMRT HEAD^1...HEAD -- '*.ts')" ]; then
Comment thread
quirogas marked this conversation as resolved.
pnpm run compile
else
echo "No TypeScript files changed in HEAD^1...HEAD; skipping workspace compile for linter."
fi
- run: node ./bin/linter.mjs --strict
name: Run monorepo linter
env:
Expand Down
35 changes: 29 additions & 6 deletions ci/run_conditional_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ windows_exempt_tests="core/ core/packages/ core/dev-packages/ .github/scripts/fi
# Gather all test directories into an array
test_dirs=()

for subdir in ${subdirs[@]}; do
for d in `ls -d ${subdir}/*/`; do
for subdir in "${subdirs[@]}"; do
for d in "${subdir}"/*/; do
[[ -d "$d" ]] || continue
if [ -s "ignore.json" ] && jq -e ".ignored[] | select(. == \"$d\")" ignore.json > /dev/null 2>&1; then
echo "Skipping ${d} (explicitly ignored in ignore.json)"
continue
Expand Down Expand Up @@ -191,10 +192,10 @@ for subdir in ${subdirs[@]}; do
fi

# Our CI uses Git Bash on Windows to execute this script, which returns "msys" or "cygwin" for OSTYPE.
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OS" == "Windows_NT" ]]; then
if [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "cygwin"* || "$OS" == "Windows_NT" ]]; then
is_exempt=false
for exempt in ${windows_exempt_tests}; do
if [[ "${d}" == "${exempt}" || "${d}" == "${exempt}/"* ]]; then
if [[ "${d}" == "${exempt}" || "${d}" == "${exempt%/}/"* ]]; then
is_exempt=true
break
fi
Expand Down Expand Up @@ -305,15 +306,37 @@ if [[ "${RUN_TESTS_MODE}" == "CALCULATE_SHARD_MATRIX" ]]; then
fi

# If SHARD_TOTAL and SHARD_INDEX are provided, we will only run a subset of the tests.
shard_dirs=()
for i in "${!test_dirs[@]}"; do
d="${test_dirs[$i]}"

if [[ -n "${SHARD_TOTAL}" && -n "${SHARD_INDEX}" ]]; then
if (( SHARD_TOTAL > 0 && i % SHARD_TOTAL != SHARD_INDEX )); then
continue
fi
fi
shard_dirs+=("${test_dirs[$i]}")
done

# Batch-compile only the packages assigned to this shard (plus their upstream
# workspace dependencies via `^compile` in `turbo.json`) before running the test loop.
if (( ${#shard_dirs[@]} > 0 )); then
if [ ! -d "${PROJECT_ROOT}/node_modules/.pnpm" ]; then
echo "Installing workspace dependencies at ${PROJECT_ROOT}..."
pnpm --dir "${PROJECT_ROOT}" install --frozen-lockfile --ignore-scripts
fi

turbo_filters=()
for d in "${shard_dirs[@]}"; do
turbo_filters+=("--filter={./${d%/}}")
done
Comment thread
quirogas marked this conversation as resolved.
echo "Compiling ${#shard_dirs[@]} package(s) assigned to this shard..."
run_turbo() {
pnpm --dir "${PROJECT_ROOT}" exec turbo run compile "${turbo_filters[@]}" "$@"
}
# Run turbo with fallback concurrency
run_turbo --concurrency=4 || run_turbo --concurrency=2
fi

for d in "${shard_dirs[@]}"; do
echo "running test in ${d}"
pushd "${d}" >/dev/null
# Temporarily allow failure.
Expand Down
Loading