Skip to content

Commit c2092f1

Browse files
perf(workflow): parallelize schools-out + fe-next-app dependency installs
after_create cloned both repos then ran bundle install and the JS install serially, so every workspace paid both setup costs back to back. Clones stay serial (schools-out clones into the workspace root, so a concurrent fe-next-app clone could leave the root non-empty and fail), but the two independent dependency installs (Ruby vs JS) now run in parallel. Both background jobs are reaped before exit so a single failure never leaves the other install writing a half-built workspace. Also pin --branch dev on the prose's on-demand clones (every SchoolsOut repo has a dev branch) instead of clone-default-then-checkout, so the agent never lands on the wrong branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 131a0d7 commit c2092f1

1 file changed

Lines changed: 38 additions & 15 deletions

File tree

elixir/WORKFLOW.schools-out.md

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,45 @@ hooks:
2626
after_create: |
2727
set -eu
2828
29+
# Clones stay serial: schools-out clones into the workspace root, so cloning
30+
# fe-next-app concurrently could leave the root non-empty and fail that clone.
31+
# They are cheap (--depth 1). The two dependency installs are independent
32+
# (Ruby vs JS) and are the slow part, so they run in parallel; we wait on both
33+
# and abort if either fails, so a broken setup never yields a half-built tree.
2934
git clone --depth 1 --branch dev https://github.com/schoolsoutapp/schools-out .
3035
git clone --depth 1 --branch dev https://github.com/schoolsoutapp/fe-next-app fe-next-app
3136
32-
if [ -f Gemfile ]; then
33-
bundle config set --local path vendor/bundle
34-
bundle install --no-color
35-
fi
36-
37-
if [ -f fe-next-app/package.json ]; then
38-
cd fe-next-app
39-
if [ -f pnpm-lock.yaml ] && command -v pnpm >/dev/null 2>&1; then
40-
pnpm install --frozen-lockfile
41-
elif [ -f package-lock.json ]; then
42-
npm ci --no-audit --no-fund
43-
else
44-
npm install --no-audit --no-fund
37+
(
38+
if [ -f Gemfile ]; then
39+
bundle config set --local path vendor/bundle
40+
bundle install --no-color
41+
fi
42+
) &
43+
backend_deps_pid=$!
44+
45+
(
46+
if [ -f fe-next-app/package.json ]; then
47+
cd fe-next-app
48+
if [ -f pnpm-lock.yaml ] && command -v pnpm >/dev/null 2>&1; then
49+
pnpm install --frozen-lockfile
50+
elif [ -f package-lock.json ]; then
51+
npm ci --no-audit --no-fund
52+
else
53+
npm install --no-audit --no-fund
54+
fi
4555
fi
56+
) &
57+
frontend_deps_pid=$!
58+
59+
# Reap both jobs before deciding: the `|| rc=$?` keeps set -e from aborting on
60+
# the first failure, so we never exit while the other install is still writing.
61+
backend_deps_rc=0
62+
frontend_deps_rc=0
63+
wait "$backend_deps_pid" || backend_deps_rc=$?
64+
wait "$frontend_deps_pid" || frontend_deps_rc=$?
65+
if [ "$backend_deps_rc" -ne 0 ] || [ "$frontend_deps_rc" -ne 0 ]; then
66+
echo "dependency install failed (backend=$backend_deps_rc frontend=$frontend_deps_rc)" >&2
67+
exit 1
4668
fi
4769
before_run: |
4870
set -eu
@@ -91,8 +113,9 @@ The workspace starts with `schools-out` (Rails backend, at the root) and
91113
`schools-out` is the shared backend for every product. Decide which product
92114
this ticket belongs to from its title, description, and labels, then make sure
93115
that product's repositories are present before you start. Clone any that are
94-
missing with `git clone --depth 1 https://github.com/schoolsoutapp/<repo> <dir>`
95-
(git authentication is already configured) and check out `dev`.
116+
missing with `git clone --depth 1 --branch dev https://github.com/schoolsoutapp/<repo> <dir>`
117+
(git authentication is already configured); every SchoolsOut repo uses `dev` as
118+
its integration branch.
96119

97120
Product to repository map:
98121

0 commit comments

Comments
 (0)