Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add BuildCI #2

Merged
merged 11 commits into from
Feb 25, 2022
Merged

Add BuildCI #2

merged 11 commits into from
Feb 25, 2022

Conversation

Ho2eny
Copy link
Collaborator

@Ho2eny Ho2eny commented Feb 25, 2022

Build CI를 추가합니다

현재 Build가 작동하는 상황 :

  • master, dev에 머지하는 PR
  • matser에 push

타겟 OS :

  • Web
  • Android
  • iOS

공유할 점
Home 위젯의 BottomNavigationBar 를 테스트 하는 코드를 넣었는데 몇몇 에러가 있었어

  1. 테스트 코드에서 pumpWidget으로 위젯을 그리는데, 위젯 트리에서 MediaQuery 위젯이 없으면 문제가 발생해
The following assertion was thrown building MyHomePage(state: _MyHomePageState#fe53b):
No MediaQuery widget ancestor found.
Scaffold widgets require a MediaQuery widget ancestor.
The specific widget that could not find a MediaQuery ancestor was:
  Scaffold
The ownership chain for the affected widget is: "Scaffold ← MyHomePage ← [root]"
No MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of().
This can happen because you have not added a WidgetsApp, CupertinoApp, or MaterialApp widget (those
widgets introduce a MediaQuery), or it can happen if the context you use comes from a widget above
those widgets.

MediaQuery를 포함해서 위젯을 만드는 것이 testable한 면에서 필요할 것 같다 생각되었고,
이는 WidgetsApp, CupertinoApp, MaterialApp으로 감싸면 되서 일단 MaterialApp으로 처리했어 here
commit

  1. 테스트 코드에서 tab 클릭했을 때 이동하는 부분을 검증하는 것을 작성할 때 BottomNavigationBarItem을 찾는 것으로 처음에 작성했었는데, BottomNavigationBarItem은 위젯이 아닌 (not extends StatelessWidget or StaetfullWidget) 일반 클래스라 찾지를 못 했던 문제가 있었어
    그래서 Icon을 찾는 것으로 변경 commit
Expected: exactly 4 matching nodes in the widget tree
  Actual: _WidgetTypeFinder:<zero widgets with type "BottomNavigationBarItem" (ignoring offstage
widgets)>
   Which: means none were found but some were expected

Missing index.html.
Error: Process completed with exit code 1.

2-1. HardCoding된 tab 개수를 수정했다가 발견한 사항인데, finder를 통해서 Widget을 저장해놓으면 그 상태에서 변하지 않는 것 처럼 보여. Widget에 인터랙션을 줄 때마다 받아와서 사용해야 할 거 같아
commit

      BottomNavigationBar bottomNav = tester.firstWidget(bottomNavFinder); // bottomNav를 받아왔었는데,
      int tabNum = bottomNav.items.length;

      var bottomNavItemFinder = find.byType(Icon);
      expect(bottomNavItemFinder, findsNWidgets(tabNum));

      var randTabIndex = new Random().nextInt(tabNum);

      await tester.tap(bottomNavItemFinder.at(randTabIndex));
      await tester.pumpAndSettle(); // tap 하고 pumpAndSettle을 한 후에도 bottomNav가 이에 맞게 변경될거라 생각했지만

      bottomNav = tester.firstWidget(bottomNavFinder); // 다시 tester를 통해서 덮어씌우지 않으면 이전 값으로 기억해
      expect(bottomNav.currentIndex, randTabIndex);
  1. 위 문제를 보다가 BottomNavigationBar에서 tab 개수가 3개를 넘어가면 typeFixed를 부여해야 하는 것을 알게 되었어. (배경색이 다르다면 괜찮음)
    Reference : here

  2. build_error 해결
    Error Log : https://github.com/CoCoVo/FitQA/runs/5335406444?check_suite_focus=true

  • android: kotlin version 호환 문제
  • iOS: cocoapod 의존성 최신화 문제인 줄 알았는데, iOS 버전 문제
  • Web: index.html이 없음, web_build 문제
  1. Fix build error in web
    Web build를 enable할 때에는 here 이 내용으로 web build가 가능했어, 다만 현재 패키지 이름이 FitQA로 되어있어서 불가능해서 FitQA 패키지를 fitqa_flutter 로 이동을 시켰으 (windows-desktop이 enable 되어있어서 현재는 disable시켜놓음) commit
FitQa - repository structure
  - READEME.md
  - fitqa_flutter
    - android
    - ios
    - web
    - lib
    - etc..
  - fitqa_backend (maybe?) 
  1. Fix build error in android
    kotlin version을 올려줌 commit

  2. Fix build error in iOS
    많이 헤맸는데, iOS build를 안하다 보니 Pubfile이 없었고. 이 Pubfile에서 target iOS의 버전을 명시하는데, 이 부분이 없다보니 자동으로 iOS 9버전으로 지정이 되었어
    여기를 보면 firebase 모듈들의 최소 버전이 나와있는데, auth의 경우 10이 minimum 이었어
    Pubfile이 동적으로 생성되나 라고 착각을 해서 build script 에서 iOS 버전을 명시해주려고 오래 시간을 썼는데, 알고 보니 Web 빌드 하듯이 iOS 빌드하면 나오는 Pubfile이어서 기본 Pubfile을 찾아서 넣어주었어 commit

결국 Apple 아이디와 ceritificate가 없으면 iOS build가 안되는 것을 알고 일단은 disable 을 시켰어

@Ho2eny Ho2eny requested a review from olion500 February 25, 2022 13:24
@Ho2eny Ho2eny self-assigned this Feb 25, 2022
Added BuildCI
@Ho2eny Ho2eny force-pushed the feature/add-build-ci branch from 4e19c26 to 8ee46f9 Compare February 25, 2022 13:29
Deleted unused test code
Added home widget test
@Ho2eny Ho2eny force-pushed the feature/add-build-ci branch from 9d28a90 to 6f2d11c Compare February 25, 2022 14:48
@Ho2eny Ho2eny force-pushed the feature/add-build-ci branch 2 times, most recently from 6f7990a to 3c1a6d3 Compare February 25, 2022 18:21
@Ho2eny Ho2eny force-pushed the feature/add-build-ci branch from 3c1a6d3 to b626143 Compare February 25, 2022 18:25
@Ho2eny Ho2eny merged commit 0b966cb into develop Feb 25, 2022
@Ho2eny Ho2eny deleted the feature/add-build-ci branch February 25, 2022 18:55
@olion500
Copy link
Owner

  1. MyHomePage 상위에 MyApp에서 MaterialApp으로 감싸고 있는데 이것처럼 바꾸면 MyHomePage 내부에서 MaterialApp을 한번 더 감싸는거라서 중복되는 코드야.
    이건 테스트코드에서 수정을 하던, MaterialApp 위치를 변경하던지 해야될거 같애

  2. BottomNavigationBar에서 tab 개수가 3개 넘어가면 typeFixed를 부여해야 된다.
    이게 무슨말이야? 몰랐던 사실인걸
    내가 본건 type: fixed 가 아니면 tab을 클릭할때마다 아이콘 크기가 변하고 위치가 움직여서 설정한거였어

@Ho2eny
Copy link
Collaborator Author

Ho2eny commented Feb 26, 2022

  1. MyHomePage 상위에 MyApp에서 MaterialApp으로 감싸고 있는데 이것처럼 바꾸면 MyHomePage 내부에서 MaterialApp을 한번 더 감싸는거라서 중복되는 코드야.
    이건 테스트코드에서 수정을 하던, MaterialApp 위치를 변경하던지 해야될거 같애
  2. BottomNavigationBar에서 tab 개수가 3개 넘어가면 typeFixed를 부여해야 된다.
    이게 무슨말이야? 몰랐던 사실인걸
    내가 본건 type: fixed 가 아니면 tab을 클릭할때마다 아이콘 크기가 변하고 위치가 움직여서 설정한거였어

1번은 그렇네, 확인을 해봐야겠다 이미 있었구나

2번은 3개가 넘어갔을 때 배경색이 같고 fixed를 설정하지 않으면 안나오는 문제가 있었나바
우리꺼는 해당이 안되는데, 공유 목적으로 넣어둔거였으

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants