Repository navigation
feat: add $flutter_version to captured events (#640) #1735
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| detect-markdown-only: | |
| uses: PostHog/.github/.github/workflows/detect-markdown-only.yml@ec25337d9fae0100622cbfea1bd5bd88284ac10b | |
| permissions: | |
| pull-requests: read | |
| dart-format: | |
| needs: detect-markdown-only | |
| name: Dart format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| # axi92/flutter-action is a fork of subosito/flutter-action that SHA-pins its internal | |
| # actions/cache calls; subosito itself uses tag refs which conflicts with our org-wide | |
| # "Require actions to be pinned to a full-length commit SHA" policy. Tracks upstream. | |
| - uses: axi92/flutter-action@36d2c2625bac6ea011cd7808d2a01bd8a7e5c766 # feature/pin-action-sha @ 2026-04-30 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Install dependencies | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: flutter pub get | |
| - name: Check Dart formatting | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: make checkFormatDart | |
| dart-analyze: | |
| needs: detect-markdown-only | |
| name: Dart analyze | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| # axi92/flutter-action is a fork of subosito/flutter-action that SHA-pins its internal | |
| # actions/cache calls; subosito itself uses tag refs which conflicts with our org-wide | |
| # "Require actions to be pinned to a full-length commit SHA" policy. Tracks upstream. | |
| - uses: axi92/flutter-action@36d2c2625bac6ea011cd7808d2a01bd8a7e5c766 # feature/pin-action-sha @ 2026-04-30 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Install dependencies | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: flutter pub get | |
| - name: Analyze Dart | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: make analyzeDart | |
| public-api: | |
| needs: detect-markdown-only | |
| name: Dart public API | |
| if: github.event_name == 'pull_request' && needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| # axi92/flutter-action is a fork of subosito/flutter-action that SHA-pins its internal | |
| # actions/cache calls; subosito itself uses tag refs which conflicts with our org-wide | |
| # "Require actions to be pinned to a full-length commit SHA" policy. Tracks upstream. | |
| - uses: axi92/flutter-action@36d2c2625bac6ea011cd7808d2a01bd8a7e5c766 # feature/pin-action-sha @ 2026-04-30 | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Check Dart public API snapshot | |
| run: make checkApiDart | |
| kotlin-format: | |
| needs: detect-markdown-only | |
| name: Kotlin format | |
| runs-on: macos-26 | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| - name: Install ktlint | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: brew install ktlint | |
| - name: Check Kotlin formatting | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: make checkFormatKotlin | |
| swift-format: | |
| needs: detect-markdown-only | |
| name: Swift format | |
| runs-on: macos-26 | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| - name: Install swiftformat | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: brew install swiftformat | |
| - name: Check Swift formatting | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: make checkFormatSwift | |
| # Unit tests | |
| test: | |
| needs: detect-markdown-only | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| # axi92/flutter-action is a fork of subosito/flutter-action that SHA-pins its internal | |
| # actions/cache calls; subosito itself uses tag refs which conflicts with our org-wide | |
| # "Require actions to be pinned to a full-length commit SHA" policy. Tracks upstream. | |
| - uses: axi92/flutter-action@36d2c2625bac6ea011cd7808d2a01bd8a7e5c766 # feature/pin-action-sha @ 2026-04-30 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Install dependencies | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: flutter pub get | |
| - name: Test | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| working-directory: ./posthog_flutter | |
| run: flutter test | |
| - name: Test compliance adapter | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| working-directory: ./sdk_compliance_adapter | |
| run: flutter test test/feature_flag_has_experiment_test.dart test/flags_retry_test.dart test/minimal_flag_called_events_test.dart test/timestamp_test.dart | |
| # Browser-only tests (`@TestOn('browser')`) are skipped by the VM run above. | |
| - name: Test (web) | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| timeout-minutes: 5 | |
| working-directory: ./posthog_flutter | |
| run: flutter test --platform chrome test/posthog_flutter_web_handler_test.dart test/posthog_flutter_web_setup_test.dart test/posthog_widget_web_test.dart test/posthog_widget_test.dart test/web_before_send_test.dart test/web_canvas_mask_provider_test.dart | |
| # dart2js resolves the isolate-handler conditional import differently; | |
| # only a wasm compile exercises the dart2wasm selection this test guards. | |
| - name: Test (web, wasm) | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| timeout-minutes: 5 | |
| working-directory: ./posthog_flutter | |
| run: flutter test --platform chrome --wasm test/posthog_isolate_error_handler_web_test.dart | |
| publish-dry-run: | |
| needs: detect-markdown-only | |
| name: Pub publish dry run | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| # axi92/flutter-action is a fork of subosito/flutter-action that SHA-pins its internal | |
| # actions/cache calls; subosito itself uses tag refs which conflicts with our org-wide | |
| # "Require actions to be pinned to a full-length commit SHA" policy. Tracks upstream. | |
| - uses: axi92/flutter-action@36d2c2625bac6ea011cd7808d2a01bd8a7e5c766 # feature/pin-action-sha @ 2026-04-30 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Install dependencies | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: flutter pub get | |
| - name: Validate pub package | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| working-directory: ./posthog_flutter | |
| run: flutter pub publish --dry-run | |
| # Apple builds (iOS and macOS) with CocoaPods and Swift Package Manager | |
| build-apple: | |
| needs: detect-markdown-only | |
| runs-on: macos-26 | |
| strategy: | |
| matrix: | |
| target: [ios, macos] | |
| package_manager: [cocoapods, spm] | |
| include: | |
| - target: ios | |
| build_command: flutter build ios --simulator --no-codesign | |
| - target: macos | |
| build_command: flutter build macos | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| # axi92/flutter-action is a fork of subosito/flutter-action that SHA-pins its internal | |
| # actions/cache calls; subosito itself uses tag refs which conflicts with our org-wide | |
| # "Require actions to be pinned to a full-length commit SHA" policy. Tracks upstream. | |
| - uses: axi92/flutter-action@36d2c2625bac6ea011cd7808d2a01bd8a7e5c766 # feature/pin-action-sha @ 2026-04-30 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Select Xcode version | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0 | |
| with: | |
| xcode-version: '26.4' | |
| - name: Enable Swift Package Manager | |
| if: ${{ needs.detect-markdown-only.outputs.markdown_only != 'true' && (matrix.package_manager == 'spm') }} | |
| run: flutter config --enable-swift-package-manager | |
| - name: Disable Swift Package Manager | |
| if: ${{ needs.detect-markdown-only.outputs.markdown_only != 'true' && (matrix.package_manager == 'cocoapods') }} | |
| run: flutter config --no-enable-swift-package-manager | |
| - name: Install dependencies | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: flutter pub get | |
| - name: Build ${{ matrix.target }} (${{ matrix.package_manager }}) | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| working-directory: ./example | |
| run: ${{ matrix.build_command }} | |
| - name: iOS plugin tests | |
| if: ${{ needs.detect-markdown-only.outputs.markdown_only != 'true' && matrix.target == 'ios' && matrix.package_manager == 'cocoapods' }} | |
| timeout-minutes: 15 | |
| working-directory: ./example/ios | |
| run: xcodebuild test -workspace Runner.xcworkspace -scheme Runner -destination 'platform=iOS Simulator,name=iPhone 17 Pro' -only-testing:RunnerTests | |
| # Android build | |
| build-android: | |
| needs: detect-markdown-only | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| - name: 'Set up Java' | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 | |
| with: | |
| java-version: 17 | |
| distribution: 'temurin' | |
| # axi92/flutter-action is a fork of subosito/flutter-action that SHA-pins its internal | |
| # actions/cache calls; subosito itself uses tag refs which conflicts with our org-wide | |
| # "Require actions to be pinned to a full-length commit SHA" policy. Tracks upstream. | |
| - uses: axi92/flutter-action@36d2c2625bac6ea011cd7808d2a01bd8a7e5c766 # feature/pin-action-sha @ 2026-04-30 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Install dependencies | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: flutter pub get | |
| - name: Build Android | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| working-directory: ./example | |
| run: flutter build apk | |
| - name: Android unit tests | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| working-directory: ./example/android | |
| run: ./gradlew :posthog_flutter:testDebugUnitTest | |
| # Web build | |
| build-web: | |
| needs: detect-markdown-only | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Complete markdown-only PR check | |
| if: needs.detect-markdown-only.outputs.markdown_only == 'true' | |
| run: echo "Only Markdown files changed; no additional work is required for this check." | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| # axi92/flutter-action is a fork of subosito/flutter-action that SHA-pins its internal | |
| # actions/cache calls; subosito itself uses tag refs which conflicts with our org-wide | |
| # "Require actions to be pinned to a full-length commit SHA" policy. Tracks upstream. | |
| - uses: axi92/flutter-action@36d2c2625bac6ea011cd7808d2a01bd8a7e5c766 # feature/pin-action-sha @ 2026-04-30 | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| with: | |
| channel: 'stable' | |
| cache: true | |
| - name: Install dependencies | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| run: flutter pub get | |
| - name: Build Web | |
| if: needs.detect-markdown-only.outputs.markdown_only != 'true' | |
| working-directory: ./example | |
| run: flutter build web |