Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
172 changes: 172 additions & 0 deletions .github/workflows/airiz-motor-mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: AirizMotor apps

# Builds the downloadable AirizMotor apps and publishes them to the "airiz-motor-mac" release from main:
# macOS AirizMotor-macOS-AppleSilicon.dmg + AirizMotor-macOS-Intel.dmg
# The apps are thin native windows around the live site, so every push to the site reaches them through GitHub
# Pages without a rebuild. This workflow only runs when the shell in desktop/ changes. Every build is opened and
# checked on its own system first; only builds that passed are published, and the download links never change.
on:
push:
branches: [main]
paths:
- 'apps/airiz-motor/shell/desktop/**'
- '.github/workflows/airiz-motor-mac.yml'
pull_request:
paths:
- 'apps/airiz-motor/shell/desktop/**'
- '.github/workflows/airiz-motor-mac.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: airiz-motor-mac-${{ github.ref }}
cancel-in-progress: true

jobs:
desktop:
name: Desktop (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: macOS Apple silicon
os: macos-15
- name: macOS Intel
os: macos-15-intel
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install PyInstaller, Pillow and pywebview
run: python -m pip install --disable-pip-version-check pyinstaller pillow pywebview
- name: Install Inno Setup
if: runner.os == 'Windows'
shell: pwsh
run: |
$iscc = Join-Path ${env:ProgramFiles(x86)} 'Inno Setup 6\ISCC.exe'
if (-not (Test-Path $iscc) -and -not (Get-Command iscc -ErrorAction SilentlyContinue)) {
choco install innosetup --no-progress -y
}
- name: Make sure the WebView2 runtime is there (the Windows window uses it)
if: runner.os == 'Windows'
shell: pwsh
run: |
$client = '{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
$keys = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\$client",
"HKCU:\Software\Microsoft\EdgeUpdate\Clients\$client"
$version = $keys | Where-Object { Test-Path $_ } | ForEach-Object { (Get-ItemProperty $_).pv } |
Where-Object { $_ -and $_ -ne '0.0.0.0' } | Select-Object -First 1
if ($version) { Write-Host "WebView2 runtime $version"; exit 0 }
$setup = Join-Path $env:RUNNER_TEMP 'MicrosoftEdgeWebview2Setup.exe'
Invoke-WebRequest 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile $setup
Start-Process -FilePath $setup -ArgumentList '/silent', '/install' -Wait
- name: Stop XProtect scans (they make hdiutil fail with "Resource busy")
if: runner.os == 'macOS'
run: |
sudo pkill -9 XProtect > /dev/null 2>&1 || true
for attempt in $(seq 1 20); do pgrep -x XProtect > /dev/null || break; sleep 3; done
- name: Build and package
run: python apps/airiz-motor/shell/desktop/build.py --require-installer
- name: Open the built app and check its window shows this commit's AirizMotor
run: python apps/airiz-motor/shell/desktop/smoke_test.py --built --local-site
- name: Install with AirizMotor-Windows-Setup.exe, run it, uninstall it
if: runner.os == 'Windows'
shell: pwsh
run: |
$setup = Resolve-Path 'apps/airiz-motor/shell/desktop/dist/AirizMotor-Windows-Setup.exe'
$log = Join-Path $env:RUNNER_TEMP 'airizmotor-setup.log'
$process = Start-Process -FilePath $setup -Wait -PassThru -ArgumentList @(
'/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/TASKS=desktopicon', "/LOG=$log")
if ($process.ExitCode -ne 0) { Get-Content $log -Tail 40; throw "Setup failed with exit code $($process.ExitCode)" }
$app = Join-Path $env:LOCALAPPDATA 'Programs\AirizMotor\AirizMotor.exe'
if (-not (Test-Path $app)) { throw "AirizMotor.exe was not installed to $app" }
$shortcuts = @(
(Join-Path ([Environment]::GetFolderPath('Programs')) 'AirizMotor.lnk'),
(Join-Path ([Environment]::GetFolderPath('Desktop')) 'AirizMotor.lnk'))
foreach ($link in $shortcuts) { if (-not (Test-Path $link)) { throw "Missing shortcut: $link" } }
$entry = Get-ChildItem 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall' |
Get-ItemProperty | Where-Object DisplayName -eq 'AirizMotor'
if (-not $entry) { throw 'AirizMotor is missing from Settings > Apps' }
python apps/airiz-motor/shell/desktop/smoke_test.py --local-site $app
if ($LASTEXITCODE -ne 0) { throw 'The installed app failed its checks' }
Start-Process -FilePath $entry.UninstallString.Trim('"') -Wait -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART'
for ($i = 0; $i -lt 60 -and (Test-Path $app); $i++) { Start-Sleep -Seconds 1 }
if (Test-Path $app) { throw 'Uninstalling left AirizMotor.exe behind' }
foreach ($link in $shortcuts) { if (Test-Path $link) { throw "Uninstalling left a shortcut: $link" } }
Write-Host 'Installed, ran and uninstalled cleanly'
- name: Check the Mac app and disk image
if: runner.os == 'macOS'
run: |
APP=apps/airiz-motor/shell/desktop/dist/AirizMotor.app
test "$(plutil -extract CFBundleIdentifier raw "$APP/Contents/Info.plist")" = "io.github.juw12.airizmotor.desktop"
test "$(plutil -extract CFBundleShortVersionString raw "$APP/Contents/Info.plist")" = "$(python3 -c 'import json; print(json.load(open("apps/airiz-motor/shell/desktop/shell.json"))["version"])')"
echo "Architecture: $(lipo -archs "$APP/Contents/MacOS/AirizMotor")"
codesign --verify --deep --verbose=2 "$APP"
for image in apps/airiz-motor/shell/desktop/dist/*.dmg; do hdiutil verify "$image"; done
- uses: actions/upload-artifact@v4
with:
name: AirizMotor-${{ runner.os }}-${{ runner.arch }}
path: apps/airiz-motor/shell/desktop/dist/AirizMotor-*
if-no-files-found: error
retention-days: 14

publish:
needs: [desktop]
if: ${{ !cancelled() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: AirizMotor-*
path: dist
merge-multiple: true
- name: Publish the apps to the apps release
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
cd dist
FILES=""
for name in AirizMotor-macOS-AppleSilicon.dmg AirizMotor-macOS-Intel.dmg; do
if [ -f "$name" ]; then
FILES="$FILES $name"
else
echo "::warning::$name was not built in this run; the release keeps its previous copy (if any)."
fi
done
if [ -z "$FILES" ]; then
echo "::error::No app passed its checks."
exit 1
fi
sha256sum $FILES > SHA256SUMS.txt
cat SHA256SUMS.txt
cat > notes.md <<'EOF'
**Airiz Motor**: console for the AIRIZ rig: remote control by code, camera and device checks. The apps open the same Airiz Motor as https://juw12.github.io/projects/airiz-motor/ in their own window.

| Your device | Download | How to install |
| --- | --- | --- |
| **Mac with Apple chip (M1 and newer)** | [AirizMotor-macOS-AppleSilicon.dmg](https://github.com/juw12/projects/releases/download/airiz-motor-mac/AirizMotor-macOS-AppleSilicon.dmg) | Open it and drag AirizMotor to Applications. The first time, macOS blocks it because it is not notarized: **System Settings → Privacy & Security → Open Anyway**. |
| **Mac with Intel chip** | [AirizMotor-macOS-Intel.dmg](https://github.com/juw12/projects/releases/download/airiz-motor-mac/AirizMotor-macOS-Intel.dmg) | Same as above. Not sure which Mac? Apple menu → About This Mac shows **Chip** (Apple) or **Processor** (Intel). |
| **iPhone / iPad** | [Open in Safari](https://juw12.github.io/projects/airiz-motor/) | Share → **Add to Home Screen** (free, full screen, updates itself). |
| **Android** | [AirizMotor-android.apk](https://github.com/juw12/projects/releases/download/airiz-motor-android/AirizMotor-android.apk) | Open the file on the phone and allow your browser to install apps once. |

The apps load AirizMotor from the web, so new versions arrive the moment they are published, with no reinstall. Checksums for this build: `SHA256SUMS.txt`.
EOF
{
echo
echo "Built from ${GITHUB_SHA::7}."
} >> notes.md
if gh release view airiz-motor-mac --repo "$REPO" > /dev/null 2>&1; then
gh release upload airiz-motor-mac $FILES SHA256SUMS.txt --clobber --repo "$REPO"
gh release edit airiz-motor-mac --notes-file notes.md --repo "$REPO"
else
gh release create airiz-motor-mac $FILES SHA256SUMS.txt --title "Airiz Motor for Mac" \
--notes-file notes.md --latest=false --repo "$REPO"
fi
137 changes: 137 additions & 0 deletions .github/workflows/lingua-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Lingua Android app

# Builds Lingua-android.apk (apps/lingua/android/: a full-screen window around the web app), signs it with the key in the
# repository's secrets, opens it on an emulator and puts it on the lingua-android release.
on:
workflow_dispatch:
push:
branches: [main]
paths:
- "apps/lingua/android/**"
- ".github/workflows/lingua-android.yml"
pull_request:
paths:
- "apps/lingua/android/**"
- ".github/workflows/lingua-android.yml"

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"

- name: "Build and sign the .apk (no Gradle: aapt2, javac, d8, zipalign, apksigner)"
env:
KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
run: |
tools=$(ls -d "$ANDROID_HOME"/build-tools/34.* 2>/dev/null | sort -V | tail -n 1)
if [ -z "$tools" ]; then tools=$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -n 1); fi
platform="$ANDROID_HOME/platforms/android-34"
if [ ! -f "$platform/android.jar" ]; then platform=$(ls -d "$ANDROID_HOME"/platforms/android-* | sort -V | tail -n 1); fi
export ANDROID_BUILD_TOOLS="$tools" ANDROID_JAR="$platform/android.jar"
echo "build-tools: $tools, platform: $platform"
if [ -n "$KEYSTORE_B64" ]; then
echo "$KEYSTORE_B64" | base64 -d > "$RUNNER_TEMP/release.p12"
printf '%s' "$KEYSTORE_PASSWORD" > "$RUNNER_TEMP/release-password.txt"
python3 apps/lingua/android/build.py --keystore "$RUNNER_TEMP/release.p12" --password-file "$RUNNER_TEMP/release-password.txt" --alias shells
echo "SIGNED=release" >> "$GITHUB_ENV"
else
echo "::warning::No signing key secret here (a pull request from a fork): signed with a throwaway key."
python3 apps/lingua/android/build.py
echo "SIGNED=throwaway" >> "$GITHUB_ENV"
fi
echo "APKSIGNER=$tools/apksigner" >> "$GITHUB_ENV"

- name: The certificate is the one app.json names
if: env.SIGNED == 'release'
run: |
expected=$(python3 -c "import json; print(json.load(open('apps/lingua/android/app.json'))['certSha256'])")
found=$("$APKSIGNER" verify --print-certs apps/lingua/android/dist/Lingua-android.apk | sed -n 's/^Signer #1 certificate SHA-256 digest: //p')
echo "expected $expected"
echo "found $found"
[ "$expected" = "$found" ]
(cd apps/lingua/android/dist && sha256sum Lingua-android.apk > Lingua-android.apk.sha256 && cat Lingua-android.apk.sha256)

- uses: actions/upload-artifact@v4
with:
name: lingua-android
path: apps/lingua/android/dist/
if-no-files-found: error

emulator:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: lingua-android
path: apps/lingua/android/dist
- name: Enable KVM
run: |
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: Open the app on an emulator and check it stays up
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
profile: pixel_6
disable-animations: true
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none
script: python3 apps/lingua/android/smoke.py apps/lingua/android/dist/Lingua-android.apk
- uses: actions/upload-artifact@v4
if: always()
with:
name: lingua-android-emulator-check
path: |
apps/lingua/android/dist/*.png
apps/lingua/android/dist/android-logcat.txt
retention-days: 7

publish:
needs: [build, emulator]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: lingua-android
path: dist
# The lingua-android release keeps one address for the download. The file there is replaced only when
# apps/lingua/android/app.json names a new versionName, never by a rebuild of the same version.
- name: Put the .apk on the lingua-android release
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(python3 -c "import json; print(json.load(open('apps/lingua/android/app.json'))['versionName'])")
echo "$version" > dist/Lingua-android.version.txt
if ! gh release view lingua-android --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then
printf '%s\n' "Lingua for Android: a full-screen window around the web app (https://juw12.github.io/projects/lingua/)." "" \
"Download [Lingua-android.apk](https://github.com/$GITHUB_REPOSITORY/releases/download/lingua-android/Lingua-android.apk), open the file on the phone and allow \"install unknown apps\" for your browser once." \
"It is not from a store: Android asks before it installs." > notes.md
gh release create lingua-android dist/Lingua-android.apk dist/Lingua-android.apk.sha256 dist/Lingua-android.version.txt \
--title "Lingua for Android" --notes-file notes.md --latest=false --repo "$GITHUB_REPOSITORY"
echo "Made the lingua-android release with Lingua-android.apk $version"
exit 0
fi
published=$(gh release download lingua-android --repo "$GITHUB_REPOSITORY" --pattern Lingua-android.version.txt --output - 2>/dev/null || true)
if [ "$published" = "$version" ]; then
echo "the lingua-android release already has Lingua-android.apk $version"
exit 0
fi
gh release upload lingua-android dist/Lingua-android.apk dist/Lingua-android.apk.sha256 dist/Lingua-android.version.txt --clobber --repo "$GITHUB_REPOSITORY"
echo "Lingua-android.apk on the lingua-android release is now $version (was: ${published:-none})"
Loading
Loading