Skip to content

Add .github/copilot-instructions.md and copilot-setup-steps.yml for coding agent onboarding #9

Add .github/copilot-instructions.md and copilot-setup-steps.yml for coding agent onboarding

Add .github/copilot-instructions.md and copilot-setup-steps.yml for coding agent onboarding #9

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Verify the library compiles and analyzes on the minimum supported Flutter.
# Dev dependencies (lints, test helpers) may require a newer SDK, so this
# job resolves only production dependencies and runs analysis without tests.
compat-check:
name: Compatibility Check (Flutter 3.38.0)
runs-on: macos-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
# Pinned to commit SHA for supply chain security — update hash when upgrading.
- uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0
with:
channel: stable
flutter-version: '3.38.0'
cache: true
- name: Resolve dependencies
run: flutter pub get
- name: Analyze library code
run: dart analyze --fatal-infos lib
- name: Run unit tests (excluding golden tests)
run: flutter test --exclude-tags=golden
build:
name: Build & Unit Tests
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
# Pinned to commit SHA for supply chain security — update hash when upgrading.
- uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0
with:
channel: stable
flutter-version: '3.41.2'
cache: true
- name: Install dependencies
run: flutter pub get
- name: Check formatting
run: |
dart format --language-version=latest .
if [ -n "$(git diff --name-only)" ]; then
echo "::error::The following files need formatting:"
git diff --name-only
echo ""
git diff
exit 1
fi
- name: Analyze
run: dart analyze --fatal-infos
- name: Run unit tests with coverage
run: flutter test --coverage
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage/lcov.info
test-ios:
name: Integration Tests (iOS Simulator)
needs: [compat-check, build]
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
# Pinned to commit SHA for supply chain security — update hash when upgrading.
- uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0
with:
channel: stable
flutter-version: '3.41.2'
cache: true
- name: Install dependencies
run: flutter pub get
working-directory: example
- name: Boot iOS simulator
run: |
DEVICE_ID=$(xcrun simctl list devices available -j | \
python3 -c "
import json, sys
data = json.load(sys.stdin)
for runtime, devices in data['devices'].items():
if 'iOS' in runtime:
for d in devices:
if 'iPhone' in d['name'] and d['isAvailable']:
print(d['udid'])
sys.exit(0)
sys.exit(1)
")
echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV
xcrun simctl boot "$DEVICE_ID" 2>/dev/null || true
# Wait for simulator to be fully ready
xcrun simctl bootstatus "$DEVICE_ID" -b
# Verify the simulator is visible to Flutter
flutter devices
- name: Pre-build for iOS simulator
run: flutter build ios --simulator --target=integration_test/run_all_test.dart
working-directory: example
- name: Run integration tests on iOS
run: |
flutter test integration_test/run_all_test.dart \
--timeout 20m \
--ignore-timeouts \
--dart-define=MIXPANEL_TOKEN="${{ secrets.MIXPANEL_TOKEN }}" \
-d "$DEVICE_ID"
working-directory: example
test-android:
name: Integration Tests (Android API ${{ matrix.api-level }})
needs: [compat-check, build]
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- api-level: 24
target: default
arch: x86_64
profile: Nexus 6
name: "Android 7.0 (Nougat)"
- api-level: 34
target: google_apis
arch: x86_64
profile: pixel_6
name: "Android 14 (Latest)"
steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android/sdk/ndk
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/share/swift
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo apt-get clean
- 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
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
# Pinned to commit SHA for supply chain security — update hash when upgrading.
- uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0
with:
channel: stable
flutter-version: '3.41.2'
cache: true
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Install dependencies
run: flutter pub get
working-directory: example
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.target }}-${{ matrix.arch }}-${{ matrix.profile }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@5d6e86df22ab11632167a1a6b0c9ab0dc3469586 # v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
profile: ${{ matrix.profile }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -accel on
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Run integration tests on Android
uses: reactivecircus/android-emulator-runner@5d6e86df22ab11632167a1a6b0c9ab0dc3469586 # v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
profile: ${{ matrix.profile }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -accel on
disable-animations: true
working-directory: example
script: |
flutter devices
flutter build apk --target=integration_test/run_all_test.dart
flutter test integration_test/run_all_test.dart --timeout 20m --ignore-timeouts --dart-define=MIXPANEL_TOKEN="${{ secrets.MIXPANEL_TOKEN }}"
test-macos:
name: Integration Tests (macOS Desktop)
needs: [compat-check, build]
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
# Pinned to commit SHA for supply chain security — update hash when upgrading.
- uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0
with:
channel: stable
flutter-version: '3.41.2'
cache: true
- name: Install dependencies
run: flutter pub get
working-directory: example
- name: Pre-build for macOS
run: flutter build macos --target=integration_test/run_all_test.dart
working-directory: example
- name: Run integration tests on macOS
run: |
flutter test integration_test/run_all_test.dart \
--timeout 20m \
--ignore-timeouts \
--dart-define=MIXPANEL_TOKEN="${{ secrets.MIXPANEL_TOKEN }}" \
-d macos
working-directory: example