Skip to content

Latest commit

 

History

History
172 lines (121 loc) · 8.82 KB

BuildAndDeploy.md

File metadata and controls

172 lines (121 loc) · 8.82 KB

Build and Deploy

Prerequisites

  • macOS 14 (Sonoma) or newer
  • Xcode 15 or newer
  • Swift 5.9 or newer (bundled with Xcode)
  • XcodeGen — brew install xcodegen

Cloning and first build

git clone <repo-url>
cd LogWeight
xcodegen generate
open LogWeight.xcodeproj

The .xcodeproj is always generated from project.yml. Do not edit the generated .xcodeproj directly — your changes will be overwritten the next time anyone runs xcodegen generate. To change the project structure, edit project.yml and re-run.

Running tests

Phase 4 expands iOS UI coverage beyond the original smoke test. Current UI suite checks:

  • stepper-primary save flow,
  • keyboard-disabled Save behavior (DA1 guard),
  • history trend chart presence,
  • settings control reachability,
  • large Dynamic Type (Accessibility XXXL) save path.

App icons (iOS, iPad, watchOS, macOS)

Icons live in Asset Catalogs and are generated from a small Swift tool (no extra dependencies beyond macOS + Xcode):

  • App/iOS/Resources/Assets.xcassets/AppIcon.appiconset/ — iPhone + iPad + App Store marketing sizes.
  • App/Watch/Resources/Assets.xcassets/AppIcon.appiconset/ — watch roles + watch-marketing 1024×1024.
  • App/macOS/Resources/Assets.xcassets/AppIcon.appiconset/ — macOS icon slots (1×/2×).

Regenerate after changing colours or the symbol in Tools/GenerateAppIcons.swift:

swift Tools/GenerateAppIcons.swift
xcodegen generate

Core unit tests (no Xcode required)

cd Packages/LogWeightCore
swift test

Full iOS build + UI tests

xcodegen generate
xcodebuild test \
  -scheme LogWeight \
  -destination 'platform=iOS Simulator,name=iPhone 15'

watchOS build (Phase 2)

The LogWeightWatch scheme builds the Watch app and its WidgetKit extension without requiring a paired iPhone simulator destination:

xcodegen generate
xcodebuild build \
  -project LogWeight.xcodeproj \
  -scheme LogWeightWatch \
  -destination 'generic/platform=watchOS Simulator' \
  CODE_SIGNING_ALLOWED=NO

To run on a paired simulator, choose the LogWeightWatchApp run destination in Xcode after opening the generated project. On a physical Watch, install via the iOS app’s Watch companion flow once signing is configured for both targets.

macOS build (Phase 3)

Use the LogWeightMac scheme. The app is a menu-bar utility (LSUIElement); after launch, choose the scalemass item in the menu bar. HealthKit prompts the first time you save.

xcodegen generate
xcodebuild build \
  -project LogWeight.xcodeproj \
  -scheme LogWeightMac \
  -destination 'platform=macOS' \
  CODE_SIGNING_ALLOWED=NO

Bundle identifier

The placeholder bundle identifier in Phase 1 is dev.logweight.LogWeight. Before TestFlight or App Store submission, change bundleIdPrefix in project.yml to your real Apple Developer Team prefix and re-run xcodegen generate.

Signing

project.yml sets CODE_SIGN_STYLE: Automatic with an empty DEVELOPMENT_TEAM. After running xcodegen generate, open the project in Xcode and select your team in the Signing & Capabilities tab. The team setting is per-developer and is intentionally not committed.

Versioning

Field Source Updated by
Marketing version (MARKETING_VERSION, user-facing) project.yml release-please when you merge its Release PR on main
Build number (CFBundleVersion) derived from git (Tools/build-number.sh, commit count) automatically: every merge to main adds a commit; nothing is committed or pushed
  • VERSIONING_SYSTEM is apple-generic in project.yml.
  • Do not hand-edit MARKETING_VERSION for releases; use the Release PR.
  • Baseline release tag: v0.3.0 (see CHANGELOG.md).

Breaking changes (Conventional Commits)

For a major semver bump, use one of:

  • feat!: … / fix!: … in the subject, or
  • BREAKING CHANGE: in the commit body.

TestFlight

  1. Set your real bundle ID prefix and team in project.yml.
  2. Merge feature work to main (the build number rises automatically with the commit count).
  3. When ready for a new user-facing version, merge the Release PR from release-please on main (updates MARKETING_VERSION and CHANGELOG.md; creates vX.Y.Z on GitHub).
  4. Pull main, run xcodegen generate, archive in Xcode (Product → Archive).
  5. Upload to App Store Connect.
  6. Add a privacy policy URL in App Store Connect — support/privacy/index.html, published at https://juuronina.de/LogWeight/support/privacy/ (see docs/AppStoreMetadata.md), using docs/Privacy.md as the canonical statement.
  7. Fill App Store listing fields from docs/AppStoreMetadata.md.
  8. Use localized listing variants from docs/AppStoreMetadata.localized.md.
  9. Walk through docs/AppStoreReleaseChecklist.md before pressing Submit for Review.

Store screenshots (Phase 4)

Baseline simulator captures:

bash Tools/CaptureStoreScreenshots.sh

Output folder: docs/store-screenshots/

Continuous Integration

.github/workflows/ci.yml runs on push to any branch and on workflow_dispatch:

  • Core tests: macos-latest
  • iOS + watchOS: macos-14 with latest-stable Xcode (matches the historical ~8m iOS job)
  1. cd Packages/LogWeightCore && swift test — Core unit tests.
  2. In parallel after (1): iOS and watchOS jobs each run .github/actions/apple-ci-setup (Homebrew download cache, DerivedData cache, xcodegen generate).
  3. iOS: ensure iOS/watchOS simulator platforms only when missing, then xcodebuild test — all 13 EntryViewSmokeTests.
  4. watchOS: ensure watchOS simulator platform when missing, then xcodebuild build -scheme LogWeightWatch … — app + widget extension compile check.

.github/workflows/release-please.yml runs on push to main and opens or updates a Release PR from Conventional Commits since the last v* tag.

CI cannot exercise real HealthKit (no entitlements on GitHub-hosted runners). The --use-in-memory-store launch argument injects InMemoryHealthKitStore for UI tests.

Release to App Store Connect

Tools/asc-release.py takes a release from a clean checkout to "version has build, screenshots and texts" (spec: specs/001-asc-store-sync). Preview is the default; nothing is written without --apply.

Prerequisites: pip install PyJWT cryptography, Xcode, and a git-ignored .env with ASC_KEY_ID, ASC_ISSUER_ID, ASC_KEY_PATH (App Store Connect API key). Secret values are never printed.

Tools/asc-release.py status                       # read-only: local layout + store state
Tools/asc-release.py screenshots --locale de-DE   # preview one locale
Tools/asc-release.py all --apply                  # build, upload, attach build, screenshots, texts
  • Target version defaults to MARKETING_VERSION in project.yml; use --version when the store spells it differently (for example 1.1). If the version is missing in the store it is created, never submitted.
  • Build number is the git commit count (Tools/build-number.sh; BUILD_NUMBER overrides it). A Run Script phase (Tools/set-build-number.sh) writes it into every app and extension in Release/archive builds, so Product → Archive in Xcode gets the same number as the tool. build --apply refuses uncommitted changes or a commit not on origin/main (--allow-unmerged overrides) and verifies the archive: same number in all bundles, signature valid. If the number is already used by an unusable build, or by another version, the run stops. Config/Version.xcconfig only holds a Debug placeholder.
  • Screenshots: docs/store-screenshots/<store-locale>/<device>/NN-name.png, exactly the required set per device (iPhone, iPad, Duo outer: 01-entry, 02-history, 03-settings; Duo inner adds 04-entry-landscape, 05-history-landscape; Watch: 01-entry, 02-history). Unchanged images are not re-uploaded; order follows the number prefix.
  • Release notes ("What's New") come from docs/AppStoreWhatsNew.md: rewrite it for every release and set its **Version:** line; the sync refuses a stale file.
  • Texts come from docs/AppStoreMetadata.md (English, also used for en-US/en-GB/en-CA) and docs/AppStoreMetadata.localized.md. Only changed fields are written.
  • Exit codes: 0 ok, 1 usage/config, 2 validation (nothing written), 3 store refused part of the run (safe to re-run), 4 version not editable.
  • Unit tests (no network): cd Tools && python3 -m unittest discover -s asc/tests -t .