diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b556f5ab5..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,140 +0,0 @@ -version: 2.1 -executors: - flutter_executor: - docker: - - image: cirrusci/flutter:2.10.5 - environment: - _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseContainerSupport" - -commands: - prepare_enviroment: - description: Fetch the repo, do flutter doctor and install deps - steps: - - add_ssh_keys: - fingerprints: - - 85:5e:13:f8:60:b2:55:a1:df:d1:8e:77:17:4c:3b:2d - - checkout - - run: - name: Run Flutter doctor - command: flutter doctor - - restore_cache: - keys: - - android-sdk-licenses - - gradle - - pub-cache - - bin - - run: - name: pub get - command: flutter pub get - - analyze_code: - description: Do flutter analyze - steps: - - run: - name: Code analysis - command: flutter analyze --no-pub - - code_coverage: - description: Do prebuild stuff - steps: - - run: - name: Run the application tests - command: flutter test --coverage - - run: - name: Upload coverage - command: | - sudo gem install coveralls-lcov - coveralls-lcov -t $COVERALLS_REPO_TOKEN coverage/lcov.info - - build_app: - description: Build the app - parameters: - mode: - type: string - default: "debug" - file_type: - type: string - default: "apk" - target: - type: string - default: "" - buildNumber: - type: string - default: "" - working_directory: - type: string - default: ~/project - steps: - - run: - name: Check that we can build for all Android platforms - command: | - flutter build -v << parameters.file_type >> << parameters.buildNumber >> --<< parameters.mode >> << parameters.target >> - working_directory: <> - - save_env_cache: - description: Save the caches - steps: - - save_cache: - key: android-sdk-licenses - paths: - - /opt/android-sdk-linux/licenses - - - save_cache: - key: pub-cache - paths: - - /home/cirrus/.pub-cache - - - save_cache: - key: gradle - paths: - - ~/.gradle - - - save_cache: - key: bin - paths: - - /usr/local/bin - -jobs: - build_pr: - executor: flutter_executor - steps: - - prepare_enviroment - - analyze_code - - code_coverage - - build_app: - target: "--target-platform android-arm,android-arm64,android-x86,android-x64" - buildNumber: "--build-number $CIRCLE_BUILD_NUM" - working_directory: ~/project/example - - run: - name: Copy APK - command: | - sudo mkdir -p /artifacts && sudo chown "$(whoami)" /artifacts && cp build/app/outputs/flutter-apk/app-debug.apk /artifacts/deriv-chart.apk - working_directory: ~/project/example - - - store_artifacts: - path: /artifacts - # - run: - # name: Upload to Slack - # command: | - # export GIT_COMMIT_DESC=$(git log --format=oneline -n 1 | sed -E 's/^[^ ]+ (.*)$/\1/g') - # echo $CIRCLE_BUILD_URL - # # If we wanted to upload the APK rather than providing a link, we can do that via - # # something like this, but it requires an API token: - # # curl -F file=@/artifacts/otc-cashier.apk -F channels=$SLACK_CHANNEL -F token=$SLACK_API_TOKEN -F title="${CIRCLE_PROJECT_REPONAME} | branch -> ${CIRCLE_BRANCH} | commit -> ${GIT_COMMIT_DESC}" https://slack.com/api/files.upload - # # See https://medium.com/major-league/delivering-builds-through-slack-with-circle-ci-3d9e685e08f2 for an example - # if [ "$CIRCLE_BRANCH" = "master" ]; then - # # That 221348483 magic number is the internal CircleCI repository ID. - # # Since it's not easily accessible from the environment or API, it's hardcoded for now. - # curl -X POST --data-urlencode "payload={\"channel\": \"#mobile_flutter_chart\", \"username\": \"CircleCI\", \"text\": \"Latest Android build for Deriv Chart:\\nhttps://${CIRCLE_BUILD_NUM}-221348483-gh.circle-artifacts.com/0/artifacts/deriv-chart.apk\\n> $GIT_COMMIT_DESC\", \"icon_emoji\": \":autobot:\"}" $SLACK_URL - # fi - - save_env_cache - -workflows: - version: 2.1 - build-workflow: - jobs: - - build_pr: - context: perl - filters: - branches: - ignore: master diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..e708d44da --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,55 @@ + + +**Clickup link:** +**Fixes issue:** # + +This PR contains the following changes: + + + +- [ ] โœจ New feature (non-breaking change which adds functionality) +- [ ] ๐Ÿ› ๏ธ Bug fix (non-breaking change which fixes an issue) +- [ ] โŒ Breaking change (fix or feature that would cause existing functionality to change) +- [ ] ๐Ÿงน Code refactor +- [ ] โœ… Build configuration change +- [ ] ๐Ÿ“ Documentation +- [ ] ๐Ÿ—‘๏ธ Chore + +### Developers Note (Optional) + + + +## Pre-launch Checklist (For PR creator) + +As a creator of this PR: + + + +- [ ] โœ๏ธ I have included clickup id and package/app_name in the PR title. +- [ ] ๐Ÿ‘๏ธ I have gone through the code and removed any temporary changes (commented lines, prints, debug statements etc.). +- [ ] โš’๏ธ I have fixed any errors/warnings shown by the analyzer/linter. +- [ ] ๐Ÿ“ I have added documentation, comments and logging wherever required. +- [ ] ๐Ÿงช I have added necessary tests for these changes. +- [ ] ๐Ÿ”Ž I have ensured all existing tests are passing. + +## Reviewers + + + +## Pre-launch Checklist (For Reviewers) + +As a reviewer I ensure that: + +- [ ] โœด๏ธ This PR follows the standard PR template. +- [ ] ๐Ÿชฉ The information in this PR properly reflects the code changes. +- [ ] ๐Ÿงช All the necessary tests for this PR's are passing. + +## Pre-launch Checklist (For QA) + +- [ ] ๐Ÿ‘Œ It passes the acceptance criteria. + +## Pre-launch Checklist (For Maintainer) + +- [ ] [MAINTAINER_NAME] I make sure this PR fulfills its purpose. diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 000000000..79a076ad9 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,50 @@ +name: Flutter Analyze, Test & Build + +on: + push: + branches: + - master + - dev + pull_request: + branches: + - "*" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: "ubuntu-latest" + steps: + - name: ๐Ÿ“š Git Checkout + uses: actions/checkout@v4 + + - name: ๐Ÿฆ Setup Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.10.2" + channel: stable + cache: true + cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }} + + - name: ๐Ÿคซ Set SSH Key + uses: webfactory/ssh-agent@v0.8.0 + with: + ssh-private-key: ${{secrets.SSH_PRIVATE_KEY}} + + - name: ๐Ÿ“ฆ Install Dependencies + run: flutter pub get + + - name: โœจ Check Formatting + run: dart format --set-exit-if-changed . + + - name: ๐Ÿ•ต๏ธ Analyze + run: flutter analyze --no-fatal-infos + + - name: ๐Ÿงช Run Tests + run: flutter test + + - name: Build Example app + working-directory: ./example + run: flutter build apk --target-platform android-arm,android-arm64,android-x64 diff --git a/example/android/build.gradle b/example/android/build.gradle index 5c39ea0bb..197f7a64e 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.6.0' + ext.kotlin_version = '1.7.21' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:7.0.3' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index b8793d3c0..02e5f5817 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip diff --git a/example/lib/main.dart b/example/lib/main.dart index eca876056..b5132f261 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -38,6 +38,7 @@ void main() { class MyApp extends StatelessWidget { /// Intiialize const MyApp({Key? key}) : super(key: key); + @override Widget build(BuildContext context) => MaterialApp( localizationsDelegates: const >[ @@ -133,7 +134,11 @@ class _FullscreenChartState extends State { Future _connectToAPI() async { _connectionBloc = connection_bloc.ConnectionCubit(ConnectionInformation( - endpoint: defaultEndpoint, appId: defaultAppID, brand: 'deriv')) + endpoint: defaultEndpoint, + appId: defaultAppID, + brand: 'deriv', + authEndpoint: '', + )) ..stream.listen((connection_bloc.ConnectionState connectionState) async { if (connectionState is! connection_bloc.ConnectionConnectedState) { // Calling this since we show some status labels when NOT connected. @@ -149,7 +154,7 @@ class _FullscreenChartState extends State { _requestCompleter.complete(); } await _onIntervalSelected(0); - } on APIBaseException catch (e) { + } on BaseAPIException catch (e) { await showDialog( context: context, builder: (_) => AlertDialog( @@ -308,7 +313,7 @@ class _FullscreenChartState extends State { WidgetsBinding.instance.addPostFrameCallback( (Duration timeStamp) => _controller.scrollToLastTick(), ); - } on TickException catch (e) { + } on BaseAPIException catch (e) { dev.log(e.message!, error: e); } finally { _completeRequest(); @@ -834,6 +839,7 @@ class _FullscreenChartState extends State { endpoint: endpoint != null ? generateEndpointUrl(endpoint: endpoint) : defaultEndpoint, + authEndpoint: '', ); } } diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 4e81f5a1a..89fc5ca9a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -26,7 +26,7 @@ dev_dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_lint - ref: flutter-version-3 + ref: dev flutter_test: sdk: flutter intl_utils: ^2.8.2 diff --git a/pubspec.yaml b/pubspec.yaml index 2b16bcefa..45e53f113 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,6 @@ name: deriv_chart description: Chart for multiplier flutter app. version: 0.0.1 -homepage: "" publish_to: none environment: @@ -32,7 +31,7 @@ dev_dependencies: git: url: git@github.com:regentmarkets/flutter-deriv-packages.git path: packages/deriv_lint - ref: flutter-version-3 + ref: dev build_runner: ^2.3.3 intl_utils: ^2.8.2