Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a51201d
Record the plan and decisions for the iPhone and Android library.
mwhitham Nov 28, 2026
f60a0b2
Add the UniFFI crate, the Swift package, and the Android library.
mwhitham Nov 28, 2026
91a56ea
Put the command line behind a default feature, and run protocol opera…
mwhitham Nov 28, 2026
653561a
Open, edit, and save athlete files from the phone packages.
mwhitham Nov 28, 2026
21f2f78
Move the calculations into the core, and read their data through one …
mwhitham Nov 29, 2026
76bb349
Turn on the ureq and uuid features the sign-in runtime uses.
mwhitham Nov 29, 2026
9090e11
Run single-record and range calculations from the phone packages.
mwhitham Nov 29, 2026
d689dd3
Add a test-only sign-in provider for the phone host client tests.
mwhitham Nov 28, 2026
37d8d8c
Add the host client with browser sign-in to the Swift and Android pac…
mwhitham Nov 28, 2026
6bc7f7c
Stage, install, and gate the iPhone and Android packages, with runnab…
mwhitham Nov 28, 2026
0e416f0
Track the Android manifests and resource files.
mwhitham Nov 28, 2026
2b27a1b
Let the phone scripts follow CARGO_TARGET_DIR.
mwhitham Nov 28, 2026
5e8f67b
Check the migration backup by file name in the phone storage test.
mwhitham Nov 29, 2026
36d3a74
Record the phone library as version 3.1.0.
mwhitham Nov 29, 2026
320c5bf
Move to version 3.1.0 with migration step 9.
mwhitham Nov 29, 2026
c075431
End only the test person's sessions in the host refresh test.
mwhitham Nov 29, 2026
78b76c9
Record the 3.1.0 phone test runs.
mwhitham Nov 29, 2026
825e444
Name the model's free-form JSON values.
mwhitham Nov 30, 2026
a6d603f
Give phone apps typed records and calculation answers.
mwhitham Nov 30, 2026
cc3b475
Serve the Swift package from this repository.
mwhitham Nov 30, 2026
e95e347
Describe every phone library call, type, field, and case.
mwhitham Nov 30, 2026
c1cc8e0
Add app guides and starting-point examples for iPhone and Android.
mwhitham Nov 30, 2026
463dfee
Say whether a release's tag carries the Swift package.
mwhitham Nov 30, 2026
1a31e37
Record typed records, the in-repository Swift package, and the guides.
mwhitham Nov 30, 2026
76f6e8d
Describe every record and result type for Xcode and Android Studio.
mwhitham Dec 1, 2026
93b27be
Point the evidence at the rebased commits.
mwhitham Dec 1, 2026
511e1c3
Update zip to 9.9 for its security fixes.
mwhitham Dec 1, 2026
779f2e9
Read a calendar-day bound on a range calculation as the whole day.
mwhitham Dec 1, 2026
dee6e11
Name all six coach record types and all six score types.
mwhitham Dec 1, 2026
c638b40
Record the fixes made before review, and gather the evidence again.
mwhitham Dec 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 150 additions & 13 deletions .github/workflows/release-cross-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
# - Actions > Release cross-platform > Run workflow on `main`, with `publish`
# set, from the website or GitHub Mobile;
# - pushing a version tag, such as v2.1.2.
# A release from `main` tags the tested commit with the version in
# packages/npm/package.json, after every check has passed.
# A release from `main` tags the version in packages/npm/package.json after
# every check has passed. The tag names one commit on top of the tested commit:
# it points the root Package.swift at the tested XCFramework on the GitHub
# release, by address and checksum, and adds the generated Swift, so Swift
# Package Manager installs the iPhone package by version (D332). A release from
# a pushed tag cannot add that commit, so its iPhone package cannot be installed
# by version; the run says so.
#
# The tarball is staged on npm, not published (D251). npm's trusted publishing
# lets this job stage it with a short-lived identity token from GitHub, so no
Expand Down Expand Up @@ -98,8 +103,12 @@ jobs:
elif [ "$GITHUB_REF" = refs/heads/main ]; then
existing="$(tag_commit "$tag")"
if [ -n "$existing" ] && [ "$existing" != "$GITHUB_SHA" ]; then
echo "::error::$tag already names commit $existing. Raise the version in packages/npm/package.json to release $GITHUB_SHA."
exit 1
# The tag may name this commit's Swift package release commit.
parent="$(gh api "repos/$GITHUB_REPOSITORY/commits/$existing" --jq '.parents[0].sha')"
if [ "$parent" != "$GITHUB_SHA" ]; then
echo "::error::$tag already names commit $existing. Raise the version in packages/npm/package.json to release $GITHUB_SHA."
exit 1
fi
fi
else
echo "::error::A release starts only from main or a version tag, not $GITHUB_REF."
Expand Down Expand Up @@ -138,6 +147,23 @@ jobs:
pattern: archive-*
path: archives
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: mobile-apple
path: apple
- name: Check the iPhone package is the tested one
run: |
version="${TAG#v}"
zip="apple/AthleticStandardFFI-$version.xcframework.zip"
checksum="$(sha256sum "$zip" | cut -d ' ' -f 1)"
[ "$(jq -r .version apple/apple-report.json)" = "$version" ] ||
{ echo "::error::apple-report.json is not version $version"; exit 1; }
[ "$(jq -r .asset_sha256 apple/apple-report.json)" = "$checksum" ] ||
{ echo "::error::the zip is not the tested one"; exit 1; }
[ "$(jq -r .commit apple/apple-report.json)" = "$GITHUB_SHA" ] ||
{ echo "::error::the iPhone package was staged from another commit"; exit 1; }
grep -qF "checksum: \"$checksum\"" apple/swift-package/Package.swift ||
{ echo "::error::the staged Package.swift does not name the tested checksum"; exit 1; }
- name: Check the archives and the tarball agree
run: |
version="${TAG#v}"
Expand Down Expand Up @@ -174,7 +200,7 @@ jobs:
run: npm stage publish "./npm-tarball/$(node -p "require('./npm-tarball/pack-summary.json').tarball")"
# Tag only after the package is staged. A failed staging then leaves no
# tag, so a fixed workflow can release the same version from a new commit.
- name: Tag the tested commit
- name: Tag the Swift package release commit
if: github.ref_type != 'tag'
env:
GH_TOKEN: ${{ github.token }}
Expand All @@ -199,17 +225,122 @@ jobs:
fi
}
existing="$(tag_commit "$TAG")"
if [ -z "$existing" ]; then
gh api "repos/$GITHUB_REPOSITORY/git/refs" -f ref="refs/tags/$TAG" -f sha="$GITHUB_SHA" --silent
echo "Tagged $GITHUB_SHA as $TAG."
elif [ "$existing" != "$GITHUB_SHA" ]; then
echo "::error::$TAG already names commit $existing."
exit 1
if [ -n "$existing" ]; then
parent="$(gh api "repos/$GITHUB_REPOSITORY/commits/$existing" --jq '.parents[0].sha')"
[ "$parent" = "$GITHUB_SHA" ] || { echo "::error::$TAG already names commit $existing."; exit 1; }
echo "$TAG already names the Swift package release commit $existing."
exit 0
fi
# One commit on top of the tested commit: the release Package.swift and
# the generated Swift that the iPhone package job tested (D332). The
# files go through `--input`, because a command-line argument cannot
# hold the generated Swift.
version="${TAG#v}"
entries=()
while IFS= read -r -d '' file; do
path="${file#apple/swift-package/}"
jq -n --rawfile content "$file" '{content: $content, encoding: "utf-8"}' > blob.json
blob="$(gh api "repos/$GITHUB_REPOSITORY/git/blobs" --input blob.json --jq .sha)"
entries+=("$(jq -nc --arg path "$path" --arg sha "$blob" '{path: $path, mode: "100644", type: "blob", sha: $sha}')")
done < <(find apple/swift-package -type f -print0 | sort -z)
base="$(gh api "repos/$GITHUB_REPOSITORY/git/commits/$GITHUB_SHA" --jq .tree.sha)"
printf '%s\n' "${entries[@]}" | jq -s --arg base "$base" '{base_tree: $base, tree: .}' > tree.json
tree="$(gh api "repos/$GITHUB_REPOSITORY/git/trees" --input tree.json --jq .sha)"
jq -n --arg tree "$tree" --arg parent "$GITHUB_SHA" --arg message "Athletic Standard $version for Swift Package Manager" \
'{message: $message, tree: $tree, parents: [$parent]}' > commit.json
commit="$(gh api "repos/$GITHUB_REPOSITORY/git/commits" --input commit.json --jq .sha)"
gh api "repos/$GITHUB_REPOSITORY/git/refs" -f ref="refs/tags/$TAG" -f sha="$commit" --silent
echo "Tagged $commit, on top of $GITHUB_SHA, as $TAG."
- name: Say the iPhone package needs a release from main
if: github.ref_type == 'tag'
run: |
echo "::warning::$TAG was pushed, so it names a commit without the Swift package release files. The XCFramework joins the release, but Swift Package Manager cannot install $TAG. Release from main to install the iPhone package by version."
- name: Publish the checked archives as the GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$TAG" archives/* --repo "$GITHUB_REPOSITORY" --verify-tag --title "$TAG"
run: |
version="${TAG#v}"
gh release create "$TAG" archives/* "apple/AthleticStandardFFI-$version.xcframework.zip" apple/apple-report.json \
--repo "$GITHUB_REPOSITORY" --verify-tag --title "$TAG"

# The Android library (D332). Its report joins the GitHub release. The tested
# Maven bundle is uploaded to Maven Central as a deployment the maintainer must
# publish there; until then nothing can resolve it. A missing Central credential
# skips that upload and says so. The iPhone package is already released: the
# publish job tagged its release commit and added the XCFramework.
publish-mobile:
name: Stage the Android library
needs: [version, validate, publish]
if: needs.version.outputs.release == 'true'
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
env:
TAG: ${{ needs.version.outputs.tag }}
GH_TOKEN: ${{ github.token }}
CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
SIGNING_KEY: ${{ secrets.MAVEN_SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }}
steps:
- uses: actions/download-artifact@v4
with:
name: mobile-apple
path: apple
- uses: actions/download-artifact@v4
with:
name: mobile-android
path: android
- name: Check both packages are this version
run: |
version="${TAG#v}"
for report in apple/apple-report.json android/android-report.json; do
found="$(jq -r .version "$report")"
[ "$found" = "$version" ] || { echo "::error::$report is version $found, not $version"; exit 1; }
done
zip="apple/AthleticStandardFFI-$version.xcframework.zip"
[ "$(sha256sum "$zip" | cut -d ' ' -f 1)" = "$(jq -r .asset_sha256 apple/apple-report.json)" ] ||
{ echo "::error::the zip is not the tested one"; exit 1; }
- name: Add the Android report to the GitHub release
run: gh release upload "$TAG" android/android-report.json --clobber --repo "$GITHUB_REPOSITORY"
- name: Upload the tested Maven bundle for the maintainer to publish
run: |
version="${TAG#v}"
path="ai/athleticstandard/athleticstandard/$version"
public="https://repo1.maven.org/maven2/$path/athleticstandard-$version.pom"
if curl -fsS -o published.pom "$public"; then
cmp -s published.pom "android/maven/$path/athleticstandard-$version.pom" ||
{ echo "::error::Maven Central already holds a different $version"; exit 1; }
echo "Maven Central already holds this version with the same POM."
exit 0
fi
if [ -z "$CENTRAL_USERNAME" ] || [ -z "$SIGNING_KEY" ]; then
echo "::warning::No Maven Central credential: the Android library was not uploaded. The release is partial."
exit 0
fi
echo "$SIGNING_KEY" | gpg --batch --import
cd android/maven
for file in "$path"/*; do
case "$file" in *.asc|*.md5|*.sha1|*.sha256|*.sha512|maven-metadata*) continue ;; esac
gpg --batch --yes --pinentry-mode loopback --passphrase "$SIGNING_PASSPHRASE" -ab "$file"
md5sum "$file" | cut -d ' ' -f 1 > "$file.md5"
sha1sum "$file" | cut -d ' ' -f 1 > "$file.sha1"
done
zip -q -r ../bundle.zip "$path"
cd ..
deployment="$(curl -fsS -u "$CENTRAL_USERNAME:$CENTRAL_PASSWORD" \
-F "bundle=@bundle.zip" "https://central.sonatype.com/api/v1/publisher/upload?publishingType=USER_MANAGED")"
echo "Uploaded deployment $deployment. Publish it at https://central.sonatype.com/publishing/deployments."
- name: Report
run: |
{
echo "### iPhone and Android packages for $TAG"
echo
echo "- XCFramework: \`$(jq -r .asset_sha256 apple/apple-report.json)\` on the GitHub release. In a release from main, \`$TAG\` names the Swift package release commit."
echo "- Android archive: \`$(jq -r .aar_sha256 android/android-report.json)\`, uploaded to Maven Central for approval when a credential is set."
echo "- Next: publish the Maven deployment, then run release-mobile-packages.yml for $TAG to check both public installs."
} >> "$GITHUB_STEP_SUMMARY"

report:
name: Report on the pull request
Expand Down Expand Up @@ -239,7 +370,7 @@ jobs:
IFS= read -r -d '' body <<'EOF' || true
**@TAG@ is staged on npm and waiting for your approval.**

The full check passed. `@TAG@` now names the tested commit, and the [GitHub release](@SERVER@/@REPO@/releases/tag/@TAG@) holds the native archives. Nobody can install @TAG@ from npm until you approve it.
The full check passed. @TAGGED@ The [GitHub release](@SERVER@/@REPO@/releases/tag/@TAG@) holds the native archives and the iPhone XCFramework. Nobody can install @TAG@ from npm until you approve it.

Approve it in one of two ways. Both ask for your two-factor code.

Expand All @@ -257,6 +388,12 @@ jobs:
Open the [release run](@RUN@) to see which step failed. Fix it in a new pull request, merge it, and comment `/release` on that pull request.
EOF
fi
if [ "$GITHUB_REF_TYPE" = tag ]; then
tagged="\`$TAG\` was pushed, so it names the tested commit, and Swift Package Manager cannot install it; release from main for the iPhone package."
else
tagged="\`$TAG\` now names one commit on top of the tested commit, which adds the Swift package files."
fi
body="${body//@TAGGED@/$tagged}"
body="${body//@TAG@/$TAG}"
body="${body//@VERSION@/${TAG#v}}"
body="${body//@RUN@/$RUN_URL}"
Expand Down
116 changes: 116 additions & 0 deletions .github/workflows/release-mobile-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# The last step of an iPhone and Android release (D332). The maintainer runs it by
# hand after release-cross-platform.yml finished for a version and the Maven
# Central deployment was published.
#
# swift-package checks that the tag names the Swift package release commit: its
# Package.swift names the XCFramework on the GitHub release with the tested
# checksum, and that zip has that checksum. Then it installs the package from
# this repository by version, as an app does, and runs it offline.
#
# maven-check installs `ai.athleticstandard:athleticstandard` from Maven Central
# in the example app and runs the library's tests on an emulator, offline from
# any host except the local test host.
name: Release iPhone and Android packages

on:
workflow_dispatch:
inputs:
tag:
description: The released version tag, such as v3.1.0
required: true
type: string

permissions:
contents: read

jobs:
swift-package:
name: Install the Swift package from this repository by version
runs-on: macos-15
env:
TAG: ${{ inputs.tag }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.tag }}
# The tag's commit and the tested commit under it.
fetch-depth: 2
- name: Check the tag names the tested XCFramework
run: |
version="${TAG#v}"
zip="AthleticStandardFFI-$version.xcframework.zip"
gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern "$zip" --pattern apple-report.json --dir released
tested="$(jq -r .asset_sha256 released/apple-report.json)"
found="$(shasum -a 256 "released/$zip" | cut -d ' ' -f 1)"
[ "$found" = "$tested" ] || { echo "::error::the released zip is $found; the release tested $tested"; exit 1; }
[ "$(jq -r .commit released/apple-report.json)" = "$(git rev-parse HEAD^)" ] ||
{ echo "::error::$TAG does not name a release commit on top of the tested commit"; exit 1; }
url="https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/$zip"
grep -qF ".binaryTarget(name: \"AthleticStandardFFI\", url: \"$url\", checksum: \"$tested\")" Package.swift ||
{ echo "::error::Package.swift at $TAG does not name $url with checksum $tested"; exit 1; }
echo "$TAG names the tested XCFramework, $tested."
- name: Install from this repository by version and run offline
run: |
version="${TAG#v}"
mkdir -p check/Sources/check
cat > check/Package.swift <<MANIFEST
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "check", platforms: [.macOS(.v14)],
dependencies: [.package(url: "https://github.com/$GITHUB_REPOSITORY", exact: "$version")],
targets: [.executableTarget(name: "check", dependencies: [.product(name: "AthleticStandard", package: "ath")])])
MANIFEST
cat > check/Sources/check/main.swift <<'SOURCE'
import AthleticStandard
import Foundation
let source = RecordData.source(SourceData(sourceType: .wearable, dataWriter: "Example Band", dataRoute: "provider_export"))
try checkRecordData(data: source)
print(libraryVersion())
SOURCE
printed="$(cd check && swift run -q check)"
[ "$printed" = "$version" ] || { echo "::error::the public package reports $printed, not $version"; exit 1; }
echo "The Swift package $version installs from $GITHUB_REPOSITORY, runs offline, and reports $printed."

maven-check:
name: Install the Android library from Maven Central
runs-on: ubuntu-latest
timeout-minutes: 60
env:
TAG: ${{ inputs.tag }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.tag }}
- run: rustup show active-toolchain || rustup toolchain install
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Install the emulator
run: |
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null || true
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "platforms;android-36" "build-tools;36.1.0" \
"platform-tools" "emulator" "system-images;android-36;google_apis;x86_64" > /dev/null
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Start the emulator
run: mobile/scripts/start-emulator.sh "system-images;android-36;google_apis;x86_64"
- name: Run the library's tests against the public artifact
run: |
export PATH="$ANDROID_HOME/platform-tools:$PATH"
fixtures="$PWD/target/mobile-fixtures"
ATH_MOBILE_FIXTURES="$fixtures" cargo test --locked -p athleticstandard-mobile --test fixtures
cargo build --locked --bin ath
mobile/scripts/roundtrip.sh create "$fixtures/roundtrip"
mobile/scripts/host-test-env.sh start target/host-test
source target/host-test/env
adb reverse "tcp:$ATH_TEST_HOST_PORT" "tcp:$ATH_TEST_HOST_PORT"
adb reverse "tcp:$ATH_TEST_ISSUER_PORT" "tcp:$ATH_TEST_ISSUER_PORT"
cd mobile/android
./gradlew --no-daemon -p example :app:connectedDebugAndroidTest \
-Pathleticstandard.repository=https://repo1.maven.org/maven2 -Pathleticstandard.fixtures="$fixtures" \
-Pandroid.testInstrumentationRunnerArguments.hostUrl="$ATH_TEST_HOST_URL" \
-Pandroid.testInstrumentationRunnerArguments.issuer="$ATH_TEST_ISSUER"
Loading
Loading