perf: move SwiftData cache and JSON encode off main thread during sync
Some checks failed
CI / Build · Debug (push) Failing after 10s
CI / Build · Release (push) Failing after 2s

- cacheStories() runs in Task.detached with a background ModelContext
- persistQuickCache() encodes 100 stories off-thread via Task.detached
- loadSectionSupplements() batches 5 parallel fetches into one sectionSupplement write

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kutesir
2026-06-30 13:14:27 +03:00
parent 217a51b013
commit 457866c7ac
6 changed files with 297 additions and 37 deletions

View File

@@ -1,14 +1,15 @@
# Gitea Actions reads this path (.github/workflows) as well as .gitea/workflows.
# iOS builds require a macOS runner: register a Gitea act_runner on a Mac with
# labels matching `runs-on` below (macos-14 / macos-15), or change them to your
# runner's label. On GitHub-hosted runners these labels work as-is.
# Gitea Actions reads .github/workflows/ (as well as .gitea/workflows/).
# Keeping everything here avoids running two duplicate pipelines.
#
# Runner requirement: a Mac with Xcode 16+ registered as a Gitea act_runner
# with labels "self-hosted" and "macos" (see CONTRIBUTING.md → Runner Setup).
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
branches: [main, develop]
push:
branches: [develop]
concurrency:
group: ci-${{ github.ref }}
@@ -16,13 +17,12 @@ concurrency:
jobs:
build:
name: Build · ${{ matrix.os }} · ${{ matrix.configuration }}
runs-on: ${{ matrix.os }}
name: Build · ${{ matrix.configuration }}
runs-on: [self-hosted, macos]
strategy:
fail-fast: false
matrix:
os: [ macos-14, macos-15 ]
configuration: [ Debug, Release ]
configuration: [Debug, Release]
steps:
- uses: actions/checkout@v4
@@ -31,7 +31,7 @@ jobs:
run: xcodebuild -version
- name: Install XcodeGen
run: brew install xcodegen
run: brew list xcodegen &>/dev/null || brew install xcodegen
- name: Generate Xcode project
run: xcodegen generate
@@ -49,3 +49,20 @@ jobs:
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
build
# Compiles the test bundle. No test targets exist yet (see docs/BACKLOG.md #13).
# Replace with `xcodebuild test` once a JarvisTests target is added to project.yml.
- name: Build for Testing (Debug)
if: matrix.configuration == 'Debug'
run: |
set -o pipefail
xcodebuild \
-project Jarvis.xcodeproj \
-scheme Jarvis \
-configuration Debug \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,OS=latest,name=iPhone 16' \
-derivedDataPath build \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
build-for-testing

65
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,65 @@
# Triggers on merge to main. Archives the app and exports an IPA.
# TestFlight upload requires three secrets set in:
# Gitea → Repository Settings → Actions → Secrets
#
# ASC_KEY_ID — App Store Connect API key ID (e.g. ABC123DEFG)
# ASC_ISSUER_ID — Issuer ID from App Store Connect → Users → API Keys
# ASC_PRIVATE_KEY — Full contents of the downloaded .p8 file
#
# The runner Mac must have the distribution certificate and team K8BLMMR883
# provisioning profile in its keychain (set up once in Xcode on that machine).
name: Release
on:
push:
branches: [main]
jobs:
archive:
name: Archive & Export IPA
runs-on: [self-hosted, macos]
steps:
- uses: actions/checkout@v4
- name: Xcode version
run: xcodebuild -version
- name: Install XcodeGen
run: brew list xcodegen &>/dev/null || brew install xcodegen
- name: Generate Xcode project
run: xcodegen generate
- name: Archive (Release, device)
run: |
set -o pipefail
xcodebuild archive \
-project Jarvis.xcodeproj \
-scheme Jarvis \
-configuration Release \
-sdk iphoneos \
-archivePath build/Jarvis.xcarchive \
DEVELOPMENT_TEAM=K8BLMMR883
- name: Export IPA
run: |
set -o pipefail
xcodebuild -exportArchive \
-archivePath build/Jarvis.xcarchive \
-exportPath build/ipa \
-exportOptionsPlist ExportOptions.plist
- name: Upload to TestFlight
env:
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_PRIVATE_KEY: ${{ secrets.ASC_PRIVATE_KEY }}
run: |
echo "$ASC_PRIVATE_KEY" > /tmp/AuthKey_${ASC_KEY_ID}.p8
xcrun altool --upload-app \
--type ios \
--file build/ipa/Jarvis.ipa \
--apiKey "$ASC_KEY_ID" \
--apiIssuer "$ASC_ISSUER_ID"
rm -f /tmp/AuthKey_${ASC_KEY_ID}.p8