From bfd04fbb4e2f09c970f9005c6cb83fa6879dba7c Mon Sep 17 00:00:00 2001 From: AbdElHamid Nasser Date: Tue, 13 Feb 2024 11:47:06 +0200 Subject: [PATCH] wip: implement dynamic CircleCI config with path-filtering - Updated root .circleci/config.yml to include path-filtering orb - Added continuation steps for dynamically processing package-specific configs - Marked package-specific config.yml files as version 2.1 for compatibility - Adjusted workflows to trigger on changes to specific package paths - Testing and validation of dynamic CI configuration in progress --- .circleci/config.yml | 625 ++++++++++++++++++ .gitignore | 1 + example/pubspec.lock | 0 melos.yaml | 35 +- .../.circleci/config.yml | 44 +- .../instabug_dart_http_adapter/.gitignore | 5 +- .../example/lib/main.dart | 11 +- .../instabug_dart_http_adapter/pubspec.yaml | 2 +- .../test/instabug_http_client_test.dart | 2 +- .../.circleci/config.yml | 43 +- .../instabug_dio_interceptor/pubspec.yaml | 3 +- .../instabug_flutter/.circleci/config.yml | 48 +- packages/instabug_flutter/e2e/E2E.csproj | 2 +- packages/instabug_flutter/e2e/E2E.sln | 2 +- pubspec.yaml | 6 +- 15 files changed, 766 insertions(+), 63 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 example/pubspec.lock diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..17a225a75 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,625 @@ +version: 2.1 + +orbs: + android: circleci/android@2.0 + flutter: circleci/flutter@2.0.2 + node: circleci/node@5.1.0 + + +commands: + setup_flutter: + steps: + - flutter/install_sdk_and_pub: + app-dir: packages/instabug_flutter + version: 3.10.5 + - run: + name: Generate Pigeons + working_directory: packages/instabug_flutter + command: sh ./scripts/pigeon.sh + setup_ios: + steps: + # Flutter doesn't support Apple Silicon yet, so we need to install Rosetta use Flutter on M1 machines. + - run: + name: Install Rosetta + command: softwareupdate --install-rosetta --agree-to-license + - setup_flutter + - run: + name: Install CocoaPods + command: sudo gem install cocoapods + - run: + name: Install Pods + working_directory: packages/instabug_flutter/example/ios + command: pod install --repo-update + setup_captain: + parameters: + platform: + type: enum + enum: + - ios + - android + steps: + - run: + name: Install Appium + command: npm install -g appium + - when: + condition: + equal: + - <> + - ios + steps: + - run: + name: Install XCUITest Driver + command: appium driver install xcuitest@4.35.0 + - when: + condition: + equal: + - <> + - android + steps: + - run: + name: Install UIAutomator2 Driver + command: appium driver install uiautomator2@2.29.5 + - run: + name: Launch Appium + # Enable --relaxed-security for `mobile: shell` command that Captain uses internally. + command: appium --relaxed-security + background: true + - run: + name: Install .NET 6 + command: curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 6.0.1xx + - run: + name: Add .NET to PATH + command: | + echo 'export DOTNET_ROOT=$HOME/.dotnet' >> $BASH_ENV + echo 'export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools' >> $BASH_ENV + - run: + name: Clone Captain + command: git clone git@github.com:Instabug/Captain.git ../Instabug.Captain + - run: + name: Configure Captain Platform + command: echo 'export CAPTAIN_PLATFORM=<>' >> $BASH_ENV + # This runs `flutter pub get` and `dart pub get` if we pass parameter `generate_pigeons` to the job it also runs the following: + # - `sh ./scripts/pigeon.sh` + # - `dart run build_runner build --delete-conflicting-outputs` + install_flutter_and_dart_packages: + parameters: + generate_pigeons: + type: boolean + steps: + - run: + name: Install Flutter Packages + command: flutter pub get + - run: + name: Install Dart Packages + command: dart pub get + description: Install Dart Packages (for dart explicit packages) + - when: + condition: + equal: + - <> + - true + steps: + - run: + name: Generate Pigeons + working_directory: packages/instabug_flutter + command: ./scripts/pigeon.sh + - run: + name: Build Pigeons + working_directory: packages/instabug_flutter + command: dart run build_runner build --delete-conflicting-outputs + +parameters: + is_changes_detected_for_instabug_dart_http_adapter: + type: boolean + default: false + is_changes_detected_for_instabug_dio_interceptor: + type: boolean + default: false + is_changes_detected_for_instabug_flutter: + type: boolean + default: false + +jobs: + extract_pr_info: + docker: + - image: cimg/base:stable + steps: + - checkout + - run: + name: extract base branch + command: | + BASE_BRANCH=$(curl -s -H "Authorization: token ${DANGER_GITHUB_API_TOKEN}" $(echo ${CIRCLE_PULL_REQUEST} | sed "s/\/pull\//\/pulls\//" | sed "s/github.com/api.github.com\/repos/") | jq ".base.ref" | tr -d "\042" ) + PR_NUMBER=$(echo ${CIRCLE_PULL_REQUEST} | cut -d "/" -f 7) + echo "export BASE_BRANCH=$BASE_BRANCH" >> $BASH_ENV + echo "export PR_NUMBER=$PR_NUMBER" >> $BASH_ENV + - run: + name: Verify Base Branch and PR number + command: | + # Verify that the BASE_BRANCH environment variable is set. + echo "Base Branch: $BASE_BRANCH" + echo "PR NUMBER: $PR_NUMBER" + printenv BASE_BRANCH + printenv PR_NUMBER + - run: + name: Persist environment variables + command: cp $BASH_ENV bash.env + - persist_to_workspace: + root: . + paths: + - bash.env + check_for_changes: + parameters: + path_to_check: + type: string + description: "The sub-path within the repo to check for changes." + result_env_var: + type: string + description: "The environment variable name to store the result of the check." + docker: + - image: cimg/base:stable + steps: + - checkout + - attach_workspace: + at: . + - run: | + cat bash.env >> $BASH_ENV + - run: + name: Verify Base Branch and PR number + command: | + # this should print the branch and pr number + echo "Base Branch: $BASE_BRANCH" + echo "PR NUMBER: $PR_NUMBER" + printenv BASE_BRANCH + printenv PR_NUMBER + - run: + name: Check for changes in << parameters.path_to_check >> + command: | + # Check for changes + if git diff --name-only origin/$BASE_BRANCH...HEAD | grep "<< parameters.path_to_check >>"; then + echo 'export << parameters.result_env_var >>=true' >> $BASH_ENV + echo "Changes detected in << parameters.path_to_check >>" + else + echo 'export << parameters.result_env_var >>=false' >> $BASH_ENV + echo "No changes detected in << parameters.path_to_check >>" + fi + + # Instabug Dart Http Adapter + test_instabug_dart_http_adapter: + parameters: + is_changes_detected_for_instabug_dart_http_adapter: + type: boolean + default: false + docker: + - image: cirrusci/flutter + steps: + - checkout + - run: + name: Condition check for running tests + command: | + if [ "$IS_CHANGES_DETECTED_FOR_INSTABUG_DART_HTTP_ADAPTER" = "false" ] && [ << parameters.is_changes_detected_for_instabug_dart_http_adapter >> = false ]; then + echo "Skipping tests because no changes were detected." + circleci-agent step halt + fi + - run: + name: Flutter doctor + command: flutter doctor + - run: + name: Install Flutter Packages + working_directory: packages/instabug_dart_http_adapter + command: flutter pub get + - run: + name: Generate code with build runner + working_directory: packages/instabug_dart_http_adapter + command: dart run build_runner build --delete-conflicting-outputs + - run: + name: Run tests + working_directory: packages/instabug_dart_http_adapter + command: flutter test + - run: + name: Dart Analysis + working_directory: packages/instabug_dart_http_adapter + command: dart analyze --fatal-warnings lib + - run: + name: Publish dry run + working_directory: packages/instabug_dart_http_adapter + command: flutter pub publish --dry-run + release_instabug_dart_http_adapter: + docker: + - image: cirrusci/flutter + working_directory: packages/instabug_dart_http_adapter + steps: + - checkout + - run: chmod +x release.sh + - run: ./release.sh + # ----------------------------------------------------------------------- + + + # Instabug Dio Interceptor + + test_instabug_dio_interceptor: + parameters: + is_changes_detected_for_instabug_dio_interceptor: + type: boolean + default: false + docker: + - image: cirrusci/flutter + steps: + - checkout + - run: + name: Condition check for running tests + command: | + if [ "IS_CHANGES_DETECTED_FOR_INSTABUG_DIO_INTERCEPTOR" = "false" ] && [ << parameters.is_changes_detected_for_instabug_dio_interceptor >> = false ]; then + echo "Skipping tests because no changes were detected." + circleci-agent step halt + fi + - run: + name: Flutter doctor + command: flutter doctor + - run: + name: Install Flutter Packages + working_directory: packages/instabug_dio_interceptor + command: flutter pub get + - run: + name: Generate code with build runner + working_directory: packages/instabug_dart_http_adapter + command: dart run build_runner build --delete-conflicting-outputs + - run: + name: Run tests + working_directory: packages/instabug_dio_interceptor + command: flutter test + - run: + name: Dart Analysis + working_directory: packages/instabug_dio_interceptor + command: dart analyze . + - run: + name: Publish dry run + working_directory: packages/instabug_dio_interceptor + command: flutter pub publish --dry-run + + release_instabug_dio_interceptor: + docker: + - image: cirrusci/flutter + working_directory: packages/instabug_dio_interceptor + steps: + - checkout + - run: ./release.sh + + # ----------------------------------------------------------------------- + + # Instabug Flutter SDK + danger: + parameters: + is_changes_detected_for_instabug_dio_interceptor: + type: boolean + default: false + working_directory: packages/instabug_flutter + executor: + name: node/default + steps: + - checkout + - run: + name: Condition check for running tests + command: | + if [ "IS_CHANGES_DETECTED_FOR_INSTABUG_DIO_INTERCEPTOR" = "false" ] && [ << parameters.is_changes_detected_for_instabug_dio_interceptor >> = false ]; then + echo "Skipping tests because no changes were detected." + circleci-agent step halt + fi + - run: + name: Check directory + command: | + pwd + ls + - node/install-packages: + app-dir: packages/instabug_flutter + pkg-manager: yarn + override-ci-command: yarn install --frozen-lockfile --network-concurrency 1 + - attach_workspace: + at: coverage + - run: + name: Check pwd n ls + command: | + pwd + ls + - run: + name: ck pwd n ls in packages/instabug_flutter + working_directory: packages/instabug_flutter + command: | + pwd + ls + - run: + name: Run Danger + working_directory: packages/instabug_flutter + command: cd packages/instabug_flutter && yarn danger ci + + test_flutter: + working_directory: packages/instabug_flutter + parameters: + version: + type: string + docker: + - image: cirrusci/flutter:<> + steps: + - checkout + - install_flutter_and_dart_packages: + generate_pigeons: true + - run: + working_directory: packages/instabug_flutter + command: flutter test --coverage + - run: + working_directory: packages/instabug_flutter/coverage + command: lcov --remove lcov.info '*.g.dart' '*.mocks.dart' -o lcov.info + - persist_to_workspace: + root: packages/instabug_flutter/coverage + paths: + - lcov.info + + test_android: + working_directory: packages/instabug_flutter + executor: + name: android/android-machine + resource-class: xlarge + tag: 2022.04.1 + steps: + - checkout + - setup_flutter + - android/start-emulator-and-run-tests: + system-image: system-images;android-30;google_apis;x86 + additional-avd-args: -d "Nexus 5" + post-emulator-launch-assemble-command: cd packages/instabug_flutter/example && flutter build apk + run-tests-working-directory: packages/instabug_flutter/example/android + test-command: ./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/example.dart + - android/run-tests: + working-directory: packages/instabug_flutter/example/android + test-command: ./gradlew test + + e2e_android_captain: + working_directory: packages/instabug_flutter + executor: + name: android/android-machine + resource-class: xlarge + tag: 2022.04.1 + steps: + - checkout + - setup_captain: + platform: android + - setup_flutter + - android/start-emulator-and-run-tests: + system-image: system-images;android-30;google_apis;x86 + additional-avd-args: -d "pixel_4" + post-emulator-launch-assemble-command: cd packages/instabug_flutter/example || true && flutter build apk --debug + test-command: cd packages/instabug_flutter/example && e2e || true && dotnet test + + test_ios: + working_directory: packages/instabug_flutter + macos: + xcode: 13.4.1 + resource_class: macos.m1.medium.gen1 + steps: + - checkout + - setup_ios + - run: + name: Build and run tests + working_directory: packages/instabug_flutter/example/ios + command: | + xcodebuild -allowProvisioningUpdates \ + -workspace Runner.xcworkspace \ + -scheme Runner \ + -sdk iphonesimulator \ + -destination 'name=iPhone 12 Pro Max' \ + test | xcpretty + + e2e_ios_captain: + macos: + xcode: 13.4.1 + resource_class: macos.m1.medium.gen1 + steps: + - checkout + - setup_captain: + platform: ios + - setup_ios + - run: + name: Build Example App + working_directory: packages/instabug_flutter/example + command: flutter build ios --simulator + - run: + name: Run E2E Tests + no_output_timeout: 30m + working_directory: packages/instabug_flutter/e2e + command: dotnet test + + format_flutter: + working_directory: packages/instabug_flutter + docker: + - image: cirrusci/flutter + steps: + - checkout + - install_flutter_and_dart_packages: + generate_pigeons: false + - run: + name: Check Format + command: dart format . --set-exit-if-changed + + lint_flutter: + working_directory: packages/instabug_flutter + docker: + - image: cirrusci/flutter + steps: + - checkout + - install_flutter_and_dart_packages: + generate_pigeons: true + - run: + name: Perform Static Analysis + command: | + ls + pwd + flutter analyze + + verify_pub: + working_directory: packages/instabug_flutter + docker: + - image: cirrusci/flutter + steps: + - checkout + - install_flutter_and_dart_packages: + generate_pigeons: true + - run: + name: Check Package Score + command: dart run pana --no-warning --exit-code-threshold 0 + - run: flutter pub publish --dry-run + + release_instabug_flutter: + macos: + xcode: 13.4.1 + resource_class: macos.m1.medium.gen1 + working_directory: "~" + steps: + - checkout: + path: ~/project + # Flutter doesn't support Apple Silicon yet, so we need to install Rosetta use Flutter on M1 machines. + - run: + name: Install Rosetta + command: softwareupdate --install-rosetta --agree-to-license + - flutter/install_sdk_and_pub: + version: 3.3.6 + app-dir: project/packages/instabug_flutter + - run: + name: Install pub packages + working_directory: ~/project/packages/instabug_flutter + command: dart pub get + - run: + name: Generate Pigeons + working_directory: ~/project/packages/instabug_flutter + command: sh ./scripts/pigeon.sh + - run: + name: Clone Escape + command: git clone git@github.com:Instabug/Escape.git + - run: + name: Build Escape + working_directory: Escape + command: | + swift build -c release + cp -f .build/release/Escape /usr/local/bin/escape + - run: + name: Publish Package + working_directory: ~/project/packages/instabug_flutter + command: Escape flutter publish + + + +workflows: + version: 2 + build-instabug_dart_http_adapter: + jobs: + - extract_pr_info + - check_for_changes: + path_to_check: "packages/instabug_dart_http_adapter" + result_env_var: "IS_CHANGES_DETECTED_FOR_INSTABUG_DART_HTTP_ADAPTER" + requires: + - extract_pr_info + - test_instabug_dart_http_adapter: + requires: + - check_for_changes + is_changes_detected_for_instabug_dart_http_adapter: << pipeline.parameters.is_changes_detected_for_instabug_dart_http_adapter >> + - hold_instabug_dart_http_adapter: + type: approval + requires: + - test_instabug_dart_http_adapter + filters: + branches: + only: master + + - release_instabug_dart_http_adapter: + requires: + - hold_instabug_dart_http_adapter + filters: + branches: + only: master + + build-instabug-dio-interceptor: + jobs: + - extract_pr_info + - check_for_changes: + path_to_check: "packages/instabug_dio_interceptor" + result_env_var: "IS_CHANGES_DETECTED_FOR_INSTABUG_DIO_INTERCEPTOR" + requires: + - extract_pr_info + - test_instabug_dio_interceptor: + requires: + - check_for_changes + is_changes_detected_for_instabug_dio_interceptor: << pipeline.parameters.is_changes_detected_for_instabug_dio_interceptor >> + - hold_instabug_dio_interceptor: + type: approval + requires: + - test_instabug_dio_interceptor + filters: + branches: + only: master + - release_instabug_dio_interceptor: + requires: + - hold_instabug_dio_interceptor + filters: + branches: + only: master + + build-test-and-approval-deploy-instabug-flutter: + jobs: + - extract_pr_info + - check_for_changes: + path_to_check: "packages/instabug_flutter" + result_env_var: "IS_CHANGES_DETECTED_FOR_INSTABUG_FLUTTER" + requires: + - extract_pr_info + - danger: + requires: + - test_flutter-stable + - check_for_changes + - test_flutter: + name: test_flutter-stable + version: stable + - test_flutter: + name: test_flutter-2.10.5 + version: 2.10.5 + - test_android: + requires: + - check_for_changes + - e2e_android_captain: + requires: + - check_for_changes + - test_ios: + requires: + - check_for_changes + - e2e_ios_captain: + requires: + - check_for_changes + - format_flutter: + requires: + - check_for_changes + - lint_flutter: + requires: + - format_flutter + - check_for_changes + - verify_pub: + requires: + - lint_flutter + - check_for_changes + - hold_release_instabug_flutter: + type: approval + requires: + - danger + - test_flutter-stable + - test_flutter-2.10.5 + - test_android + - e2e_android_captain + - test_ios + - e2e_ios_captain + - verify_pub + filters: + branches: + only: master + - release_instabug_flutter: + requires: + - hold_release_instabug_flutter + filters: + branches: + only: master + diff --git a/.gitignore b/.gitignore index 1866561f6..6085f5bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ **/*.iml **/pubspec.lock **/pubspec_overrides.yaml +**/.fvm diff --git a/example/pubspec.lock b/example/pubspec.lock deleted file mode 100644 index e69de29bb..000000000 diff --git a/melos.yaml b/melos.yaml index 2dfbff546..a5d4ebdfb 100644 --- a/melos.yaml +++ b/melos.yaml @@ -5,13 +5,36 @@ packages: scripts: analyze: - exec: dart analyze . + run: melos exec "dart analyze ." + + format: + run: melos exec "dart format . --set-exit-if-changed" + pigeon: - exec: sh scripts/pigeon.sh + run: melos exec "sh scripts/pigeon.sh" packageFilters: fileExists: 'scripts/pigeon.sh' -command: - bootstrap: - hooks: - post: melos pigeon + generate: + run: melos exec "dart run build_runner build -d" + description: Build all generated files for Dart & Flutter packages in this project.t + packageFilters: + dependsOn: build_runner + + test: + run: melos exec "flutter test" + description: Tests all packages. + packageFilters: + dependsOn: flutter_test + + dryPublish: + run: melos exec "flutter pub publish --dry-run" + description: Tests publishing (dry run). + packageFilters: + flutter: true + + score: + run: melos exec "dart run pana --no-warning --exit-code-threshold 0" + packageFilters: + flutter: true + dependsOn: pana diff --git a/packages/instabug_dart_http_adapter/.circleci/config.yml b/packages/instabug_dart_http_adapter/.circleci/config.yml index 9c72b1160..0a9f94ecd 100644 --- a/packages/instabug_dart_http_adapter/.circleci/config.yml +++ b/packages/instabug_dart_http_adapter/.circleci/config.yml @@ -1,33 +1,51 @@ -version: 2 +version: 2.1 jobs: - test: + instabug_dart_http_adapter_test: docker: - image: cirrusci/flutter steps: - checkout - - run: flutter doctor - - run: flutter pub get - - run: flutter test - - run: dart analyze --fatal-warnings lib - - run: flutter pub publish --dry-run + - run: + name: Flutter doctor + command: flutter doctor + - run: + name: Install Flutter Packages + working_directory: packages/instabug_dart_http_adapter + command: flutter pub get + - run: + name: Generate code with build runner + working_directory: packages/instabug_dart_http_adapter + command: dart run build_runner build --delete-conflicting-outputs + - run: + name: Run tests + working_directory: packages/instabug_dart_http_adapter + command: flutter test + - run: + name: Dart Analysis + working_directory: packages/instabug_dart_http_adapter + command: dart analyze --fatal-warnings lib + - run: + name: Publish dry run + working_directory: packages/instabug_dart_http_adapter + command: flutter pub publish --dry-run release: docker: - image: cirrusci/flutter + working_directory: packages/instabug_dart_http_adapter steps: - checkout - run: chmod +x release.sh - - run: ./release.sh + - run: ./release.sh workflows: - version: 2 - build-test: + build-instabug-dart-http-adapter-test: jobs: - - test + - instabug_dart_http_adapter_test - hold: type: approval requires: - - test + - instabug_dart_http_adapter_test filters: branches: only: master @@ -36,4 +54,4 @@ workflows: - hold filters: branches: - only: master \ No newline at end of file + only: master diff --git a/packages/instabug_dart_http_adapter/.gitignore b/packages/instabug_dart_http_adapter/.gitignore index 37eb055d7..37ccbd254 100644 --- a/packages/instabug_dart_http_adapter/.gitignore +++ b/packages/instabug_dart_http_adapter/.gitignore @@ -1,3 +1,6 @@ +# Generated files +*.mocks.dart + # Miscellaneous *.class *.log @@ -74,4 +77,4 @@ coverage/ !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages \ No newline at end of file +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages diff --git a/packages/instabug_dart_http_adapter/example/lib/main.dart b/packages/instabug_dart_http_adapter/example/lib/main.dart index 5c50cd397..61172936c 100644 --- a/packages/instabug_dart_http_adapter/example/lib/main.dart +++ b/packages/instabug_dart_http_adapter/example/lib/main.dart @@ -1,14 +1,17 @@ +import 'dart:developer'; + import 'package:flutter/material.dart'; import 'package:instabug_http_client/instabug_http_client.dart'; import 'package:instabug_flutter/instabug_flutter.dart'; Future main() async { runApp(const MyApp()); - Instabug.start( - 'ed6f659591566da19b67857e1b9d40ab', [InvocationEvent.floatingButton]); + Instabug.init( + token: 'ed6f659591566da19b67857e1b9d40ab', + invocationEvents: [InvocationEvent.floatingButton]); final client = InstabugHttpClient(); final response = await client.get(Uri.parse('https://google.com')); - print(response.body); + log(response.body); } class MyApp extends StatelessWidget { @@ -58,7 +61,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), diff --git a/packages/instabug_dart_http_adapter/pubspec.yaml b/packages/instabug_dart_http_adapter/pubspec.yaml index 938d0bba1..43e758025 100644 --- a/packages/instabug_dart_http_adapter/pubspec.yaml +++ b/packages/instabug_dart_http_adapter/pubspec.yaml @@ -6,7 +6,7 @@ version: 2.3.0 homepage: https://github.com/Instabug/Instabug-Flutter#readme environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.12.0 <4.0.0' dependencies: flutter: diff --git a/packages/instabug_dart_http_adapter/test/instabug_http_client_test.dart b/packages/instabug_dart_http_adapter/test/instabug_http_client_test.dart index 07ac7400a..c1e6abf49 100644 --- a/packages/instabug_dart_http_adapter/test/instabug_http_client_test.dart +++ b/packages/instabug_dart_http_adapter/test/instabug_http_client_test.dart @@ -14,7 +14,7 @@ import 'package:mockito/mockito.dart'; import 'instabug_http_client_test.mocks.dart'; -@GenerateMocks([ +@GenerateMocks([ InstabugHttpLogger, InstabugHttpClient, ]) diff --git a/packages/instabug_dio_interceptor/.circleci/config.yml b/packages/instabug_dio_interceptor/.circleci/config.yml index f4f835944..a2efc7942 100644 --- a/packages/instabug_dio_interceptor/.circleci/config.yml +++ b/packages/instabug_dio_interceptor/.circleci/config.yml @@ -1,33 +1,50 @@ -version: 2 +version: 2.1 jobs: - test: + instabug_dio_interceptor_test: docker: - image: cirrusci/flutter steps: - checkout - - run: flutter doctor - - run: flutter pub get - - run: flutter pub run build_runner build --delete-conflicting-outputs - - run: flutter test - - run: flutter analyze . - - run: flutter pub publish --dry-run - + - run: + name: Flutter doctor + command: flutter doctor + - run: + name: Install Flutter Packages + working_directory: packages/instabug_dio_interceptor + command: flutter pub get + - run: + name: Generate code with build runner + working_directory: packages/instabug_dart_http_adapter + command: dart run build_runner build --delete-conflicting-outputs + - run: + name: Run tests + working_directory: packages/instabug_dio_interceptor + command: flutter test + - run: + name: Dart Analysis + working_directory: packages/instabug_dio_interceptor + command: dart analyze . + - run: + name: Publish dry run + working_directory: packages/instabug_dio_interceptor + command: flutter pub publish --dry-run + release: docker: - image: cirrusci/flutter + working_directory: packages/instabug_dio_interceptor steps: - checkout - run: ./release.sh workflows: - version: 2 - build-test: + build-instabug-dio-interceptor-test: jobs: - - test + - instabug_dio_interceptor_test - hold: type: approval requires: - - test + - instabug_dio_interceptor_test filters: branches: only: master diff --git a/packages/instabug_dio_interceptor/pubspec.yaml b/packages/instabug_dio_interceptor/pubspec.yaml index 64861f532..7f3672d0c 100644 --- a/packages/instabug_dio_interceptor/pubspec.yaml +++ b/packages/instabug_dio_interceptor/pubspec.yaml @@ -13,12 +13,11 @@ dependencies: flutter: sdk: flutter instabug_flutter: '>=11.0.0 <13.0.0' - dev_dependencies: build_runner: ^2.0.3 flutter_test: sdk: flutter - mockito: 5.4.4 + mockito: ^5.0.10 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/packages/instabug_flutter/.circleci/config.yml b/packages/instabug_flutter/.circleci/config.yml index 44d0c8c33..c4d39a933 100644 --- a/packages/instabug_flutter/.circleci/config.yml +++ b/packages/instabug_flutter/.circleci/config.yml @@ -9,9 +9,11 @@ commands: setup_flutter: steps: - flutter/install_sdk_and_pub: + app-dir: packages/instabug_flutter version: 3.10.5 - run: name: Generate Pigeons + working_directory: packages/instabug_flutter command: sh ./scripts/pigeon.sh setup_ios: steps: @@ -25,7 +27,7 @@ commands: command: sudo gem install cocoapods - run: name: Install Pods - working_directory: example/ios + working_directory: packages/instabug_flutter/example/ios command: pod install --repo-update setup_captain: parameters: @@ -98,14 +100,17 @@ commands: steps: - run: name: Generate Pigeons - command: sh ./scripts/pigeon.sh + working_directory: packages/instabug_flutter + command: ./scripts/pigeon.sh - run: name: Build Pigeons + working_directory: packages/instabug_flutter command: dart run build_runner build --delete-conflicting-outputs jobs: danger: + working_directory: packages/instabug_flutter executor: name: node/default steps: @@ -117,9 +122,11 @@ jobs: at: coverage - run: name: Run Danger + working_directory: packages/instabug_flutter command: yarn danger ci test_flutter: + working_directory: packages/instabug_flutter parameters: version: type: string @@ -129,16 +136,19 @@ jobs: - checkout - install_flutter_and_dart_packages: generate_pigeons: true - - run: flutter test --coverage - run: - working_directory: coverage + working_directory: packages/instabug_flutter + command: flutter test --coverage + - run: + working_directory: packages/instabug_flutter/coverage command: lcov --remove lcov.info '*.g.dart' '*.mocks.dart' -o lcov.info - persist_to_workspace: - root: coverage + root: packages/instabug_flutter/coverage paths: - lcov.info test_android: + working_directory: packages/instabug_flutter executor: name: android/android-machine resource-class: xlarge @@ -149,14 +159,15 @@ jobs: - android/start-emulator-and-run-tests: system-image: system-images;android-30;google_apis;x86 additional-avd-args: -d "Nexus 5" - post-emulator-launch-assemble-command: cd example && flutter build apk - run-tests-working-directory: example/android + post-emulator-launch-assemble-command: cd packages/instabug_flutter/example && flutter build apk + run-tests-working-directory: packages/instabug_flutter/example/android test-command: ./gradlew app:connectedAndroidTest -Ptarget=`pwd`/../test_driver/example.dart - android/run-tests: - working-directory: example/android + working-directory: packages/instabug_flutter/example/android test-command: ./gradlew test e2e_android_captain: + working_directory: packages/instabug_flutter executor: name: android/android-machine resource-class: xlarge @@ -169,10 +180,11 @@ jobs: - android/start-emulator-and-run-tests: system-image: system-images;android-30;google_apis;x86 additional-avd-args: -d "pixel_4" - post-emulator-launch-assemble-command: cd example || true && flutter build apk --debug - test-command: cd e2e || true && dotnet test + post-emulator-launch-assemble-command: cd packages/instabug_flutter/example || true && flutter build apk --debug + test-command: cd packages/instabug_flutter/example && e2e || true && dotnet test test_ios: + working_directory: packages/instabug_flutter macos: xcode: 13.4.1 resource_class: macos.m1.medium.gen1 @@ -181,7 +193,7 @@ jobs: - setup_ios - run: name: Build and run tests - working_directory: example/ios + working_directory: packages/instabug_flutter/example/ios command: | xcodebuild -allowProvisioningUpdates \ -workspace Runner.xcworkspace \ @@ -201,15 +213,16 @@ jobs: - setup_ios - run: name: Build Example App - working_directory: example + working_directory: packages/instabug_flutter/example command: flutter build ios --simulator - run: name: Run E2E Tests no_output_timeout: 30m - working_directory: e2e + working_directory: packages/instabug_flutter/e2e command: dotnet test format_flutter: + working_directory: packages/instabug_flutter docker: - image: cirrusci/flutter steps: @@ -221,6 +234,7 @@ jobs: command: dart format . --set-exit-if-changed lint_flutter: + working_directory: packages/instabug_flutter docker: - image: cirrusci/flutter steps: @@ -232,6 +246,7 @@ jobs: command: flutter analyze verify_pub: + working_directory: packages/instabug_flutter docker: - image: cirrusci/flutter steps: @@ -260,11 +275,11 @@ jobs: app-dir: project - run: name: Install pub packages - working_directory: ~/project + working_directory: ~/project/packages/instabug_flutter command: dart pub get - run: name: Generate Pigeons - working_directory: project + working_directory: ~/project/packages/instabug_flutter command: sh ./scripts/pigeon.sh - run: name: Clone Escape @@ -277,11 +292,10 @@ jobs: cp -f .build/release/Escape /usr/local/bin/escape - run: name: Publish Package - working_directory: project + working_directory: ~/project/packages/instabug_flutter command: Escape flutter publish workflows: - version: 2 build-test-and-approval-deploy: jobs: - danger: diff --git a/packages/instabug_flutter/e2e/E2E.csproj b/packages/instabug_flutter/e2e/E2E.csproj index f54272903..79187a89a 100644 --- a/packages/instabug_flutter/e2e/E2E.csproj +++ b/packages/instabug_flutter/e2e/E2E.csproj @@ -18,6 +18,6 @@ - + diff --git a/packages/instabug_flutter/e2e/E2E.sln b/packages/instabug_flutter/e2e/E2E.sln index c2e05e1e2..84eb6ba7f 100644 --- a/packages/instabug_flutter/e2e/E2E.sln +++ b/packages/instabug_flutter/e2e/E2E.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 25.0.1703.5 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "E2E", "E2E.csproj", "{99118060-0344-4CAD-AE3A-CC74A5E0F3C7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Instabug.Captain", "..\..\Instabug.Captain\Instabug.Captain\Instabug.Captain.csproj", "{597F3BAD-11D3-43B7-A95C-6C41CD2096A8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Instabug.Captain", "..\..\..\..\Instabug.Captain\Instabug.Captain\Instabug.Captain.csproj", "{597F3BAD-11D3-43B7-A95C-6C41CD2096A8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/pubspec.yaml b/pubspec.yaml index 307af1b8a..d3dc40284 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: instabug_flutter_mono +publish_to: none environment: - sdk: '>=3.0.0 <4.0.0' - + sdk: '>=2.12.0 <4.0.0' dev_dependencies: - melos: ^4.1.0 + melos: ^3.0.0