subrascasse

Sub Rascasse: an iPhone dive log for Subsurface cloud storage, with a pure-Swift git client (GPL-2.0)
git clone https://git.schurger.org/subrascasse.git
Log | Files | Refs | README | LICENSE

Makefile (3703B)


      1 # The sources live on this host; Swift and Xcode run on a Mac reachable over SSH (CHUNGA), in the REMOTE directory.
      2 CHUNGA ?= chunga
      3 REMOTE ?= src/perso/divelog
      4 DEST ?= platform=iOS Simulator,name=DiveLog test iPhone
      5 
      6 .PHONY: sync test-kit project build test
      7 
      8 sync:
      9 	rsync -a --delete --exclude .git --exclude .claude --exclude '*.xcodeproj' --exclude build --exclude .build ./ $(CHUNGA):$(REMOTE)/
     10 
     11 # The Swift package alone (git + Subsurface format), without the interface. FILTER=TestName runs a single test.
     12 test-kit: sync
     13 	ssh $(CHUNGA) 'cd $(REMOTE)/Packages/DiveKit && swift test $(if $(FILTER),--filter $(FILTER)) 2>&1'
     14 
     15 project: sync
     16 	ssh $(CHUNGA) 'cd $(REMOTE) && xcodegen -q'
     17 
     18 build: project
     19 	ssh $(CHUNGA) 'cd $(REMOTE) && xcodebuild -quiet -scheme DiveLog -destination "$(DEST)" -derivedDataPath build CODE_SIGNING_ALLOWED=NO build'
     20 
     21 test: project
     22 	ssh $(CHUNGA) 'cd $(REMOTE) && xcodebuild -quiet -scheme DiveLog -destination "$(DEST)" -derivedDataPath build CODE_SIGNING_ALLOWED=NO test'
     23 
     24 # Launches the app in the simulator with the demo logbook and takes a screenshot.
     25 # ARGS = launch options (see LaunchOptions), SHOT = screenshot name, WAIT = delay before the screenshot.
     26 SIM ?= DiveLog test iPhone
     27 ARGS ?=
     28 DEMO ?= -demo
     29 # Language of the app for screenshots: en or fr.
     30 APPLANG ?= en
     31 # Environment variables passed to the app (SIMCTL_CHILD_NAME=value), for instance to open a real logbook.
     32 SIMENV ?=
     33 SHOT ?= shot
     34 WAIT ?= 4
     35 APP_ID = org.schurger.subrascasse
     36 .PHONY: shot
     37 shot:
     38 	@ssh $(CHUNGA) 'cd $(REMOTE) && xcrun simctl bootstatus "$(SIM)" -b >/dev/null && xcrun simctl install "$(SIM)" build/Build/Products/Debug-iphonesimulator/DiveLog.app && (xcrun simctl terminate "$(SIM)" $(APP_ID) 2>/dev/null; true) && $(SIMENV) xcrun simctl launch "$(SIM)" $(APP_ID) $(DEMO) -AppleLanguages "($(APPLANG))" -AppleLocale $(APPLANG)_CA $(ARGS) >/dev/null && sleep $(WAIT) && mkdir -p build/shots && xcrun simctl io "$(SIM)" screenshot build/shots/$(SHOT).png 2>/dev/null && sips -Z 1100 build/shots/$(SHOT).png --out build/shots/$(SHOT)-small.png >/dev/null'
     39 	@mkdir -p build/shots && scp -q $(CHUNGA):$(REMOTE)/build/shots/$(SHOT)-small.png build/shots/$(SHOT).png
     40 
     41 # Signed archive for TestFlight (automatic signing, App Store Connect API key from the Mac's environment).
     42 # BUILD=n sets the build number; each build gets its own build/tf-<number> folder.
     43 BUILD ?= $(shell date +%Y%m%d%H%M)
     44 OUT = build/tf-$(BUILD)
     45 AUTH = -allowProvisioningUpdates -authenticationKeyPath $$PERSO_ASC_KEY_PATH -authenticationKeyID $$PERSO_ASC_KEY_ID -authenticationKeyIssuerID $$PERSO_ASC_ISSUER_ID
     46 
     47 .PHONY: archive upload beta-setup
     48 archive: project
     49 	ssh $(CHUNGA) 'source ~/.zshrc_build && security unlock-keychain -p "$$(cat ~/.keyring_secret)" ~/Library/Keychains/login.keychain-db && cd $(REMOTE) && xcodebuild -quiet -scheme DiveLog -configuration Release -destination "generic/platform=iOS" -archivePath $(OUT)/DiveLog.xcarchive CURRENT_PROJECT_VERSION=$(BUILD) $(AUTH) archive && PATH=/usr/bin:$$PATH xcodebuild -quiet -exportArchive -archivePath $(OUT)/DiveLog.xcarchive -exportOptionsPlist tools/ExportOptions.plist -exportPath $(OUT)/ipa $(AUTH) && ls -la $(OUT)/ipa'
     50 
     51 # Uploads the archived IPA to TestFlight, with the same BUILD (altool looks for the key in API_PRIVATE_KEYS_DIR).
     52 upload:
     53 	ssh $(CHUNGA) 'source ~/.zshrc_build && cd $(REMOTE) && API_PRIVATE_KEYS_DIR=$$(dirname $$PERSO_ASC_KEY_PATH) xcrun altool --upload-app -f $(OUT)/ipa/DiveLog.ipa -t ios --apiKey $$PERSO_ASC_KEY_ID --apiIssuer $$PERSO_ASC_ISSUER_ID'
     54 
     55 # "Interne" tester group, TestFlight texts and notes of the latest build.
     56 beta-setup: sync
     57 	ssh $(CHUNGA) 'source ~/.zshrc_build && cd $(REMOTE) && fastlane ios beta_setup'