Skip to content

Commit a743bbc

Browse files
authored
feat(ios): Add Cocoapods Install Command (#48 by @vonovak)
You can either use the new `pod_install` command directly, or supply the new `pod_install_directory` parameter to the `ios_build_and_test` job. This will run `pod install`.
1 parent 2d5ab3f commit a743bbc

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

src/commands/pod_install.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
description: install pods, use CircleCI cache to fetch CocoaPods specs
2+
3+
# note: do not use the --project-directory pod param because many example
4+
# projects in the rn community repos rely on pod install to be run from ios directory
5+
# instead cd into the folder and then back
6+
7+
parameters:
8+
pod_install_directory:
9+
type: string
10+
default: "ios"
11+
description: The location of the "ios" directory
12+
steps:
13+
- run:
14+
name: Install CocoaPods
15+
command: |
16+
curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
17+
cd <<parameters.pod_install_directory>> && pod install && cd -

src/jobs/ios_build_and_test.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ parameters:
2020
description: If we should start the Metro packager in the background for this job.
2121
type: boolean
2222
default: false
23+
pod_install_directory:
24+
type: string
25+
default: ""
26+
description: The location of the "ios" directory for `pod install`
2327
# For the iOS build command
2428
project_type:
2529
description: If the iOS app is built using a project file (*.xcodeproj) or a workspace.
@@ -62,7 +66,7 @@ parameters:
6266
node_version:
6367
description: The version of Node to use. This can be either a major version ("8"), a major and minor ("8.4"), or a fully qualified version ("8.4.1").
6468
type: string
65-
default: '10'
69+
default: "10"
6670

6771
steps:
6872
- when:
@@ -75,9 +79,9 @@ steps:
7579
- attach_workspace:
7680
at: <<parameters.workspace_root>>
7781
- setup_macos_executor:
78-
node_version: <<parameters.node_version>>
82+
node_version: <<parameters.node_version>>
7983
- ios_simulator_start:
80-
device: <<parameters.device>>
84+
device: <<parameters.device>>
8185
- yarn_install
8286
- when:
8387
condition: <<parameters.on_after_initialize>>
@@ -89,6 +93,11 @@ steps:
8993
condition: <<parameters.start_metro>>
9094
steps:
9195
- metro_start
96+
- when:
97+
condition: <<parameters.pod_install_directory>>
98+
steps:
99+
- pod_install:
100+
pod_install_directory: <<parameters.pod_install_directory>>
92101
- ios_build:
93102
project_path: <<parameters.project_path>>
94103
derived_data_path: <<parameters.derived_data_path>>

0 commit comments

Comments
 (0)