From b6593371cd180c1ca3a098ec684fdfc3dd78ca6d Mon Sep 17 00:00:00 2001 From: Felix Mau Date: Mon, 19 Sep 2022 13:20:31 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20::=20Refactor=20CI=20test?= =?UTF-8?q?=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/continuous-integration.yml | 12 ++-- .../GradientLoadingBar-Unit-Tests.xcscheme | 68 +++++++++++++++++++ Example/fastlane/Fastfile | 30 ++++++-- 3 files changed, 100 insertions(+), 10 deletions(-) create mode 100644 Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GradientLoadingBar-Unit-Tests.xcscheme diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e955a16..4b54dad 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -50,11 +50,15 @@ jobs: working-directory: ./Example run: bundle exec fastlane lint - # - name: Execute tests. - # working-directory: ./Example - # run: bundle exec fastlane tests + - name: Execute tests. + working-directory: ./Example + run: bundle exec fastlane tests - - name: Execute validation of library (incl. running tests). + - name: Execute validation Carthage support. + working-directory: ./Example + run: bundle exec fastlane verify_carthage + + - name: Execute validation of library. working-directory: ./Example run: bundle exec fastlane pod_lint diff --git a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GradientLoadingBar-Unit-Tests.xcscheme b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GradientLoadingBar-Unit-Tests.xcscheme new file mode 100644 index 0000000..b275cd0 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/GradientLoadingBar-Unit-Tests.xcscheme @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/fastlane/Fastfile b/Example/fastlane/Fastfile index a2ffa53..2b6f764 100644 --- a/Example/fastlane/Fastfile +++ b/Example/fastlane/Fastfile @@ -35,24 +35,42 @@ platform :ios do ) end + desc "Verify Carthage support by making sure the scheme `GradientLoadingBar` is shared." + lane :verify_carthage do + # + # For Carthage support we explicitly have to mark the scheme `GradientLoadingBar` as shared. + # Source: https://www.amerhukic.com/how-to-add-carthage-support-in-existing-cocoapod-project + # + build_app( + project: "Pods/Pods.xcodeproj", + scheme: "GradientLoadingBar", + skip_archive: true + ) + end + desc "Execute tests." lane :tests do run_tests( - # Running `pod install` will add the scheme `GradientLoadingBar-Unit-Tests` as non shared. - # As a workaround we added the test target to the `Example` scheme. - workspace: "Example.xcworkspace", + project: "Pods/Pods.xcodeproj", + scheme: "GradientLoadingBar-Unit-Tests", devices: ["iPhone 13"], - scheme: "Example" + code_coverage: true, + number_of_retries: 1 ) end desc "Execute validation of library." lane :pod_lint do Dir.chdir("..") do + # # Move outside of `Example/` directory. # - # - Note: `pod lib lint` will also run the tests. - pod_lib_lint() + # - Note: We skip running the tests here, as we have a separate lane for this which allows better customization. + # + pod_lib_lint( + verbose: true, + skip_tests: true + ) end end end