Skip to content

Commit 2f24401

Browse files
committed
feat: Add jobs for building and testing
1 parent 81f8f67 commit 2f24401

File tree

5 files changed

+190
-46
lines changed

5 files changed

+190
-46
lines changed

src/commands/ios_build_project.yml renamed to src/commands/ios_build.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
description: Builds the iOS app at the given path with the given build scheme and configuration. This should be run only after installing NPM dependencies. If you are using Cocoapods then please use the "ios_build_workspace" command.
1+
description: Builds the iOS app at the given path with the given build scheme and configuration. This should be run only after installing NPM dependencies.
22

33
parameters:
4+
project_type:
5+
description: If the iOS app is built using a project file (*.xcodeproj) or a workspace.
6+
type: enum
7+
enum: ["project", "workspace"]
8+
default: "project"
49
project_path:
5-
description: The path to the Xcode project (*.xcodeproj) you want to build, relative to the root of the repository.
10+
description: The path to the Xcode project (*.xcodeproj) or the Xcode workspace (*.xcworkspace) that you want to build, relative to the root of the repository.
611
type: string
12+
build_configuration:
13+
description: The build configuration to use. This is normally either "Debug" or "Release" but you may have custom build configuration configured for your app.
14+
type: string
15+
default: "Debug"
716
derived_data_path:
817
description: The path to the directory to place the derived data, relative to the root of the repository.
918
type: string
@@ -12,10 +21,6 @@ parameters:
1221
description: The type of device you want to build for.
1322
type: string
1423
default: "iPhone X"
15-
configuration:
16-
description: The build configuration to use. This is normally either "Debug" or "Release" but you may have custom build configuration configured for your app.
17-
type: string
18-
default: "Debug"
1924
scheme:
2025
description: The scheme to use.
2126
type: string
@@ -27,8 +32,8 @@ steps:
2732
- ios-build-cache-{{ arch }}-{{ checksum "~/.tmp/checksumfiles/package.json" }}-{{ .Environment.CACHE_VERSION }}
2833

2934
- run:
30-
name: Build iOS Project
31-
command: "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -project <<parameters.project_path>> -destination 'platform=iOS Simulator,name=<<parameters.device>>' -scheme <<parameters.scheme>> -parallelizeTargets -configuration <<parameters.configuration>> -derivedDataPath <<parameters.derived_data_path>> -UseModernBuildSystem=YES | xcpretty -k"
35+
name: Build iOS App
36+
command: "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -<<parameters.project_type>> <<parameters.project_path>> -destination 'platform=iOS Simulator,name=<<parameters.device>>' -scheme <<parameters.scheme>> -parallelizeTargets -configuration <<parameters.build_configuration>> -derivedDataPath <<parameters.derived_data_path>> -UseModernBuildSystem=YES | xcpretty -k"
3237

3338
- save_cache:
3439
name: Saving iOS Build Cache

src/commands/ios_build_workspace.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/jobs/android_build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
description: Builds the Android app at the given path with the given build types.
2+
3+
executor: linux_android
4+
5+
parameters:
6+
# For this job
7+
checkout:
8+
description: Boolean for whether or not to checkout as a first step. Default is false.
9+
type: boolean
10+
default: false
11+
attach_workspace:
12+
description: Boolean for whether or not to attach to an existing workspace. Default is true.
13+
type: boolean
14+
default: true
15+
workspace_root:
16+
description: Workspace root path that is either an absolute path or a path relative to the working directory. Defaults to '.' (the working directory).
17+
type: string
18+
default: .
19+
persist_to_workspace:
20+
description: Should this job persist files to a workspace? Defaults to true
21+
type: boolean
22+
default: true
23+
store_artifacts:
24+
description: Store this job store files as job artifacts? Defaults to true
25+
type: boolean
26+
default: true
27+
# For the build command
28+
project_path:
29+
description: The path to the root of the Android project you want to build, relative to the root of the repository.
30+
type: string
31+
default: "./android"
32+
build_type:
33+
description: The build type to build. This is normally either "debug" or "release" but you may have custom build types configured for your app.
34+
type: string
35+
default: "debug"
36+
37+
steps:
38+
- when:
39+
condition: <<parameters.checkout>>
40+
steps:
41+
- checkout
42+
- when:
43+
condition: <<parameters.attach_workspace>>
44+
steps:
45+
- attach_workspace:
46+
at: <<parameters.workspace_root>>
47+
- yarn_install
48+
- android_build:
49+
project_path: <<parameters.project_path>>
50+
build_type: <<parameters.build_type>>
51+
- when:
52+
condition: <<parameters.persist_to_workspace>>
53+
steps:
54+
- persist_to_workspace:
55+
root: .
56+
paths:
57+
- <<parameters.project_path>>/app/build/outputs/apk
58+
- when:
59+
condition: <<parameters.store_artifacts>>
60+
steps:
61+
- store_artifacts:
62+
path: <<parameters.project_path>>/app/build/outputs/apk

src/jobs/android_test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
description: Tests the Android app on the given device, with the given Detox configuration. You should have already built the correct Android APK (including the androidTest APK) and have both persisted to the worksapce.
2+
3+
executor: macos
4+
5+
parameters:
6+
# For this job
7+
workspace_root:
8+
description: Workspace root path that is either an absolute path or a path relative to the working directory. Defaults to '.' (the working directory).
9+
type: string
10+
default: .
11+
# For the start emulator command
12+
device_name:
13+
description: The name of the AVD. You use this name to tell which device to run tests on. Defaults to 'TestingAVD'.
14+
type: string
15+
default: "TestingAVD"
16+
platform_version:
17+
description: The version of android to run on the emulator. Defaults to 'android-28'.
18+
type: string
19+
default: "android-28"
20+
build_tools_version:
21+
description: The version of the Android build tools to install. Defaults to '28.0.3'.
22+
type: string
23+
default: "28.0.3"
24+
logcat_grep:
25+
description: ADB logs will be shown in the "Start Android Emulator" commands, but we filter it using grep to avoid noise. You can specify additional strigns to grep for. Make sure you escape special characters. Defaults to 'com.reactnativecommunity'.
26+
type: string
27+
default: "com.reactnativecommunity"
28+
# For the detox command
29+
detox_configuration:
30+
description: The Detox configuration to test. Defaults to 'android.emu.release'.
31+
type: string
32+
default: "android.emu.release"
33+
34+
steps:
35+
- attach_workspace:
36+
at: <<parameters.workspace_root>>
37+
- setup_macos_executor
38+
- yarn_install
39+
- android_emulator_start:
40+
device_name: <<parameters.device_name>>
41+
platform_version: <<parameters.platform_version>>
42+
build_tools_version: <<parameters.build_tools_version>>
43+
logcat_grep: <<parameters.logcat_grep>>
44+
- detox_test:
45+
configuration: <<parameters.detox_configuration>>

src/jobs/ios_build_and_test.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
description: Builds the iOS app at the given path with the given build scheme and configuration and then runs the tests with the Detox configuration given.
2+
3+
executor: macos
4+
5+
parameters:
6+
# For this job
7+
checkout:
8+
description: Boolean for whether or not to checkout as a first step. Default is false.
9+
type: boolean
10+
default: false
11+
attach_workspace:
12+
description: Boolean for whether or not to attach to an existing workspace. Default is true.
13+
type: boolean
14+
default: true
15+
workspace_root:
16+
description: Workspace root path that is either an absolute path or a path relative to the working directory. Defaults to '.' (the working directory).
17+
type: string
18+
default: .
19+
# For the iOS build command
20+
project_type:
21+
description: If the iOS app is built using a project file (*.xcodeproj) or a workspace.
22+
type: enum
23+
enum: ["project", "workspace"]
24+
default: "project"
25+
project_path:
26+
description: The path to the Xcode project (*.xcodeproj) or the Xcode workspace (*.xcworkspace) that you want to build, relative to the root of the repository.
27+
type: string
28+
build_configuration:
29+
description: The build configuration to use. This is normally either "Debug" or "Release" but you may have custom build configuration configured for your app.
30+
type: string
31+
default: "Debug"
32+
derived_data_path:
33+
description: The path to the directory to place the derived data, relative to the root of the repository.
34+
type: string
35+
default: "ios/build"
36+
device:
37+
description: The type of device you want to build for.
38+
type: string
39+
default: "iPhone X"
40+
scheme:
41+
description: The scheme to use.
42+
type: string
43+
# For the Detox test command
44+
detox_configuration:
45+
description: The Detox configuration to test.
46+
type: string
47+
default: "ios.sim.release"
48+
49+
steps:
50+
- when:
51+
condition: <<parameters.checkout>>
52+
steps:
53+
- checkout
54+
- when:
55+
condition: <<parameters.attach_workspace>>
56+
steps:
57+
- attach_workspace:
58+
at: <<parameters.workspace_root>>
59+
- setup_macos_executor
60+
- ios_simulator_start:
61+
device: <<parameters.device>>
62+
- yarn_install
63+
- ios_build:
64+
project_path: <<parameters.project_path>>
65+
derived_data_path: <<parameters.derived_data_path>>
66+
device: <<parameters.device>>
67+
build_configuration: <<parameters.build_configuration>>
68+
scheme: <<parameters.scheme>>
69+
- detox_test:
70+
configuration: <<parameters.detox_configuration>>

0 commit comments

Comments
 (0)