Repository: microsoft/react-native-test-app
Pull request #1200 (2022-11-11 13:12:06)

ci(ios): disable Flipper when building templates [skip ci]
### Description

See #1194

### Platforms affected

- [ ] Android
- [ ] iOS
- [ ] macOS
- [ ] Windows

### Test plan

Template builds shouldn't take 30 minutes: https://github.com/microsoft/react-native-test-app/actions/runs/3445742959/jobs/5749810025


Patch:
diff --git a/.github/actions/gradle/action.yml b/.github/actions/gradle/action.yml
index 811a025..f2841bb 100644
--- a/.github/actions/gradle/action.yml
+++ b/.github/actions/gradle/action.yml
@@ -24,5 +24,6 @@ runs:
       uses: gradle/gradle-build-action@v2.3.3
       with:
         gradle-version: wrapper
+        cache-disabled: true # causes bad resolutions to reappear
         arguments: ${{ inputs.arguments }}
         build-root-directory: ${{ steps.build-root-directory-finder.outputs.build-root-directory }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7eb9d5f..9830746 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -198,7 +198,7 @@ jobs:
           fi
       - name: Install Pods
         run: |
-          pod install --project-directory=${{ steps.configure.outputs.project-directory }}
+          USE_FLIPPER=0 pod install --project-directory=${{ steps.configure.outputs.project-directory }}
         working-directory: template-example
       - name: Build
         run: |
diff --git a/.rubocop.yml b/.rubocop.yml
index 91b041f..eb840c5 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,3 +1,6 @@
+require:
+  - rubocop-minitest
+
 AllCops:
   NewCops: enable
   Exclude:
diff --git a/scripts/configure.js b/scripts/configure.js
index 31cc2c5..2222e3c 100755
--- a/scripts/configure.js
+++ b/scripts/configure.js
@@ -576,7 +576,7 @@ const getConfig = (() => {
             Podfile: join(
               `require_relative '${testAppRelPath}/test_app'`,
               "",
-              "use_flipper!",
+              "use_flipper! false if ENV['USE_FLIPPER'] == '0'",
               "",
               `workspace '${name}.xcworkspace'`,
               "",


Test patch:
diff --git a/test/configure/__snapshots__/gatherConfig.test.js.snap b/test/configure/__snapshots__/gatherConfig.test.js.snap
index 7d93a74..45bbf47 100644
--- a/test/configure/__snapshots__/gatherConfig.test.js.snap
+++ b/test/configure/__snapshots__/gatherConfig.test.js.snap
@@ -12,7 +12,7 @@ Object {
     },
     "Podfile": "require_relative '../test_app'
 
-use_flipper!
+use_flipper! false if ENV['USE_FLIPPER'] == '0'
 
 workspace 'Test.xcworkspace'
 
@@ -133,7 +133,7 @@ applyTestAppSettings(settings)
     },
     "ios/Podfile": "require_relative '../../test_app'
 
-use_flipper!
+use_flipper! false if ENV['USE_FLIPPER'] == '0'
 
 workspace 'Test.xcworkspace'
 
@@ -303,7 +303,7 @@ Object {
     },
     "ios/Podfile": "require_relative '../../test_app'
 
-use_flipper!
+use_flipper! false if ENV['USE_FLIPPER'] == '0'
 
 workspace 'Test.xcworkspace'
 
@@ -435,7 +435,7 @@ applyTestAppSettings(settings)
     },
     "ios/Podfile": "require_relative '../../test_app'
 
-use_flipper!
+use_flipper! false if ENV['USE_FLIPPER'] == '0'
 
 workspace 'Test.xcworkspace'
 
@@ -586,7 +586,7 @@ applyTestAppSettings(settings)
     },
     "ios/Podfile": "require_relative '../../test_app'
 
-use_flipper!
+use_flipper! false if ENV['USE_FLIPPER'] == '0'
 
 workspace 'Test.xcworkspace'
 
diff --git a/test/test_pod_helpers.rb b/test/test_pod_helpers.rb
index aa37aed..aa458a3 100644
--- a/test/test_pod_helpers.rb
+++ b/test/test_pod_helpers.rb
@@ -19,6 +19,7 @@ class TestPodHelpers < Minitest::Test
 
     # `RCT_NEW_ARCH_ENABLED` enables everything
     ENV['RCT_NEW_ARCH_ENABLED'] = '1'
+
     refute(fabric_enabled?({}, 6799))
     assert(fabric_enabled?({}, 6800))
   end
@@ -38,6 +39,7 @@ class TestPodHelpers < Minitest::Test
 
     # `RCT_NEW_ARCH_ENABLED` enables everything
     ENV['RCT_NEW_ARCH_ENABLED'] = '1'
+
     refute(new_architecture_enabled?({}, 6799))
     assert(new_architecture_enabled?({}, 6800))
   end
diff --git a/test/test_test_app.rb b/test/test_test_app.rb
index 10faf7d..7c00db3 100644
--- a/test/test_test_app.rb
+++ b/test/test_test_app.rb
@@ -19,17 +19,19 @@ end
 class TestTestApp < Minitest::Test
   def test_app_config
     name, display_name, single_app = app_config(fixture_path('with_resources'))
-    assert_equal(name, 'TestFixture')
-    assert_equal(display_name, 'Test Fixture')
+
+    assert_equal('TestFixture', name)
+    assert_equal('Test Fixture', display_name)
     assert_nil(single_app)
   end
 
   def test_app_config_single_app
     name, display_name, version, single_app = app_config(fixture_path('single_app_mode'))
-    assert_equal(name, 'TestFixture')
-    assert_equal(display_name, 'Test Fixture')
-    assert_equal(version, '1.0.0')
-    assert_equal(single_app, 'test-fixture')
+
+    assert_equal('TestFixture', name)
+    assert_equal('Test Fixture', display_name)
+    assert_equal('1.0.0', version)
+    assert_equal('test-fixture', single_app)
   end
 
   def test_autolink_script_path
@@ -40,33 +42,37 @@ class TestTestApp < Minitest::Test
   end
 
   def test_flipper_enabled?
-    assert(flipper_enabled?)
+    assert_predicate(self, :flipper_enabled?)
 
     use_flipper!(false)
 
-    refute(flipper_enabled?)
+    refute_predicate(self, :flipper_enabled?)
 
     use_flipper!
 
-    assert(flipper_enabled?)
+    assert_predicate(self, :flipper_enabled?)
   ensure
     use_flipper!(nil)
   end
 
   def test_flipper_versions
-    assert_equal({}, flipper_versions)
+    assert_empty(flipper_versions)
 
     use_flipper!(false)
+
     refute(flipper_versions)
 
     versions = { 'Flipper' => '~> 0.41.1' }
     use_flipper!(versions)
+
     assert_equal(versions, flipper_versions)
 
     use_flipper!
-    assert_equal({}, flipper_versions)
+
+    assert_empty(flipper_versions)
 
     use_flipper!(false)
+
     refute(flipper_versions)
   ensure
     use_flipper!(nil)
@@ -78,6 +84,7 @@ class TestTestApp < Minitest::Test
     assert_equal(expected, nearest_node_modules(fixture_path('test_app')))
 
     react_native = fixture_path('test_app', 'node_modules', 'react-native')
+
     assert_equal(expected, nearest_node_modules(react_native))
 
     assert_equal(expected, nearest_node_modules(fixture_path('test_app', 'src')))
@@ -85,9 +92,11 @@ class TestTestApp < Minitest::Test
 
   def test_package_version
     react_native = fixture_path('test_app', 'node_modules', 'react-native')
+
     assert_equal(Gem::Version.new('1000.0.0'), package_version(react_native))
 
     cli = fixture_path('test_app', 'node_modules', '@react-native-community', 'cli-platform-ios')
+
     assert_equal(Gem::Version.new('4.10.1'), package_version(cli))
   end
 
@@ -170,7 +179,7 @@ class TestTestApp < Minitest::Test
         manifest = JSON.parse(File.read(manifest_path))
 
         if project_root.to_s.include?('without')
-          assert_equal([], manifest['resources'])
+          assert_empty(manifest['resources'])
         elsif project_root.to_s.include?('with_platform_resources')
           assert_equal(platform_resources, manifest['resources'].sort)
         else
@@ -190,6 +199,7 @@ class TestTestApp < Minitest::Test
 
     project = Xcodeproj::Project.open('macos/ReactTestApp.xcodeproj')
     test_app = project.targets.detect { |target| target.name == 'ReactTestApp' }
+
     assert(test_app)
     test_app.build_configurations.each do |config|
       assert_equal('-', config.build_settings['CODE_SIGN_IDENTITY'])