Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
CI: build the signed APK on every main push, and a build:ios job that waits for a Mac runner
Duarte Santosb4f8bdf2fc1a
diff --git a/.gitlab-ci.yml b/.gitlab-ci.ymlindex 607ef107d..ce8a1d321 100644--- a/.gitlab-ci.yml+++ b/.gitlab-ci.yml@@ -12,7 +12,9 @@# before anything expensive starts.# build — the two container images → registry.gitlab.com/duartesantos8/opengym/{api,web},# and a run of both api targets that proves what each one does and does not carry-# package — the signed Android APK → job artifact + generic package registry+# package — the signed Android APK → job artifact + generic package registry, on every+# main push and every tag; the unsigned iOS archive the same way, once a Mac+# runner is registered (build:ios, see there)# verify — the images that were just pushed, started together through docker-compose.yml# and asked to serve; plus a Trivy scan and an SBOM per image# deploy — the browser-only demo → GitLab Pages@@ -588,11 +590,84 @@ build:apk:rules:- !reference [.rules, not_on_schedule]- *release_tag- # An APK build is ~8 minutes of shared-runner time; on main and MRs it is one click- # away rather than automatic. Flip `when: manual` off to have every push build one.+ # Every main push builds a signed APK (~9 minutes on the project runner; while the shared+ # runners paid for it, this was a manual job). The newest one is always at+ # $CI_PROJECT_URL/-/jobs/artifacts/main/browse?job=build:apk+ # which is the "try what is on main" build — and a red job here means the release tag+ # would have failed the same way, so it is caught before the tag.- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH+ # Merge requests: one click away, so a fork MR does not cost nine runner minutes for an+ # APK nobody asked for.+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"when: manualallow_failure: true++# The iOS build — the same VITE_MOBILE bundle, `cap sync` into ios/, `xcodebuild archive`.+# It cannot run on the Linux runner: Xcode only exists on macOS, and gitlab.com's hosted+# macOS runners are Premium/Ultimate only. So this job stays invisible until a Mac is+# registered as a project runner (shell executor, Xcode + CocoaPods + Node installed) and+# the CI variable IOS_RUNNER_TAG carries that runner's tag — set it, and the job appears+# in the next main/tag pipeline on that machine. Until then nothing here runs, so treat the+# script as the plan it is: it has not been through a pipeline yet.+#+# What comes out is an *unsigned* .ipa (CODE_SIGNING_ALLOWED=NO): the thing AltStore /+# Sideloadly users install with their own Apple ID, and the honest maximum without an Apple+# Developer Program membership. TestFlight or a signed build would add: an exportOptions+# plist, the distribution certificate + provisioning profile as protected file variables,+# and `xcodebuild -exportArchive` — none of which exists yet.+build:ios:+ stage: package+ tags:+ - $IOS_RUNNER_TAG+ timeout: 40 minutes+ needs:+ - test:frontend+ - job: release:preflight+ optional: true+ variables:+ # A shell runner keeps its node_modules and DerivedData between jobs; nothing to cache.+ GIT_STRATEGY: fetch+ script:+ - |+ set -eu+ cd frontend+ npm ci+ # `cap sync` also runs `pod install` for ios/ on macOS.+ npm run build:mobile+ VER="$(node -p "require('./package.json').version")"+ # Build number = the Android versionCode, so both apps count the same way.+ BUILD="$(sed -n 's/^ *versionCode \([0-9]*\).*/\1/p' android/app/build.gradle | sed -n 1p)"+ [ -n "$BUILD" ] || { echo "could not read versionCode from android/app/build.gradle" >&2; exit 1; }+ cd ios/App+ xcodebuild -workspace App.xcworkspace -scheme App -configuration Release -destination 'generic/platform=iOS' -archivePath "$PWD/build/App.xcarchive" MARKETING_VERSION="$VER" CURRENT_PROJECT_VERSION="$BUILD" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY="" archive | tail -40+ # An .ipa is a zip with the .app under Payload/.+ rm -rf Payload && mkdir Payload+ cp -R build/App.xcarchive/Products/Applications/App.app Payload/+ zip -qr "$CI_PROJECT_DIR/openGym-$VER-unsigned.ipa" Payload+ cd "$CI_PROJECT_DIR"+ sha256sum "openGym-$VER-unsigned.ipa" > "openGym-$VER-unsigned.ipa.sha256"+ cat "openGym-$VER-unsigned.ipa.sha256"+ echo "IPA_VERSION=$VER" > ipa.env+ if [ -n "${CI_COMMIT_TAG:-}" ]; then+ for f in "openGym-$VER-unsigned.ipa" "openGym-$VER-unsigned.ipa.sha256"; do+ curl --fail --silent --show-error --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "$f" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/opengym-ios/$VER/$f"+ echo "uploaded $f to the generic package registry"+ done+ fi+ artifacts:+ name: "openGym-ipa-$CI_COMMIT_REF_SLUG"+ paths:+ - "openGym-*.ipa"+ - "openGym-*.ipa.sha256"+ reports:+ dotenv: ipa.env+ expire_in: 30 days+ rules:+ - !reference [.rules, not_on_schedule]+ - if: $IOS_RUNNER_TAG == null || $IOS_RUNNER_TAG == ""+ when: never+ - *release_tag+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH- if: $CI_PIPELINE_SOURCE == "merge_request_event"when: manualallow_failure: truediff --git a/CHANGELOG.md b/CHANGELOG.mdindex 61e602090..f43dcde6a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -20,6 +20,11 @@ see why. Web bundle and APK; the API image only for the payload change.thing as before" had nothing to point at: every message was a fresh request. The last six lines— what you wrote and what the Coach concluded, never proposals or errors — now travel with therequest as context (`conversation`, documented in the prompt as data, not instruction).+- 🏗️ CI: every push to `main` now builds the signed APK as well, not only tags (the project+ runner pays for it, not shared minutes), so a broken Android build shows up before the release+ tag and the newest build is always downloadable from the `build:apk` job. A `build:ios` job+ (unsigned `.ipa` for AltStore/Sideloadly) is in the pipeline too, waiting for a Mac runner+ — `docs/MOBILE.md` says what to register.- ⬇️ **Updates are the last thing in Settings.** On Android a permanent row checks gitlab.com ondemand and installs a newer release with one tap (the download is verified against its checksumfirst); on the web the same spot links to the APK. The row no longer hides inside "Data" and nodiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex ed139efd0..d7ca8fbdd 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -48,7 +48,8 @@ cd frontend && npm testEvery MR runs the three test suites (frontend, MCP, api), with the results and the coverageof your diff shown in the MR itself, plus a build of the web image and the api image when youtouched their inputs. The frontend job also prints how much your change adds to the gzipped-bundle compared with main. The APK and the published images are manual jobs there.+bundle compared with main. The APK and the published images are manual jobs there (on+`main` both build on every push).One gitlab.com quirk: an MR from a fork runs its pipeline in *your* fork, which usually hasno runners enabled — so it would show "no pipeline" forever. For that reason the projectdiff --git a/docs/MOBILE.md b/docs/MOBILE.mdindex 9d1e24c8a..fe50f8496 100644--- a/docs/MOBILE.md+++ b/docs/MOBILE.md@@ -99,7 +99,10 @@ app outside the Play Store. Check the `.sha256` if you got the file from anywherBoth come out of CI: the `build:apk` job in [`.gitlab-ci.yml`](../.gitlab-ci.yml) runs`npm run build:mobile` and `./gradlew assembleRelease`, then `zipalign`s and signs the result-with the release key. The key lives in *protected* CI variables (`ANDROID_KEYSTORE_B64`,+with the release key. The job runs on every push to `main` too, so the newest unreleased+build is always one click away (signed with the same key, installs over a release):+`https://gitlab.com/DuarteSantos8/opengym/-/jobs/artifacts/main/browse?job=build:apk`+— a 30-day job artifact, not a package, and not what the in-app updater offers. The key lives in *protected* CI variables (`ANDROID_KEYSTORE_B64`,`ANDROID_KEYSTORE_PASSWORD`, `ANDROID_KEY_ALIAS`), so it only exists on `main` and on `v*`tags — a merge request from a fork can build an APK, but gets an unsigned one and never seesthe key. On a `v*` tag the signed APK is also pushed to the generic package registry, which is@@ -131,6 +134,19 @@ that would simply install. Your free options:onto your own iPhone. Apple expires the signature after 7 days; re-run from Xcode to renew.- **AltStore:** automates that 7-day re-signing over Wi-Fi via a Mac companion app.+There is a `build:ios` job in [`.gitlab-ci.yml`](../.gitlab-ci.yml) for exactly that path: the+same mobile bundle, `xcodebuild archive` without a signing identity, and an *unsigned* `.ipa`+(plus `.sha256`) as job artifact — on a tag also under `opengym-ios/<version>/` in the package+registry — for AltStore/Sideloadly users to sign with their own Apple ID. It needs a Mac: Xcode+does not run on the Linux project runner, and gitlab.com's hosted macOS runners are not on the+free tier. To switch it on, register a Mac as a project runner (shell executor; Xcode, CocoaPods+and Node installed; give it a tag such as `macos`) and set the CI/CD variable `IOS_RUNNER_TAG`+to that tag — the job then appears in every `main` and tag pipeline. Until that variable exists+the job is not part of any pipeline, and it has not run yet, so expect a first round of fixes.+A signed build (TestFlight, App Store) would additionally need an Apple Developer Program+membership, the distribution certificate and profile as protected file variables, and an+`-exportArchive` step — none of that is set up.+### Release notes for maintainers- Bump `versionName`/`versionCode` in `android/app/build.gradle` per release; keep them in