Skip to content

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

ci: parse bash scripts with bash in scriptcheck; reuse a passing app workflow in releases

raymondchinsff3670798adf
diff --git a/Makefile b/Makefile
index fb54baa..1eedf79 100644
--- a/Makefile
+++ b/Makefile
@@ -162,7 +162,7 @@ scriptcheck:
if [ -z "$(strip $(SCRIPTS))" ]; then $(call SKIP,scriptcheck,a git checkout); exit 0; fi; \
for s in $(SCRIPTS); do \
shellcheck "$$s" || exit 1; \
- sh -n "$$s" || exit 1; \
+ case "$$(head -n 1 "$$s")" in *bash*) bash -n "$$s" ;; *) sh -n "$$s" ;; esac || exit 1; \
done; \
echo "==> scriptcheck: $(words $(SCRIPTS)) scripts lint and parse clean"
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index 7940841..98507c9 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -7,7 +7,8 @@ Every release is a GitHub release of `raymondchins/Bridgeplay` carrying `Bridgep
downloads the Latest release's `Bridgeplay.zip` when it runs, so `release-local.sh` uploads
the installer again only when its fingerprint (every file it ships) changes, which is when
the engines, GPTK, the configs or the installer itself change. A release whose sources
-already passed `make ci-checks` (only the version bump differs) skips them;
+already passed `make ci-checks`, here or in the `app` workflow on GitHub (only the version
+bump differs), skips them;
`BRIDGEPLAY_FORCE_CHECKS=1` runs them anyway. Installed apps read
`https://github.com/raymondchins/Bridgeplay/releases/latest/download/appcast.xml`
(`SUFeedURL`), so whatever release is marked **Latest** is the update feed.
@@ -39,6 +40,9 @@ installation. `VersioningTests` guards both.
## Steps
+0. Push the changes first and wait for the `app` workflow to pass on them
+ (`gh run watch -R raymondchins/Bridgeplay`, about 10 minutes, free on this public repo).
+ The release then reuses that result instead of running the checks again here.
1. Bump and commit:
```sh
scripts/bump-version.sh patch # or minor / major
diff --git a/scripts/build-local.sh b/scripts/build-local.sh
index 3f0da46..40e4427 100755
--- a/scripts/build-local.sh
+++ b/scripts/build-local.sh
@@ -237,6 +237,26 @@ if [ "$run_checks" -eq 1 ] && [ -n "$fingerprint" ] && [ "${BRIDGEPLAY_FORCE_CHE
checks_reused=1
fi
+# The app workflow runs the same make ci-checks on every push to main, so a release whose
+# sources (version.h aside) match a commit that workflow passed skips them too: push, let
+# CI pass, bump, release. Needs gh; without it, or with no passing run, the checks run here.
+ci_slug=${BRIDGEPLAY_CI_REPO:-raymondchins/Bridgeplay}
+ci_passed() {
+ command -v gh >/dev/null 2>&1 || return 1
+ for sha in $(git -C "$repo" rev-list --max-count=5 HEAD); do
+ git -C "$repo" diff --quiet "$sha" HEAD -- . ':(exclude)dylib/version.h' || continue
+ gh run list -R "$ci_slug" -w app --commit "$sha" --status success --limit 1 \
+ --json headSha -q '.[].headSha' 2>/dev/null | grep -q . && { echo "$sha"; return 0; }
+ done
+ return 1
+}
+if [ "$run_checks" -eq 1 ] && [ -n "$fingerprint" ] && [ "${BRIDGEPLAY_FORCE_CHECKS:-0}" != 1 ] \
+ && ci_sha=$(ci_passed); then
+ echo "==> [check] skipped: GitHub CI (app) passed make ci-checks on $(printf '%.7s' "$ci_sha"), same sources (BRIDGEPLAY_FORCE_CHECKS=1 runs them)"
+ run_checks=0
+ checks_reused=1
+fi
+
check_failures=""
if [ "$run_checks" -eq 1 ]; then
check_log=$LOG_DIR/checks.log