Skip to content

Commit

Permalink
wip: implement dynamic CircleCI config with path-filtering
Browse files Browse the repository at this point in the history
 - 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
  • Loading branch information
abdelhamid-f-nasser committed Mar 31, 2024
1 parent f1ef1c5 commit 537057a
Show file tree
Hide file tree
Showing 15 changed files with 755 additions and 63 deletions.
614 changes: 614 additions & 0 deletions .circleci/config.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
**/*.iml
**/pubspec.lock
**/pubspec_overrides.yaml
**/.fvm
Empty file removed example/pubspec.lock
Empty file.
35 changes: 29 additions & 6 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 31 additions & 13 deletions packages/instabug_dart_http_adapter/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -36,4 +54,4 @@ workflows:
- hold
filters:
branches:
only: master
only: master
5 changes: 4 additions & 1 deletion packages/instabug_dart_http_adapter/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Generated files
*.mocks.dart

# Miscellaneous
*.class
*.log
Expand Down Expand Up @@ -74,4 +77,4 @@ coverage/
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
11 changes: 7 additions & 4 deletions packages/instabug_dart_http_adapter/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -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<void> 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 {
Expand Down Expand Up @@ -58,7 +61,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion packages/instabug_dart_http_adapter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'package:mockito/mockito.dart';

import 'instabug_http_client_test.mocks.dart';

@GenerateMocks([
@GenerateMocks(<Type>[
InstabugHttpLogger,
InstabugHttpClient,
])
Expand Down
43 changes: 30 additions & 13 deletions packages/instabug_dio_interceptor/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions packages/instabug_dio_interceptor/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 537057a

Please sign in to comment.