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
41 changes: 32 additions & 9 deletions .github/workflows/check_db_entities.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
name: check_db_entities

on:
on:
pull_request:
paths:
- 'packages/stream_chat_persistence/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# Centralizes every gating decision for this workflow — currently just a
# path filter. 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
gate:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.persistence }}
steps:
- name: 📥 Checkout
uses: actions/checkout@v6

- name: 🛤️ Detect Path Changes
uses: dorny/paths-filter@v3
Comment thread
xsahil03x marked this conversation as resolved.
id: filter
with:
filters: |
persistence:
- 'packages/stream_chat_persistence/**'
- '.github/workflows/check_db_entities.yml'
Comment thread
xsahil03x marked this conversation as resolved.

check_entity_modifications:
needs: gate
if: needs.gate.outputs.should_run == 'true'
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
Expand All @@ -24,22 +47,22 @@ jobs:
ENTITY_DIR="packages/stream_chat_persistence/lib/src/entity"
TEMP_FILE="modified_entities"
BASE_BRANCH="${{ github.base_ref }}"

echo "Using base branch: origin/$BASE_BRANCH for comparison"

# Check if any entity files have changed compared to the base branch
git diff-index --name-only origin/$BASE_BRANCH -- $ENTITY_DIR | grep -E '\.dart$' > $TEMP_FILE || true

if [ ! -s "$TEMP_FILE" ]; then
echo "✅ No entity files changed."
echo "has_changes=false" >> $GITHUB_OUTPUT
rm $TEMP_FILE
exit 0
fi

echo "⚠️ Entity files modified:"
cat $TEMP_FILE

# Set modified files as output
echo "modified_files<<EOF" >> $GITHUB_OUTPUT
cat $TEMP_FILE >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -74,4 +97,4 @@ jobs:
2. Update entity schema tests if necessary.

*Note: This comment is automatically generated by the CI workflow.*
edit-mode: replace
edit-mode: replace
26 changes: 17 additions & 9 deletions .github/workflows/legacy_version_analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@ concurrency:
cancel-in-progress: true

jobs:
# Detect whether anything that affects legacy analysis was touched in this
# PR. Path filtering at the job level (instead of `on.paths`) means a
# skipped `analyze_legacy_versions` reports as `success` to branch
# protection — see
# 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
changes:
gate:
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.packages }}
should_run: ${{ github.event_name == 'push' || (steps.filter.outputs.packages == 'true' && github.event.pull_request.draft != true) }}
steps:
- uses: dorny/paths-filter@v3
# paths-filter needs a checkout on push events (it diffs against the
# previous commit via git history). On pull_request events it uses
# the API and the checkout is unused, but is cheap.
- name: "Git Checkout"
uses: actions/checkout@v6

- name: "Detect Path Changes"
uses: dorny/paths-filter@v3
Comment thread
xsahil03x marked this conversation as resolved.
id: filter
with:
filters: |
Expand All @@ -42,8 +50,8 @@ jobs:
# (which we don't commit to supporting, but don't want to actively break)
# without updating the constraints.
analyze_legacy_versions:
needs: changes
if: needs.changes.outputs.packages == 'true' && github.event.pull_request.draft == false
needs: gate
if: needs.gate.outputs.should_run == 'true'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
Expand Down
52 changes: 35 additions & 17 deletions .github/workflows/stream_flutter_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ env:

on:
pull_request:
paths:
- 'packages/**'
- 'sample_app/**'
- '.github/workflows/stream_flutter_workflow.yml'
types:
- opened
- reopened
Expand All @@ -24,9 +20,37 @@ concurrency:
cancel-in-progress: true

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@v6

- name: "Detect Path Changes"
uses: dorny/paths-filter@v3
Comment thread
xsahil03x marked this conversation as resolved.
id: filter
with:
filters: |
relevant:
- 'packages/**'
- 'sample_app/**'
- '.github/workflows/stream_flutter_workflow.yml'

analyze:
needs: gate
timeout-minutes: 15
if: github.event.pull_request.draft == false
if: needs.gate.outputs.should_run == 'true'
runs-on: ubuntu-latest
steps:
- name: "Git Checkout"
Expand All @@ -53,8 +77,9 @@ jobs:
melos run lint:pub

format:
needs: gate
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
if: needs.gate.outputs.should_run == 'true'
timeout-minutes: 15
steps:
- name: "Git Checkout"
Expand All @@ -79,8 +104,9 @@ jobs:
./.github/workflows/scripts/validate-formatting.sh

test:
needs: gate
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
if: needs.gate.outputs.should_run == 'true'
timeout-minutes: 30
steps:
- name: "Git Checkout"
Expand Down Expand Up @@ -139,8 +165,9 @@ jobs:

build:
name: build (${{ matrix.platform }})
needs: gate
runs-on: ${{ matrix.os }}
if: github.event.pull_request.draft == false
if: needs.gate.outputs.should_run == 'true'
timeout-minutes: 30
strategy:
fail-fast: false
Expand Down Expand Up @@ -182,12 +209,3 @@ jobs:
- name: "Build ${{ matrix.platform }} App"
working-directory: ${{ matrix.working-directory }}
run: ${{ matrix.build-command }}

draft-build:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == true
timeout-minutes: 1

steps:
- name: Run a one-line script
run: echo Draft PR, you are good.
Loading