Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

build(checks): run ci-checks side by side and the Swift tests in parallel

raymondchinsb4f5957384e9
diff --git a/Makefile b/Makefile
index fee2678..84082ee 100644
--- a/Makefile
+++ b/Makefile
@@ -380,7 +380,7 @@ APP_TESTS := app/Tests
app-tests:
@if [ ! -d $(APP_TESTS) ]; then $(call SKIP,app-tests,$(APP_TESTS)); exit 0; fi; \
- touch app/Package.swift; cd app && swift test --no-parallel
+ touch app/Package.swift; cd app && swift test
PANEL_TESTS := dylib/tests/panel-behavior
@@ -889,7 +889,7 @@ native-shim-tests:
@if [ ! -f native-shim/tests/run.sh ]; then $(call SKIP,native-shim-tests,native-shim/tests/run.sh); exit 0; fi; \
sh native-shim/tests/run.sh
-# Every check .github/workflows/app.yml runs, in its order, after `make app`.
+# Every check .github/workflows/app.yml runs, after `make app`.
# scripts/build-local.sh --checks runs this same target, so a local release build
# and CI gate on one list. Each check runs even when an earlier one failed.
# overlay-shim-tests is left out: it needs a Metal GPU and real frame timing.
@@ -910,11 +910,33 @@ ci-checks-built:
@$(MAKE) -s ci-checks CI_CHECKS="$(CI_CHECKS_BUILT)"
ci-checks-source:
@$(MAKE) -s ci-checks CI_CHECKS="$(CI_CHECKS_SOURCE)"
+# The checks run side by side, CHECK_JOBS at a time (CHECK_JOBS=1 runs them one by one).
+# Each one's output goes to $(CHECK_LOGS)/<check>.log and is printed whole, in list order,
+# once all have finished. The slowest start first.
+CHECK_JOBS ?= $(shell sysctl -n hw.ncpu 2>/dev/null || echo 4)
+CHECK_LOGS := $(OUT_DIR)/check-logs
+CI_CHECKS_FIRST := app-tests dualsense-check panel-behavior launchercheck gamefixescheck
+CI_CHECKS_ORDERED := $(filter $(CI_CHECKS_FIRST),$(CI_CHECKS)) $(filter-out $(CI_CHECKS_FIRST),$(CI_CHECKS))
+
ci-checks:
- @failed=""; \
+ @rm -rf $(CHECK_LOGS) && mkdir -p $(CHECK_LOGS); \
+ echo "==> ci-checks: $(words $(CI_CHECKS)) checks, $(CHECK_JOBS) at a time"; \
+ $(MAKE) -s -j$(CHECK_JOBS) $(addprefix ci-run/,$(CI_CHECKS_ORDERED)); \
+ failed=""; \
for t in $(CI_CHECKS); do \
- echo "==> [check] make -s $$t"; \
- $(MAKE) -s $$t || failed="$$failed $$t"; \
+ rc=1; secs=?; \
+ if [ -f $(CHECK_LOGS)/$$t.rc ]; then read -r rc secs <$(CHECK_LOGS)/$$t.rc; fi; \
+ echo "==> [check] make -s $$t ($${secs}s)"; \
+ cat $(CHECK_LOGS)/$$t.log 2>/dev/null; \
+ if [ "$$rc" != 0 ]; then echo "==> [check] $$t failed with exit $$rc"; failed="$$failed $$t"; fi; \
done; \
if [ -n "$$failed" ]; then echo "==> ci-checks failed:$$failed" >&2; exit 1; fi; \
echo "==> ci-checks: all $(words $(CI_CHECKS)) checks passed"
+
+# One check for ci-checks: always succeeds, leaving the exit status and seconds in <check>.rc
+ci-run/%:
+ @start=$$(date +%s); rc=0; \
+ $(MAKE) -s $* >$(CHECK_LOGS)/$*.log 2>&1 </dev/null || rc=$$?; \
+ secs=$$(($$(date +%s) - start)); \
+ echo "$$rc $$secs" >$(CHECK_LOGS)/$*.rc; \
+ if [ $$rc -eq 0 ]; then echo "--> $* passed in $${secs}s"; else echo "--> $* FAILED in $${secs}s"; fi
diff --git a/docs/BUILD-LOCAL.md b/docs/BUILD-LOCAL.md
index c753e7b..360c9a4 100644
--- a/docs/BUILD-LOCAL.md
+++ b/docs/BUILD-LOCAL.md
@@ -49,8 +49,8 @@ At the end the script prints the version (from `dylib/version.h`: `make app` wri
| bridge | 14m00s | 13s |
| app-payload | 0s | 0s |
| app | 42s | 13s |
-| checks (`--checks`) | about 3m20s | 3m20s |
-| total | about 15m, about 18m with checks | 27s, 3m47s with checks |
+| checks (`--checks`, side by side) | about 1m05s | 55s |
+| total | about 15m, about 16m with checks | 27s, 1m22s with checks |
A `fonts` phase (the Proton font build, needs fontforge and the font tools) also runs; it is
not in the table because it was added after these timings.
diff --git a/scripts/build-local.sh b/scripts/build-local.sh
index 1c3b220..2fb7061 100755
--- a/scripts/build-local.sh
+++ b/scripts/build-local.sh
@@ -268,9 +268,9 @@ if [ "$run_checks" -eq 1 ]; then
: >"$check_log"
start=$(date +%s)
link_test_sparkle >>"$check_log" 2>&1 || true
- # make ci-checks is the list app.yml runs; each check runs even after a failure
+ # make ci-checks is the list app.yml runs, JOBS checks at a time; each runs even after a failure
echo "==> [check] make ci-checks, log: $check_log"
- if ! make ci-checks >>"$check_log" 2>&1; then
+ if ! make ci-checks CHECK_JOBS="$JOBS" >>"$check_log" 2>&1; then
check_failures=$(sed -n 's/^==> ci-checks failed://p' "$check_log")
[ -n "$check_failures" ] || check_failures=" ci-checks"
fi