summaryrefslogtreecommitdiff
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/README.txt25
-rw-r--r--deploy/buildbot/master/master.cfg55
-rw-r--r--deploy/buildbot/worker/run-worker.sh2
3 files changed, 77 insertions, 5 deletions
diff --git a/deploy/README.txt b/deploy/README.txt
index ff2a5f8..d3494e1 100644
--- a/deploy/README.txt
+++ b/deploy/README.txt
@@ -37,7 +37,12 @@ http://192.168.3.110/git/kukuri.git (branch main) every 30 seconds.
Within ~30s a build starts on the worker:
setup-git-auth -> git checkout -> detekt-gate -> assemble
- -> jvm/android/wasm/native tests -> bundles -> deploy-to-lighttpd (FTP upload).
+ -> jvm/android/wasm/native tests -> bundles
+ -> wait-github-ios (blocks until the Actions "ios" run for the same commit
+ finishes; fails the build if it fails)
+ -> fetch-github-ios (downloads the "kukuri-ios" artifact, stages
+ distributions/kukuri-ios-<v>.zip)
+ -> deploy-to-lighttpd (FTP upload of all zips + the apk)
Watch progress: http://192.168.3.110:8010 (waterfall / console view)
CLI watcher (waits for a build newer than the given number; exit 0 = success):
@@ -137,7 +142,17 @@ github actions (ios):
6. iOS
------
-GitHub Actions builds the orgflow-domain iOS targets on every push to main
-(.github/workflows/ios.yml) and uploads the "kukuri-ios" Actions artifact
-(debug frameworks for iosArm64 / iosSimulatorArm64 + all klibs):
-https://github.com/ketsuban152/kukuri/actions
+Two places:
+ - buildbot ships "kukuri-ios-<v>.zip" (frameworks + klibs from the Actions
+ run) to http://192.168.3.110/artifact/kukuri/latest/ together with the
+ other artifacts.
+ - the raw "kukuri-ios" Actions artifact stays on
+ https://github.com/ketsuban152/kukuri/actions
+
+ios.yml uses actions/cache for ~/.gradle/caches, ~/.gradle/wrapper and ~/.konan
+(key: ios-<os>-<hash of build scripts>) - the first run after a cache-key
+change is cold, later runs reuse the Konan toolchain and task outputs.
+
+The worker reads /run/secrets/github_token (a repo-scoped PAT) for the
+artifact download; run-worker.sh mounts it from
+/root/buildbot/secrets/github_token.
diff --git a/deploy/buildbot/master/master.cfg b/deploy/buildbot/master/master.cfg
index 457209e..3f509af 100644
--- a/deploy/buildbot/master/master.cfg
+++ b/deploy/buildbot/master/master.cfg
@@ -75,6 +75,61 @@ factory.addStep(steps.ShellCommand(
name='bundles',
command=['./gradlew', 'bundleDesktop', 'bundleWasm', 'bundleNative', 'bundleWeb', 'bundleApk'],
env=ENV, haltOnFailure=True))
+# Wait for the GitHub Actions "ios" workflow to finish for this exact commit,
+# then pull its "kukuri-ios" artifact so deploy ships it alongside the rest.
+factory.addStep(steps.ShellCommand(
+ name='wait-github-ios',
+ command=['bash', '-c', '''
+set -e
+REPO="ketsuban152/kukuri"
+TOKEN="Authorization: Bearer $(cat /run/secrets/github_token)"
+SHA=$(git rev-parse HEAD)
+DEADLINE=$(( $(date +%s) + 2400 ))
+while [ "$(date +%s)" -lt "$DEADLINE" ]; do
+ RES=$(curl -sf -H "$TOKEN" "https://api.github.com/repos/$REPO/actions/runs?head_sha=$SHA" | python3 -c '
+import json,sys
+rs=[r for r in json.load(sys.stdin).get("workflow_runs",[]) if r.get("name")=="ios"]
+if rs: print(rs[0]["id"], rs[0]["status"], rs[0].get("conclusion") or "")
+' || true)
+ if [ -n "$RES" ]; then
+ set -- $RES
+ if [ "$2" = "completed" ]; then
+ if [ "$3" = "success" ]; then echo "ios run $1: success"; exit 0; fi
+ echo "ios run $1 finished with conclusion: $3"; exit 1
+ fi
+ echo "ios run $1: $2..."
+ else
+ echo "no ios run for $SHA yet..."
+ fi
+ sleep 20
+done
+echo "timeout waiting for the ios run"; exit 1
+'''],
+ env=ENV, haltOnFailure=True, timeout=2700))
+factory.addStep(steps.ShellCommand(
+ name='fetch-github-ios',
+ command=['bash', '-c', '''
+set -e
+REPO="ketsuban152/kukuri"
+TOKEN="Authorization: Bearer $(cat /run/secrets/github_token)"
+SHA=$(git rev-parse HEAD)
+RUN=$(curl -sf -H "$TOKEN" "https://api.github.com/repos/$REPO/actions/runs?head_sha=$SHA" | python3 -c '
+import json,sys
+rs=[r for r in json.load(sys.stdin).get("workflow_runs",[]) if r.get("name")=="ios" and r.get("conclusion")=="success"]
+print(rs[0]["id"])
+')
+URL=$(curl -sf -H "$TOKEN" "https://api.github.com/repos/$REPO/actions/runs/$RUN/artifacts" | python3 -c '
+import json,sys
+a=[x for x in json.load(sys.stdin)["artifacts"] if x["name"]=="kukuri-ios"]
+print(a[0]["archive_download_url"])
+')
+curl -sfL -H "$TOKEN" -o /tmp/kukuri-ios.zip "$URL"
+DIST=modules/orgflow-domain/build/distributions
+V=$(ls "$DIST"/kukuri-wasm-web-*.zip | sed "s/.*-\([0-9][^/]*\)\.zip/\1/")
+cp /tmp/kukuri-ios.zip "$DIST/kukuri-ios-$V.zip"
+echo "staged: $DIST/kukuri-ios-$V.zip"
+'''],
+ env=ENV, haltOnFailure=True))
factory.addStep(steps.ShellCommand(
name='deploy-to-lighttpd',
command=['bash', '-c', '''
diff --git a/deploy/buildbot/worker/run-worker.sh b/deploy/buildbot/worker/run-worker.sh
index 6d9c5ce..4e1a6cd 100644
--- a/deploy/buildbot/worker/run-worker.sh
+++ b/deploy/buildbot/worker/run-worker.sh
@@ -16,6 +16,8 @@ docker run -d --name kukuri-worker --restart unless-stopped \
-e MASTER=192.168.3.110:9989 \
-v jenkins-data:/var/jenkins_home \
-v /root/buildbot/secrets/worker_pass:/run/secrets/worker_pass:ro \
+ -v /root/buildbot/secrets/git_pass:/run/secrets/git_pass:ro \
+ -v /root/buildbot/secrets/github_token:/run/secrets/github_token:ro \
kukuri-worker:latest
sleep 5