diff --git a/.github/workflows/legacy_version_analyze.yml b/.github/workflows/legacy_version_analyze.yml index dd1ee13258..2ccf92da3e 100644 --- a/.github/workflows/legacy_version_analyze.yml +++ b/.github/workflows/legacy_version_analyze.yml @@ -9,15 +9,9 @@ on: push: branches: - master - paths: - - 'packages/**' - - '.github/workflows/legacy_version_analyze.yml' pull_request: branches: - master - paths: - - 'packages/**' - - '.github/workflows/legacy_version_analyze.yml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -34,38 +28,26 @@ jobs: if: github.event.pull_request.draft == false runs-on: ubuntu-latest steps: - - name: "Git Checkout" + - name: ๐Ÿ“š Git Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - name: "Install Flutter" + - name: ๐ŸŽฏ Setup Flutter uses: subosito/flutter-action@v2 with: - flutter-version: ${{ env.flutter_version }} - channel: stable cache: true + channel: stable + flutter-version: ${{ env.flutter_version }} cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} - - name: "Install Tools" + - name: ๐Ÿ“ฆ Install Tools run: flutter pub global activate melos - - name: "Bootstrap Workspace" - run: melos bootstrap --verbose - - # Only analyze lib/; non-client code doesn't need to work on - # all supported legacy version. - - name: "Stream Chat Analyze" - run: cd packages/stream_chat/lib && dart analyze --fatal-infos . - - - name: "Stream Chat Flutter Core Analyze" - run: cd packages/stream_chat_flutter_core/lib && dart analyze --fatal-infos . - - - name: "Stream Chat Flutter Analyze" - run: cd packages/stream_chat_flutter/lib && dart analyze --fatal-infos . - - - name: "Stream Chat Persistence Analyze" - run: cd packages/stream_chat_persistence/lib && dart analyze --fatal-infos . + - name: โš™๏ธ Bootstrap Workspace + run: melos bootstrap - - name: "Stream Chat Localizations Analyze" - run: cd packages/stream_chat_localizations/lib && dart analyze --fatal-infos . \ No newline at end of file + - name: ๐Ÿ•ต๏ธ Analyze + # Only analyze lib/; non-client code doesn't need to work on + # all supported legacy version. + run: melos exec -c 1 --diff=origin/master...HEAD --include-dependents -- "dart analyze lib --fatal-infos" \ No newline at end of file diff --git a/.github/workflows/pr_title.yml b/.github/workflows/pr_title.yml index 8b200d5d8c..72455d7ed2 100644 --- a/.github/workflows/pr_title.yml +++ b/.github/workflows/pr_title.yml @@ -26,6 +26,7 @@ jobs: doc repo localization + sample_app requireScope: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stream_flutter_workflow.yml b/.github/workflows/stream_flutter_workflow.yml index 5c97dcbe3a..aacc1634de 100644 --- a/.github/workflows/stream_flutter_workflow.yml +++ b/.github/workflows/stream_flutter_workflow.yml @@ -1,14 +1,12 @@ name: stream_flutter_workflow env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + # Note: The versions below should be manually updated after a new major + # version comes out. flutter_version: "3.x" on: pull_request: - paths: - - 'packages/**' - - '.github/workflows/stream_flutter_workflow.yml' types: - opened - reopened @@ -23,127 +21,102 @@ concurrency: cancel-in-progress: true jobs: - analyze: - timeout-minutes: 15 - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - - name: "Git Checkout" - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: "Install Flutter" - uses: subosito/flutter-action@v2 - with: - flutter-version: ${{ env.flutter_version }} - channel: stable - cache: true - cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} - - 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: + lint: runs-on: ubuntu-latest - if: github.event.pull_request.draft == false timeout-minutes: 15 steps: - - name: "Git Checkout" + - name: ๐Ÿ“š Git Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - name: "Install Flutter" + + - name: ๐ŸŽฏ Setup Flutter uses: subosito/flutter-action@v2 with: - flutter-version: ${{ env.flutter_version }} - channel: stable cache: true + channel: stable + flutter-version: ${{ env.flutter_version }} cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} - - name: "Install Tools" - run: | - flutter pub global activate melos - - name: "Bootstrap Workspace" + + - 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 + + - name: โœจ Check Formatting + run: melos run format:changes + + - name: ๐Ÿ•ต๏ธ Analyze + run: melos run analyze:changes + + - if: github.base_ref == 'master' + name: ๐Ÿš€ Pub Check + run: melos run publish:dry-run:changes test: runs-on: ubuntu-latest - if: github.event.pull_request.draft == false timeout-minutes: 30 steps: - - name: "Git Checkout" + - name: ๐Ÿ“š Git Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - name: "Install Flutter" + + - name: ๐ŸŽฏ Setup Flutter uses: subosito/flutter-action@v2 with: - flutter-version: ${{ env.flutter_version }} - channel: stable cache: true + channel: stable + flutter-version: ${{ env.flutter_version }} cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} - # 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" + + - name: ๐Ÿ“ฆ Install Tools run: | flutter pub global activate melos flutter pub global activate remove_from_coverage - - name: "Bootstrap Workspace" + + - name: โš™๏ธ Bootstrap Workspace run: melos bootstrap - - name: "Flutter Test" - run: melos run test:all - - name: "Collect Coverage" + + - name: ๐Ÿงช Run Tests + run: melos run test:changes + + - name: ๐Ÿ“Š Collect Coverage run: melos run coverage:ignore-file --no-select - - name: "Upload Coverage" - uses: codecov/codecov-action@v5 - with: - token: ${{secrets.CODECOV_TOKEN}} - files: packages/*/coverage/lcov.info - - name: "Stream Chat Coverage Check" + + - 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" + + - 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" + + - 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" + + - 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" + + - 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 - 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. + - name: ๐Ÿ“ Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{secrets.CODECOV_TOKEN}} + files: packages/*/coverage/lcov.info diff --git a/melos.yaml b/melos.yaml index f7843bba77..ffb6bf6d45 100644 --- a/melos.yaml +++ b/melos.yaml @@ -119,38 +119,31 @@ scripts: run: melos run analyze && melos run format description: Run all static analysis checks - analyze:all: - run: melos run analyze && melos run metrics - description: Run all - analyze: - run: | - melos exec -c 5 --ignore="*example*" -- \ - dart analyze --fatal-infos . - description: | - Run `dart analyze` in all packages. - - Note: you can also rely on your IDEs Dart Analysis / Issues window. + run: melos exec -c 5 --ignore="*example*" -- "dart analyze --fatal-infos ." + description: Run `dart analyze` in all packages. + + analyze:changes: + run: melos exec -c 1 --diff=origin/master...HEAD --include-dependents -- "dart analyze --fatal-infos ." + description: Run `dart analyze` in all changed packages. format: run: dart format --set-exit-if-changed . - description: | - Run `dart format --set-exit-if-changed .` in all packages. + description: Run `dart format --set-exit-if-changed .` in all packages. - metrics: - run: | - melos exec -c 1 --ignore="*example*" -- \ - flutter pub run dart_code_metrics:metrics analyze lib - description: | - Run `dart_code_metrics` in all packages. - - Note: you can also rely on your IDEs Dart Analysis / Issues window. + format:changes: + run: melos exec -c 1 --diff=origin/master...HEAD --include-dependents -- "dart format --set-exit-if-changed ." + description: Run `dart format` in all changed packages. lint:pub: - run: | - melos exec -c 5 --no-private --ignore="*example*" -- \ - flutter pub publish --dry-run - description: | - Run `pub publish --dry-run` in all packages. - - Note: you can also rely on your IDEs Dart Analysis / Issues window. + run: melos exec -c 5 --no-private --ignore="*example*" -- "flutter pub publish --dry-run" + description: Run `pub publish --dry-run` in all packages. + + publish:dry-run:changes: + run: >- + melos exec -c 1 --diff=origin/master...HEAD --no-private --include-dependents -- + "[ -f pubspec.yaml ] && ! grep -q 'publish_to: none' pubspec.yaml && flutter pub publish --dry-run || echo 'Package not publishable, skipping'" + description: Run `flutter pub publish --dry-run` in all changed packages. generate:all: run: melos run generate:dart && melos run generate:flutter @@ -182,6 +175,10 @@ scripts: flutter: true dirExists: test + test:changes: + run: melos exec -c 1 --diff=origin/master...HEAD --include-dependents -- "[ -d test ] && flutter test --no-pub --coverage || echo 'No tests found, skipping'" + description: Run `flutter test` in all changed packages. + update:goldens: run: melos exec -c 1 --depends-on="alchemist" -- "flutter test --tags golden --update-goldens" description: Update golden files for all packages in this project. @@ -193,8 +190,7 @@ scripts: flutter: true coverage:ignore-file: - run: | - melos exec -c 5 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh" + run: melos exec -c 1 --fail-fast -- "\$MELOS_ROOT_PATH/.github/workflows/scripts/remove-from-coverage.sh" description: Removes all the ignored files from the coverage report. packageFilters: dirExists: coverage diff --git a/packages/stream_chat/example/pubspec.yaml b/packages/stream_chat/example/pubspec.yaml index 1075d9bc5d..ba794a6329 100644 --- a/packages/stream_chat/example/pubspec.yaml +++ b/packages/stream_chat/example/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat_example description: A new Flutter project. -publish_to: "none" +publish_to: none version: 1.0.0+1 # Note: The environment configuration and dependency versions are managed by Melos. diff --git a/packages/stream_chat_flutter/example/pubspec.yaml b/packages/stream_chat_flutter/example/pubspec.yaml index 8e85d2e084..de989df4a3 100644 --- a/packages/stream_chat_flutter/example/pubspec.yaml +++ b/packages/stream_chat_flutter/example/pubspec.yaml @@ -1,6 +1,6 @@ name: stream_chat_flutter_example description: A new Flutter project. -publish_to: 'none' +publish_to: none version: 1.0.0+1 # Note: The environment configuration and dependency versions are managed by Melos. diff --git a/packages/stream_chat_flutter_core/example/pubspec.yaml b/packages/stream_chat_flutter_core/example/pubspec.yaml index f4cd7082f7..c966b92d29 100644 --- a/packages/stream_chat_flutter_core/example/pubspec.yaml +++ b/packages/stream_chat_flutter_core/example/pubspec.yaml @@ -1,6 +1,6 @@ name: stream_chat_flutter_core_example description: Example app for testing stream_chat_flutter_core -publish_to: 'none' +publish_to: none version: 1.0.0+1 # Note: The environment configuration and dependency versions are managed by Melos. diff --git a/packages/stream_chat_localizations/example/pubspec.yaml b/packages/stream_chat_localizations/example/pubspec.yaml index 180b23c7a9..df7e9f54df 100644 --- a/packages/stream_chat_localizations/example/pubspec.yaml +++ b/packages/stream_chat_localizations/example/pubspec.yaml @@ -1,7 +1,7 @@ name: stream_chat_localizations_example description: A new Flutter project. -publish_to: 'none' +publish_to: none version: 1.0.0+1 # Note: The environment configuration and dependency versions are managed by Melos. diff --git a/packages/stream_chat_persistence/example/pubspec.yaml b/packages/stream_chat_persistence/example/pubspec.yaml index db578974ec..48105fb1bc 100644 --- a/packages/stream_chat_persistence/example/pubspec.yaml +++ b/packages/stream_chat_persistence/example/pubspec.yaml @@ -1,6 +1,6 @@ name: stream_chat_persistence_example description: A new Flutter project. -publish_to: 'none' +publish_to: none version: 1.0.0+1 # Note: The environment configuration and dependency versions are managed by Melos. diff --git a/sample_app/pubspec.yaml b/sample_app/pubspec.yaml index d4f973c78e..a4ccaa1f42 100644 --- a/sample_app/pubspec.yaml +++ b/sample_app/pubspec.yaml @@ -1,6 +1,6 @@ name: sample_app description: A new Flutter project. -publish_to: "none" +publish_to: none version: 2.2.0 # Note: The environment configuration and dependency versions are managed by Melos.