Skip to content

ci(repo): Add E2E reactions tests #7381

ci(repo): Add E2E reactions tests

ci(repo): Add E2E reactions tests #7381

name: stream_flutter_workflow
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
# Centralizes every gating decision for this workflow — path filter,
# draft state, and push-vs-PR semantics. Downstream jobs only need a
# single `if: needs.gate.outputs.should_run == 'true'`. A job skipped
# this way reports `success` to branch protection (vs. `on.paths`
# filtering, which hangs forever) — see
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks
#
# `push` events to master always run the full suite, matching the
# previous `on.push.branches: [master]` behavior.
gate:
runs-on: ubuntu-latest
outputs:
should_run: ${{ github.event_name == 'push' || (steps.filter.outputs.relevant == 'true' && github.event.pull_request.draft != true) }}
steps:
- name: "Git Checkout"
uses: actions/checkout@v7
- name: "Detect Path Changes"
uses: dorny/paths-filter@v4
id: filter
with:
filters: |
relevant:
- 'docs/**'
- 'packages/**'
- 'sample_app/**'
- '.github/workflows/stream_flutter_workflow.yml'
analyze:
needs: gate
timeout-minutes: 15
if: needs.gate.outputs.should_run == 'true'
runs-on: ubuntu-latest
steps:
- name: "Git Checkout"
uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: ./.github/actions/setup-flutter
- name: "Install Tools"
run: |
flutter pub global activate melos
- name: "Bootstrap Workspace"
run: melos bootstrap --verbose
- name: "Dart Analyze"
run: |
melos run analyze
- name: "Pub Check"
if: github.base_ref == 'master'
run: |
melos run lint:pub
format:
needs: gate
runs-on: ubuntu-latest
if: needs.gate.outputs.should_run == 'true'
timeout-minutes: 15
steps:
- name: "Git Checkout"
uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: ./.github/actions/setup-flutter
- name: "Install Tools"
run: |
flutter pub global activate melos
- name: "Bootstrap Workspace"
run: melos bootstrap
- name: "Melos Format"
run: melos run format
- name: "Validate Formatting"
run: |
./.github/workflows/scripts/validate-formatting.sh
test:
needs: gate
runs-on: ubuntu-latest
if: needs.gate.outputs.should_run == 'true'
timeout-minutes: 30
steps:
- name: "Git Checkout"
uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: ./.github/actions/setup-flutter
# This step is needed due to https://github.com/actions/runner-images/issues/11279
- name: Install SQLite3
run: sudo apt-get update && sudo apt-get install -y sqlite3 libsqlite3-dev
- name: "Install Tools"
run: |
flutter pub global activate melos
flutter pub global activate remove_from_coverage
- name: "Bootstrap Workspace"
run: melos bootstrap
- name: "Flutter Test"
run: melos run test:all
- name: "Collect Coverage"
run: melos run coverage:ignore-file --no-select
- name: "Upload Coverage"
uses: codecov/codecov-action@v7
with:
token: ${{secrets.CODECOV_TOKEN}}
files: packages/*/coverage/lcov.info
- name: "Stream Chat Coverage Check"
uses: VeryGoodOpenSource/very_good_coverage@v3.0.0
with:
path: packages/stream_chat/coverage/lcov.info
min_coverage: 70
- name: "Stream Chat Localizations Coverage Check"
uses: VeryGoodOpenSource/very_good_coverage@v3.0.0
with:
path: packages/stream_chat_localizations/coverage/lcov.info
min_coverage: 100
- name: "Stream Chat Persistence Coverage Check"
uses: VeryGoodOpenSource/very_good_coverage@v3.0.0
with:
path: packages/stream_chat_persistence/coverage/lcov.info
min_coverage: 95
- name: "Stream Chat Flutter Core Coverage Check"
uses: VeryGoodOpenSource/very_good_coverage@v3.0.0
with:
path: packages/stream_chat_flutter_core/coverage/lcov.info
min_coverage: 30
- name: "Stream Chat Flutter Coverage Check"
uses: VeryGoodOpenSource/very_good_coverage@v3.0.0
with:
path: packages/stream_chat_flutter/coverage/lcov.info
min_coverage: 44
build:
name: build (${{ matrix.platform }})
needs: gate
runs-on: ${{ matrix.os }}
if: needs.gate.outputs.should_run == 'true' && github.event_name == 'pull_request'
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- platform: android
os: ubuntu-latest
working-directory: sample_app/android
build-command: bundle exec fastlane build_apk
- platform: ios
os: macos-15 # Requires xcode 15 or later
working-directory: sample_app/ios
build-command: bundle exec fastlane build_ipa no_codesign:true
steps:
- name: "Git Checkout"
uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: ./.github/actions/setup-flutter
- uses: maxim-lobanov/setup-xcode@v1
if: matrix.platform == 'ios'
with:
xcode-version: '26.3'
- name: "Install Tools"
run: flutter pub global activate melos
- name: "Bootstrap Workspace"
run: melos bootstrap
- uses: ./.github/actions/setup-ruby
- name: "Build ${{ matrix.platform }} App"
working-directory: ${{ matrix.working-directory }}
run: ${{ matrix.build-command }}