Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[#39] Optimize the workflow to generate the "sample" project before executing CI actions #38

Merged

Conversation

luongvo
Copy link
Member

@luongvo luongvo commented Aug 24, 2023

What happened 👀

  • Modify the test.yml workflow to generate the sample project before executing test actions on Android or iOS platforms.
  • Add cancel previous runs.
  • Separate danger report between Android and iOS.
  • Fix: Running Danger SwiftFormat from the non-root directory.
  • Add the initial contribution guide for git-submodule.

Insight 📝

The Danger for iOS has an issue when running from the non-root directory: sample/ios, which makes the SwiftFormat can not file expected files because of duplicating the sample/ios path https://github.com/nimblehq/kmm-templates/actions/runs/5982564343/job/16231801560 💥

image

  • The cause is while danger-ruby-swiftformat returns the list of swift files with the full path from the root dir, e.g. sample/ios/fastlane/Constants/Constant.swift, including sample/ios, SwiftFormat joins them with the current working dir /Users/runner/work/kmm-templates/kmm-templates/sample/ios/.

  • There is no official support to bypass this issue. I made a workaround to modify the danger-ruby-swiftformat source to remove the sample/ios prefix from all files by using this operator .map { |file| file.partition('sample/ios/').last } 🙏

       files
         .select { |file| file.end_with?(".swift") }
         .reject { |file| @exclude.any? { |glob| File.fnmatch(glob, file) } }
         .uniq.map { |file| file.partition('sample/ios/').last }
         .sort
    

Proof Of Work 📹

The workflow works properly as it is.

@luongvo luongvo self-assigned this Aug 24, 2023
@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch 7 times, most recently from c015dfd to d037ab3 Compare August 24, 2023 08:44
@luongvo luongvo added this to the 0.1.0 milestone Aug 24, 2023
@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch from f269985 to 8ec2d6e Compare August 24, 2023 09:04
@luongvo
Copy link
Member Author

luongvo commented Aug 24, 2023

@phongvhd93 @markgravity @kaungkhantsoe This PR is now ready for review, too 🎉

@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch from dac1a75 to cf19e76 Compare August 24, 2023 09:37
@luongvo luongvo marked this pull request as draft August 24, 2023 11:42
@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch from 14a0c87 to 0845d42 Compare August 25, 2023 02:03
@nimblehq nimblehq deleted a comment from bot-nimble Aug 25, 2023
@nimblehq nimblehq deleted a comment from bot-nimble Aug 25, 2023
@luongvo luongvo changed the base branch from develop to feature/17-remove-unnecessary-libs August 25, 2023 14:38
@luongvo luongvo changed the title [Chore] Optimize the test workflow to prepare, execute CI actions and submit the "sample" project [Chore] Optimize the workflow to generate the "sample" project before executing CI actions Aug 25, 2023
@luongvo luongvo changed the title [Chore] Optimize the workflow to generate the "sample" project before executing CI actions [#39] Optimize the workflow to generate the "sample" project before executing CI actions Aug 25, 2023
@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch from 0845d42 to b08ebe6 Compare August 25, 2023 15:09
@nimblehq nimblehq deleted a comment from github-actions bot Aug 25, 2023
@markgravity markgravity force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch from 8ff584b to 59a1c6d Compare August 28, 2023 04:16
@phongvhd93 phongvhd93 force-pushed the feature/17-remove-unnecessary-libs branch from 0164ea2 to 08b288b Compare August 28, 2023 04:21
Base automatically changed from feature/17-remove-unnecessary-libs to develop August 28, 2023 07:18
@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch 2 times, most recently from de0b400 to 7bdf896 Compare August 28, 2023 09:08
@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch 2 times, most recently from d6c9b1d to 61a830d Compare August 28, 2023 09:55
@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch from 61a830d to 87e9ce7 Compare August 28, 2023 09:58
@nimblehq nimblehq deleted a comment from github-actions bot Aug 28, 2023
@github-actions
Copy link

github-actions bot commented Aug 28, 2023

1 Warning
⚠️ This pull request is quite big (618 lines changed), please consider splitting it into multiple pull requests.

SwiftFormat found issues:

File Rules
fastlane/Constants/Constant.swift:122:1 warning: (trailingSpace) Remove trailing space at end of a line.
fastlane/Constants/Constant.swift:129:1 warning: (trailingSpace) Remove trailing space at end of a line.
fastlane/Constants/Constant.swift:145:1 warning: (trailingSpace) Remove trailing space at end of a line.
fastlane/Constants/Constant.swift:153:1 warning: (trailingSpace) Remove trailing space at end of a line.
fastlane/Constants/Constant.swift:160:1 warning: (trailingSpace) Remove trailing space at end of a line.
fastlane/Constants/Constant.swift:164:1 warning: (spaceAroundOperators) Add or remove space around operators or delimiters.
fastlane/Constants/Constant.swift:167:1 warning: (trailingSpace) Remove trailing space at end of a line.

Current coverage for sample is 18.25%

No files affecting coverage found


Powered by xcov

Generated by 🚫 Danger

@luongvo luongvo force-pushed the chore/optimize-test-workflow-to-execute-on-the-sample-project branch from 87e9ce7 to 6e29f3b Compare August 28, 2023 10:30
@luongvo luongvo marked this pull request as ready for review August 28, 2023 10:31
.github/workflows/test.yml Outdated Show resolved Hide resolved
.github/workflows/test.yml Outdated Show resolved Hide resolved
.github/workflows/test.yml Outdated Show resolved Hide resolved
.github/workflows/test.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@kaungkhantsoe kaungkhantsoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@phongvhd93 phongvhd93 merged commit 23f777f into develop Aug 29, 2023
@phongvhd93 phongvhd93 deleted the chore/optimize-test-workflow-to-execute-on-the-sample-project branch August 29, 2023 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize the workflow to generate the "sample" project before executing CI actions
4 participants