Skip to content

Reduce CI contention with stale-run cancellation and shared Apple builds #149

Reduce CI contention with stale-run cancellation and shared Apple builds

Reduce CI contention with stale-run cancellation and shared Apple builds #149

name: Large AI cn1lib iOS xcodebuild check
# The lightweight vision, language, and LiteRT bridges now live in core and
# are exercised by the normal port/build tests. Keep this isolated native
# check for the two deliberately large cn1libs.
on:
workflow_dispatch:
pull_request:
branches: [master]
paths:
- 'maven/cn1-ai-whisper/**'
- 'maven/cn1-ai-stablediffusion/**'
- 'scripts/gen-ai-cn1libs.py'
- '.github/workflows/ai-cn1lib-native-check.yml'
- 'scripts/ci/select-cn1lib-checks.py'
- 'scripts/ci/check-ios-cn1lib.py'
push:
branches: [master]
paths:
- 'maven/cn1-ai-whisper/**'
- 'maven/cn1-ai-stablediffusion/**'
- 'scripts/gen-ai-cn1libs.py'
- '.github/workflows/ai-cn1lib-native-check.yml'
- 'scripts/ci/select-cn1lib-checks.py'
- 'scripts/ci/check-ios-cn1lib.py'
concurrency:
# Only the latest revision needs validation. PR numbers keep forks isolated;
# event names keep a manual/scheduled run from cancelling a push or PR run.
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
select:
runs-on: ubuntu-24.04
outputs:
libraries: ${{ steps.plan.outputs.ios_ai }}
link: ${{ steps.plan.outputs.admob_link }}
steps:
- uses: actions/checkout@v6
- name: Select impacted libraries before allocating a Mac
id: plan
env:
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
run: python3 scripts/ci/select-cn1lib-checks.py
native-checks:
# One runner, one checkout/tool installation, and one pod resolution per
# library. Keep both ARC modes and both AdMob link destinations.
needs: select
if: ${{ needs.select.outputs.libraries != '' }}
runs-on: macos-14
timeout-minutes: 120
steps:
- uses: actions/checkout@v6
- name: Select Xcode 16
run: |
set -euo pipefail
XCODE_PATH=$(ls -d /Applications/Xcode_16*.app 2>/dev/null | sort -V | tail -1)
test -n "$XCODE_PATH"
sudo xcode-select -s "$XCODE_PATH/Contents/Developer"
xcodebuild -version
- name: Install xcodegen once
if: needs.select.outputs.libraries != ''
run: command -v xcodegen || brew install xcodegen
- name: Compile cn1-ai-whisper (MRR and ARC)
if: ${{ !cancelled() && contains(needs.select.outputs.libraries, 'cn1-ai-whisper') }}
run: python3 scripts/ci/check-ios-cn1lib.py cn1-ai-whisper
- name: Compile cn1-ai-stablediffusion (MRR and ARC)
if: ${{ !cancelled() && contains(needs.select.outputs.libraries, 'cn1-ai-stablediffusion') }}
run: python3 scripts/ci/check-ios-cn1lib.py cn1-ai-stablediffusion