1. chiubaka/circleci-orb@0.12.0

chiubaka/circleci-orb@0.12.0

Sections
Custom orb for CircleCI including common commands, jobs, and workflows used by Chiubaka Technologies projects.
Created: July 7, 2022Version Published: October 22, 2023Releases: 26
Org Usage:
< 25

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: circleci-orb: chiubaka/circleci-orb@0.12.0

Use circleci-orb elements in your existing workflows and jobs.

Opt-in to use of uncertified orbs on your organization’s Security settings page.

Usage Examples

dynamic-setup

Using dynamic configuration to generate a continuation config based off of a template.

1 2 3 4 5 6 7 8 version: '2.1' setup: true orbs: chiubaka: chiubaka/circleci-orb@dev:alpha workflows: dynamic-setup: jobs: - chiubaka/dynamic-setup

js

A basic lint, build, test, and deploy example for a JavaScript-only project.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 version: '2.1' orbs: chiubaka: chiubaka/circleci-orb@0.11.4 workflows: lint-build-test-deploy: jobs: - chiubaka/lint: filters: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: lint - chiubaka/build: filters: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build - chiubaka/test: configure-git-user: true filters: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test - chiubaka/deploy: context: - npm-publishing filters: branches: ignore: /.*/ name: deploy requires: - lint - build - test

react-native

A basic lint, build, test, and deploy example for a React Native project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 version: '2.1' orbs: chiubaka: chiubaka/circleci-orb@dev:alpha workflows: react-native-build-test-e2e-deploy: jobs: - chiubaka/lint: filter: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: lint - chiubaka/build: filter: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build - chiubaka/test: filter: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test - chiubaka/e2e: filter: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: e2e requires: - build - chiubaka/deploy: filter: branches: ignore: /.*/ name: deploy requires: - build - test - e2e - chiubaka/build-android: enabled: << pipeline.parameters.build-android >> filter: tags: only: >- /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build-android requires: - build setup-apps-steps: - chiubaka/setup-android-app: app-dir: apps/kagami - chiubaka/build-ios: enabled: << pipeline.parameters.build-ios >> filter: tags: only: >- /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build-ios requires: - build setup-apps-steps: - chiubaka/setup-ios-app: app-dir: apps/kagami - chiubaka/test-android: enabled: << pipeline.parameters.test-android >> filter: tags: only: >- /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test-android requires: - build - build-android - test - e2e setup-apps-steps: - chiubaka/setup-android-app: app-dir: apps/kagami - chiubaka/test-ios: enabled: << pipeline.parameters.test-ios >> filter: tags: only: >- /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test-ios requires: - build - build-ios - test - e2e setup-apps-steps: - chiubaka/setup-ios-app: app-dir: apps/kagami - chiubaka/e2e-android: enabled: << pipeline.parameters.e2e-android >> filter: tags: only: >- /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: e2e-android requires: - build-android - test-android setup-apps-steps: - chiubaka/setup-android-app: app-dir: apps/kagami - chiubaka/e2e-ios: enabled: << pipeline.parameters.e2e-ios >> filter: tags: only: >- /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: e2e-ios requires: - build-ios - test-ios setup-apps-steps: - chiubaka/setup-ios-app: app-dir: apps/kagami - chiubaka/deploy-android: enabled: << pipeline.parameters.deploy-android >> filters: branches: ignore: /.*/ name: deploy-android requires: - e2e-android setup-apps-steps: - chiubaka/setup-android-app: app-dir: apps/kagami - chiubaka/deploy-ios: enabled: << pipeline.parameters.deploy-ios >> filters: branches: ignore: /.*/ name: deploy-ios requires: - e2e-ios setup-apps-steps: - chiubaka/setup-ios-app: app-dir: apps/kagami when: << pipeline.parameters.react-native >>

react-native-template

A sample template config for React Native to be used in combination with chiubaka/dynamic-setup. Environment variables will be substituted for dynamic values using the `envsubst` command.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 version: '2.1' orbs: chiubaka: chiubaka/circleci-orb@dev:alpha workflows: lint-build-test-e2e-deploy: jobs: - chiubaka/lint: filters: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: lint - chiubaka/build: filters: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build - chiubaka/test: filters: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test - chiubaka/e2e: filters: tags: only: >- /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: e2e requires: - build - chiubaka/deploy: filters: branches: ignore: /.*/ name: deploy requires: - build - test - e2e - chiubaka/build-android: build-tools-version: << pipeline.parameters.android-emulator-build-tools-version >> enabled: << pipeline.parameters.build-android >> filters: tags: only: $ANDROID_SEMVER_REGEX name: build-android platform-version: << pipeline.parameters.android-emulator-platform-version >> requires: - build setup-apps-steps: $SETUP_ANDROID_APPS_STEPS - chiubaka/build-ios: context: - ios-deployment enabled: << pipeline.parameters.build-ios >> filters: tags: only: $ANDROID_SEMVER_REGEX name: build-ios requires: - build setup-apps-steps: $SETUP_IOS_APPS_STEPS simulator-device: << pipeline.parameters.ios-simulator-device >> simulator-version: << pipeline.parameters.ios-simulator-version >> xcode-version: << pipeline.parameters.xcode-version >> - chiubaka/test-android: build-tools-version: << pipeline.parameters.android-emulator-build-tools-version >> enabled: << pipeline.parameters.test-android >> filters: tags: only: $ANDROID_SEMVER_REGEX name: test-android platform-version: << pipeline.parameters.android-emulator-platform-version >> requires: - build - build-android - test - e2e setup-apps-steps: $SETUP_ANDROID_APPS_STEPS - chiubaka/test-ios: context: - ios-deployment enabled: << pipeline.parameters.test-ios >> filters: tags: only: $ANDROID_SEMVER_REGEX name: test-ios requires: - build - build-ios - test - e2e setup-apps-steps: $SETUP_IOS_APPS_STEPS simulator-device: << pipeline.parameters.ios-simulator-device >> simulator-version: << pipeline.parameters.ios-simulator-version >> xcode-version: << pipeline.parameters.xcode-version >> - chiubaka/e2e-android: build-tools-version: << pipeline.parameters.android-emulator-build-tools-version >> enabled: << pipeline.parameters.e2e-android >> filters: tags: only: $ANDROID_SEMVER_REGEX name: e2e-android platform-version: << pipeline.parameters.android-emulator-platform-version >> requires: - build-android - test-android setup-apps-steps: $SETUP_ANDROID_APPS_STEPS - chiubaka/e2e-ios: context: - ios-deployment enabled: << pipeline.parameters.e2e-ios >> filters: tags: only: $ANDROID_SEMVER_REGEX name: e2e-ios requires: - build-ios - test-ios setup-apps-steps: $SETUP_IOS_APPS_STEPS simulator-device: << pipeline.parameters.ios-simulator-device >> simulator-version: << pipeline.parameters.ios-simulator-version >> xcode-version: << pipeline.parameters.xcode-version >> - chiubaka/deploy-android: build-tools-version: << pipeline.parameters.android-emulator-build-tools-version >> filters: branches: ignore: /.*/ name: deploy-android platform-version: << pipeline.parameters.android-emulator-platform-version >> requires: - e2e-android setup-apps-steps: $SETUP_ANDROID_APPS_STEPS - chiubaka/deploy-ios: context: - ios-deployment filters: branches: ignore: /.*/ name: deploy-ios requires: - e2e-ios setup-apps-steps: $SETUP_IOS_APPS_STEPS simulator-device: << pipeline.parameters.ios-simulator-device >> simulator-version: << pipeline.parameters.ios-simulator-version >> xcode-version: << pipeline.parameters.xcode-version >>

Jobs

build

Builds the project code using the build script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
medium
enum
setup-steps
Steps to run as part of setup for this job
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
false
boolean

build-android

Builds Android project code using the script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
enabled
Whether or not this job should be run. When false the job will pass without doing anything
No
true
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
medium
enum
setup-apps-steps
Steps to run in order to initialize Android apps within this repository. Refer to the setup-android-app command, which was designed to setup an individual Android app. This parameter most likely consists of one setup-android-app command per Android app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you.
Yes
-
steps
setup-steps
Additional steps to run as part of setup for this job
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

build-ios

Builds iOS project code using the script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
enabled
Whether or not this job should be run. When false the job will pass without doing anything
No
true
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
macos.m1.medium.gen1
string
setup-apps-steps
Steps to run in order to initialize iOS apps within this repository. Refer to the setup-ios-app command, which was designed to setup an individual iOS app. This parameter most likely consists of one setup-ios-app command per iOS app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you.
Yes
-
steps
setup-steps
Additional steps to run as part of setup for this job
No
[]
steps
xcode-version
XCode version to use.
No
14.3.1
string
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

deploy

Deploys the project (or a subset of packages in a monorepo).

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
configure-git-user
Whether or not to ensure that a git user is set before running this job.
No
false
boolean
dry-run
Whether or not to run a real deploy or just a dry run
No
false
boolean
git-user-email
Email of the git user to configure
No
circleci@chiubaka.com
string
git-user-name
Name of the git user to configure
No
CircleCI
string
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
monorepo
Whether or not this is a monorepo
No
true
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
medium
enum
setup-steps
Steps to run as part of setup for this job
No
[]
steps
task-name
The name of this deploy task to display in the CircleCI UI
No
Deploy
string
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
false
boolean

deploy-android

Deploy Android project code using the script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
medium
enum
setup-apps-steps
Steps to run in order to initialize Android apps within this repository. Refer to the setup-android-app command, which was designed to setup an individual Android app. This parameter most likely consists of one setup-android-app command per Android app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you.
Yes
-
steps
setup-steps
Additional steps to run as part of setup for this job
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

deploy-ios

Builds iOS project code using the script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
macos.m1.medium.gen1
string
setup-apps-steps
Steps to run in order to initialize iOS apps within this repository. Refer to the setup-ios-app command, which was designed to setup an individual iOS app. This parameter most likely consists of one setup-ios-app command per iOS app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you.
Yes
-
steps
setup-steps
Additional steps to run as part of setup for this job
No
[]
steps
xcode-version
XCode version to use.
No
14.3.1
string
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

dynamic-setup

Setup job for dynamic configuration. Does some basic setup of the repository and then generates config from a set of expected templates for continuation. Client projects must include a `.circleci/react-native.template.yml` file and a `.circleci/js.template.yml` file. A main.yml file will be generated for continuation using one of these files using the `envsubst` command. React Native templates will be supplied with the following variables: - $IOS_SEMVER_REGEX: a regular expression that matches tags for all iOS-enabled projects - $ANDROID_SEMVER_REGEX: a regular expression that matches tags for all Android-enabled projects - $SETUP_IOS_APPS_STEPS: a list of automatically generated steps for initializing all iOS-enabled projects. This is meant to be used as part of an alias in the `constants` block. See the react-native example for details. - $SETUP_ANDROID_APPS_STEPS: a list of automatically generated steps for initializing all Android-enabled projects. This is meant to be used as part of an alias in the `constants` block. See the react-native example for details.

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
small
enum
setup-steps
Steps to run as part of setup for this job
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management.
No
true
boolean

e2e

Runs the project E2E tests using the E2E script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
configure-git-user
Whether or not to ensure that a git user is set before running this job.
No
false
boolean
docker-compose
Whether or not to run docker-compose as part of testing setup
No
false
boolean
git-user-email
Email of the git user to configure
No
circleci@chiubaka.com
string
git-user-name
Name of the git user to configure
No
CircleCI
string
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
monorepo
Whether or not this repo is a monorepo
No
true
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
medium
enum
setup-steps
Steps to run as part of setup for this job
No
[]
steps
wait-for-docker-services
Steps to run to verify that docker services are all ready. Pair with wait-for-docker-service command.
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
false
boolean

e2e-android

Run Android project E2E tests using the script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
build-tools-version
The version of the Android build tools to install.
No
34.0.0
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
enabled
Whether or not this job should be run. When false the job will pass without doing anything
No
true
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
platform-version
The platform version to use for the AVD
No
android-34
string
resource-class
Resource class used for the executor.
No
medium
enum
setup-apps-steps
Steps to run in order to initialize Android apps within this repository. Refer to the setup-android-app command, which was designed to setup an individual Android app. This parameter most likely consists of one setup-android-app command per Android app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you.
Yes
-
steps
setup-steps
Additional steps to run as part of setup for this job
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

e2e-ios

Run iOS project E2E tests using the script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
enabled
Whether or not this job should be run. When false the job will pass without doing anything
No
true
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
macos.m1.medium.gen1
string
setup-apps-steps
Steps to run in order to initialize iOS apps within this repository. Refer to the setup-ios-app command, which was designed to setup an individual iOS app. This parameter most likely consists of one setup-ios-app command per iOS app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you.
Yes
-
steps
setup-steps
Additional steps to run as part of setup for this job
No
[]
steps
simulator-device
The simulator device name to use (e.g. iPhone 14)
No
iPhone 14
string
simulator-version
The simulator OS version to use (e.g. 16.4)
No
'16.4'
string
xcode-version
XCode version to use.
No
14.3.1
string
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

lint

Lints the project code using the lint script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
medium
enum
setup-steps
Steps to run as part of setup for this job
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
false
boolean

test

Tests the project code using the test script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
configure-git-user
Whether or not to ensure that a git user is set before running this job.
No
false
boolean
docker-compose
Whether or not to run docker-compose as part of testing setup
No
false
boolean
git-user-email
Email of the git user to configure
No
circleci@chiubaka.com
string
git-user-name
Name of the git user to configure
No
CircleCI
string
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
monorepo
Whether or not this repo is a monorepo
No
true
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
medium
enum
setup-steps
Steps to run as part of setup for this job
No
[]
steps
wait-for-docker-services
Steps to run to verify that docker services are all ready. Pair with wait-for-docker-service command.
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
false
boolean

test-android

Test Android project code using the script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
enabled
Whether or not this job should be run. When false the job will pass without doing anything
No
true
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
medium
enum
setup-apps-steps
Steps to run in order to initialize Android apps within this repository. Refer to the setup-android-app command, which was designed to setup an individual Android app. This parameter most likely consists of one setup-android-app command per Android app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you.
Yes
-
steps
setup-steps
Additional steps to run as part of setup for this job
No
[]
steps
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

test-ios

Test iOS project code using the script provided by package.json

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
cleanup-steps
Steps to run as part of cleanup for this job
No
[]
steps
enabled
Whether or not this job should be run. When false the job will pass without doing anything
No
true
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
resource-class
Resource class used for the executor.
No
macos.m1.medium.gen1
string
setup-apps-steps
Steps to run in order to initialize iOS apps within this repository. Refer to the setup-ios-app command, which was designed to setup an individual iOS app. This parameter most likely consists of one setup-ios-app command per iOS app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you.
Yes
-
steps
setup-steps
Additional steps to run as part of setup for this job
No
[]
steps
simulator-device
The simulator device name to use (e.g. iPhone 14)
No
iPhone 14
string
simulator-version
The simulator OS version to use (e.g. 16.4)
No
'16.4'
string
xcode-version
XCode version to use.
No
14.3.1
string
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

Commands

compose-docker

Installs and runs docker-compose in the project directory. Useful for testing support. Will generally be used with the included machine executor.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing docker-compose.yml.
No
.
string
wait-for-services
Runs a set of steps to wait until all required docker services are up and running. Pair with wait-for-docker-service command.
No
[]
steps

deploy

This command triggers the deploy script for the repo.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
dry-run
Whether or not to run a real deploy or just a dry run
No
false
boolean
monorepo
Whether or not this is a monorepo
No
true
boolean
task-name
The name of this task to display in the CircleCI UI
Yes
-
string

deploy-android

This command triggers the Android deploy script for the repo.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string

deploy-ios

This command triggers the iOS deploy script for the repo.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string

pod-install

Installs CocoaPods and caches the resulting dependencies

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
The directory containing the app project (and Gemfile)
Yes
-
string
cache
Save and restore the cache? Defaults to true
No
true
boolean
pod-install-directory
The location of the "ios" directory relative to app-dir
No
ios
string

setup

This command sets up the CI environment for the repository

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
checkout
Whether or not to checkout as the first step of this command
No
true
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
false
boolean

setup-android

Set up an Android executor to run Android-specific React Native tasks.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
build-tools-version
The version of the Android build tools to install.
No
34.0.0
string
device-name
The name of the AVD device to create
No
Detox
string
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
platform-version
The platform version to use for the AVD
No
android-34
string
setup-nx
Whether or not to run Nx-specific setup commands
No
true
boolean
with-emulator
Whether or not to setup this Android executor with an emulator for UI testing
No
false
boolean
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

setup-android-app

Sets up a single Android app. Must be used once per app in a monorepo.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
The directory containing the app project (and Gemfile)
Yes
-
string
cache
Whether or not to cache dependencies (CocoaPods, Ruby)
No
true
boolean

setup-android-code-signing

Sets up code signing for a single Android app. Must be used once per app in a monorepo.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
secrets-dir
Location of the Secrets directory relative to the `app-dir` parameter
Yes
-
string

setup-ios-app

Sets up a single iOS app. Must be used once per app in a monorepo.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
The directory containing the app project (and Gemfile)
Yes
-
string
cache
Whether or not to cache dependencies (CocoaPods, Ruby)
No
true
boolean
install-pods
Whether or not to install Cocoapods for this app.
No
true
boolean
pod-install-directory
The location of the "ios" directory relative to app-dir
No
ios
string

setup-ios-code-signing

Sets up code signing for a single iOS app. Must be used once per app in a monorepo.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
secrets-dir
Location of the Secrets directory relative to the `app-dir` parameter
Yes
-
string

setup-machine

Installs additional required dependencies for machine executor like Node.js and Dockerize

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
node-version
Full version tag of the version of node to use.
No
lts/gallium
string

setup-macos

Sets up a macOS executor for various React Native tasks. A significant portion of this command is ripped and modified from the react-native-community/react-native orb, which seems to expect full Detox configurations _and_ Android testing on macOS executors (which is silly given the cost).

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
homebrew-cache
Should we cache after brew install?
No
true
boolean
homebrew-update
Should we run brew update?
No
false
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
install-watchman
Whether or not to install Watchman
No
false
boolean
install-xcodes
Whether or not to install Xcodes for switching between Xcode versions
No
true
boolean
node-version
Major version of Node to use. Specific minor and patch versions are not supported due to needing to install Node through homebrew. (https://discuss.circleci.com/t/nodejs-regularly-fails-to-install-after-10min/49170/3)
No
18
integer
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
setup-nx
Whether or not to run Nx-specific setup commands
No
true
boolean
simulator-device
The simulator device name to use (e.g. iPhone 14)
No
iPhone 14
string
simulator-version
The simulator OS version to use (e.g. 16.4)
No
'16.4'
string
with-simulator
Whether or not to set up the executor with a simulator
No
false
boolean
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

setup-react-native

Runs common workspace-level setup steps for React Native projects. This command should be run once. There is a separate package-specific command that sets up individual apps.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
checkout
Whether or not to checkout as the first step of this command
No
true
boolean
init-submodules
Whether or not to initialize submodules included in this repository.
No
false
boolean
nx-affected
Whether or not to set up environment variables for `nx affected`.
No
true
boolean
setup-nx
Whether or not to run Nx-specific setup commands
No
true
boolean
yarn-berry
Whether or not to use Yarn berry for package management. Defaults to Yarn v1.
No
true
boolean

setup-react-native-app

Runs common setup steps for a single React Native app. This command needs to be run once per React Native app included in the project.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
The directory containing the app project (and Gemfile)
Yes
-
string
cache
Whether or not to enable automatic caching of Gemfile dependencies for increased speed.
No
true
boolean
pre-bundle-install-steps
Steps to run after the bundler is installed but before Ruby dependencies are installed
No
[]
steps

start-android-emulator

Create and start an Android emulator

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
build-tools-version
The version of the Android build tools to install.
No
34.0.0
string
device-name
The name of the AVD device to create
No
Detox
string
platform-version
The platform version to use for the AVD
No
android-34
string

upload-monorepo-coverage

This command uploads coverage reports for monorepos to Codecov

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
app-dir
Path to the directory containing your package.json file. Not needed if package.json lives in the root.
No
.
string
coverage-dir
Path relative to app-dir where coverage reports can be found
No
reports/coverage
string
validate
Validate the uploader before uploading the codecov result.
No
true
boolean
version
Version of the Codecov uploader to use
No
latest
string
xtra_args
Any extra flags as provided by the bash uploader (e.g. `-v -Z`).
No
''
string

wait-for-android-emulator

Wait for Android emulator to be ready

Show command Source

wait-for-docker-service

Waits for a particular docker service to be up and running

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
container-name
Name of the container to wait for
Yes
-
string
retry-interval
Interval at which to check whether or not the service is ready
No
2s
string
timeout
Total time to wait for the service to be ready
No
20s
string
url
URL to check to determine whether or not service is ready
Yes
-
string

write-shared-script

This command writes shared scripts to disk so they can be consumed by other scripts

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
script
The script to write. Should be included here using the include directive.
Yes
-
string
script-dir
Path to the directory to write shared scripts to. Relative to project root.
No
../@chiubaka/circleci-orb/scripts
string
script-name
Name of the script to write
Yes
-
string

Executors

android

This selects an Android machine image. CircleCI's Android machine images are recommended for Android emulator tests. CircleCI's docker executors don't easily support nested virtualization.

Show executor Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
resource-class
Resource class used for the executor.
No
medium
enum
tag
The Android image tag to use. Choose a tag from https://circleci.com/developer/machine/image/android#image-tags
No
2023.09.1
string

docker-node

Runs node on docker

Show executor Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
resource-class
Resource class to use for Docker
No
medium
string
tag
Pick a specific cimg/node image variant: https://hub.docker.com/r/cimg/node/tags
No
lts
string

machine

Runs a machine executor configured with NodeJS and docker-compose

Show executor Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
resource-class
Resource class to use for Docker
No
medium
string

macos

MacOS executor for running Apple-specific React Native tasks

Show executor Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
resource-class
MacOS executor resource class to use.
No
macos.m1.medium.gen1
string
xcode-version
XCode version to use.
No
14.3.1
string

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: | Custom orb for CircleCI including common commands, jobs, and workflows used by Chiubaka Technologies projects. display: home_url: https://github.com/chiubaka/circleci-orb#readme source_url: https://github.com/chiubaka/circleci-orb orbs: android: circleci/android@2.3.0 codecov: codecov/codecov@3.2.3 continuation: circleci/continuation@1.0.0 docker: circleci/docker@2.1.3 macos: circleci/macos@2.4.0 node: circleci/node@5.0.2 nx: nrwl/nx@1.5.1 ruby: circleci/ruby@2.1.0 commands: compose-docker: description: | Installs and runs docker-compose in the project directory. Useful for testing support. Will generally be used with the included machine executor. parameters: app-dir: default: . description: Path to the directory containing docker-compose.yml. type: string wait-for-services: default: [] description: Runs a set of steps to wait until all required docker services are up and running. Pair with wait-for-docker-service command. type: steps steps: - run: command: docker-compose build name: Build images of services declared in docker-compose.yml working_directory: << parameters.app-dir >> - run: command: docker-compose up -d name: Start all services declared in docker-compose.yml working_directory: << parameters.app-dir >> - steps: << parameters.wait-for-services >> deploy: description: | This command triggers the deploy script for the repo. parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string dry-run: default: false description: Whether or not to run a real deploy or just a dry run type: boolean monorepo: default: true description: Whether or not this is a monorepo type: boolean task-name: description: The name of this task to display in the CircleCI UI type: string steps: - when: condition: << parameters.monorepo >> steps: - write-shared-script: script: | #! /usr/bin/env bash parse_package_name() { TAG=$1 match="$(echo "$TAG" | grep -oE "^(\w+-)+")" semver="${TAG#"$match"}" echo "${match%"-"}" } parse_semver() { TAG=$1 match="$(echo "$TAG" | grep -oE "^(\w+-)+")" semver="${TAG#"$match"}" echo "${semver#v}" } script-name: parseMonorepoDeployTag.sh - run: command: | #! /usr/bin/env bash set -e # shellcheck disable=1090,1091 source "$PARSE_MONOREPO_DEPLOY_TAG_SCRIPT" package_name="$(parse_package_name "$CIRCLE_TAG")" yarn=${YARN_BINARY:-"yarn"} deploy_script=${DEPLOY_SCRIPT:-"deploy:ci"} if [ "$DRY_RUN" = true ]; then $yarn $deploy_script "$package_name" --dry-run else $yarn $deploy_script "$package_name" fi environment: DRY_RUN: << parameters.dry-run >> PARSE_MONOREPO_DEPLOY_TAG_SCRIPT: ../@chiubaka/circleci-orb/scripts/parseMonorepoDeployTag.sh name: '[Monorepo] << parameters.task-name >> (DRY_RUN=<< parameters.dry-run >>)' working_directory: << parameters.app-dir >> - when: condition: not: << parameters.monorepo >> steps: - when: condition: << parameters.dry-run >> steps: - run: command: yarn deploy:ci --dry-run name: << parameters.task-name >> (Dry Run) working_directory: << parameters.app-dir >> - when: condition: not: << parameters.dry-run >> steps: - run: command: yarn deploy:ci name: << parameters.task-name >> working_directory: << parameters.app-dir >> deploy-android: description: | This command triggers the Android deploy script for the repo. parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string steps: - write-shared-script: script: | #! /usr/bin/env bash parse_package_name() { TAG=$1 match="$(echo "$TAG" | grep -oE "^(\w+-)+")" semver="${TAG#"$match"}" echo "${match%"-"}" } parse_semver() { TAG=$1 match="$(echo "$TAG" | grep -oE "^(\w+-)+")" semver="${TAG#"$match"}" echo "${semver#v}" } script-name: parseMonorepoDeployTag.sh - run: command: | #! /usr/bin/env bash set -e # shellcheck disable=1090,1091 source "$PARSE_MONOREPO_DEPLOY_TAG_SCRIPT" package_name="$(parse_package_name "$CIRCLE_TAG")" yarn=${YARN_BINARY:-"yarn"} deploy_script=${DEPLOY_SCRIPT:-"deploy:ci"} if [ "$DRY_RUN" = true ]; then $yarn $deploy_script "$package_name" --dry-run else $yarn $deploy_script "$package_name" fi environment: DEPLOY_SCRIPT: deploy:android:ci DRY_RUN: false PARSE_MONOREPO_DEPLOY_TAG_SCRIPT: ../@chiubaka/circleci-orb/scripts/parseMonorepoDeployTag.sh name: Deploy Android project working_directory: << parameters.app-dir >> deploy-ios: description: | This command triggers the iOS deploy script for the repo. parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string steps: - write-shared-script: script: | #! /usr/bin/env bash parse_package_name() { TAG=$1 match="$(echo "$TAG" | grep -oE "^(\w+-)+")" semver="${TAG#"$match"}" echo "${match%"-"}" } parse_semver() { TAG=$1 match="$(echo "$TAG" | grep -oE "^(\w+-)+")" semver="${TAG#"$match"}" echo "${semver#v}" } script-name: parseMonorepoDeployTag.sh - run: command: | #! /usr/bin/env bash set -e # shellcheck disable=1090,1091 source "$PARSE_MONOREPO_DEPLOY_TAG_SCRIPT" package_name="$(parse_package_name "$CIRCLE_TAG")" yarn=${YARN_BINARY:-"yarn"} deploy_script=${DEPLOY_SCRIPT:-"deploy:ci"} if [ "$DRY_RUN" = true ]; then $yarn $deploy_script "$package_name" --dry-run else $yarn $deploy_script "$package_name" fi environment: DEPLOY_SCRIPT: deploy:ios:ci DRY_RUN: false PARSE_MONOREPO_DEPLOY_TAG_SCRIPT: ../@chiubaka/circleci-orb/scripts/parseMonorepoDeployTag.sh name: Deploy iOS project working_directory: << parameters.app-dir >> pod-install: description: | Installs CocoaPods and caches the resulting dependencies parameters: app-dir: description: The directory containing the app project (and Gemfile) type: string cache: default: true description: Save and restore the cache? Defaults to true type: boolean pod-install-directory: default: ios description: The location of the "ios" directory relative to app-dir type: string steps: - when: condition: << parameters.cache >> steps: - restore_cache: keys: - '{{ .Environment.CACHE_VERSION }}-cache-pods-{{ checksum "<< parameters.app-dir>>/<< parameters.pod-install-directory >>/Podfile.lock" }}' - '{{ .Environment.CACHE_VERSION }}-cache-pods' - run: command: | #! /usr/bin/env bash set -e bundle exec pod install --project-directory="./$POD_INSTALL_DIRECTORY" environment: POD_INSTALL_DIRECTORY: << parameters.pod-install-directory >> name: Install CocoaPods working_directory: << parameters.app-dir >> - when: condition: << parameters.cache >> steps: - save_cache: key: '{{ .Environment.CACHE_VERSION }}-cache-pods-{{ checksum "<< parameters.app-dir >>/<< parameters.pod-install-directory >>/Podfile.lock" }}' paths: - << parameters.app-dir >>/<< parameters.pod-install-directory >>/Pods setup: description: | This command sets up the CI environment for the repository parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string checkout: default: true description: Whether or not to checkout as the first step of this command type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean yarn-berry: default: false description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: << parameters.checkout >> steps: - checkout - run: command: git config --global init.defaultBranch master name: Set default git branch - when: condition: << parameters.init-submodules >> steps: - run: command: git submodule update --init --recursive name: Initialize submodules - when: condition: << parameters.nx-affected >> steps: - nx/set-shas: main-branch-name: master - when: condition: << parameters.nx-affected >> steps: - run: command: rm -f index.js name: Clean-up Nx set SHAs working_directory: << parameters.app-dir >> - when: condition: << parameters.yarn-berry >> steps: - node/install-packages: app-dir: << parameters.app-dir >> check-cache: always pkg-manager: yarn-berry with-cache: true - when: condition: not: << parameters.yarn-berry >> steps: - node/install-packages: app-dir: << parameters.app-dir >> check-cache: always pkg-manager: yarn with-cache: true setup-android: description: | Set up an Android executor to run Android-specific React Native tasks. parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string build-tools-version: default: 34.0.0 description: The version of the Android build tools to install. type: string device-name: default: Detox description: The name of the AVD device to create type: string init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean platform-version: default: android-34 description: The platform version to use for the AVD type: string setup-nx: default: true description: Whether or not to run Nx-specific setup commands type: boolean with-emulator: default: false description: Whether or not to setup this Android executor with an emulator for UI testing type: boolean yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - checkout - when: condition: << parameters.with-emulator >> steps: - start-android-emulator: build-tools-version: << parameters.build-tools-version >> device-name: << parameters.device-name >> platform-version: << parameters.platform-version >> - setup-react-native: app-dir: << parameters.app-dir >> checkout: false init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> setup-nx: << parameters.setup-nx >> yarn-berry: << parameters.yarn-berry >> - when: condition: << parameters.with-emulator >> steps: - wait-for-android-emulator setup-android-app: description: | Sets up a single Android app. Must be used once per app in a monorepo. parameters: app-dir: description: The directory containing the app project (and Gemfile) type: string cache: default: true description: Whether or not to cache dependencies (CocoaPods, Ruby) type: boolean steps: - setup-react-native-app: app-dir: << parameters.app-dir >> cache: << parameters.cache >> pre-bundle-install-steps: - run: command: bundle lock --add-platform x86_64-linux name: Add x86_64-linux platform to Gemfile.lock working_directory: << parameters.app-dir >> - setup-android-code-signing: secrets-dir: << parameters.app-dir >>/android/secrets setup-android-code-signing: description: | Sets up code signing for a single Android app. Must be used once per app in a monorepo. parameters: secrets-dir: description: Location of the Secrets directory relative to the `app-dir` parameter type: string steps: - run: command: mkdir -p << parameters.secrets-dir >> name: Ensure android/secrets directory exists - android/decode-keystore: keystore-location: << parameters.secrets-dir >>/upload-keystore.jks - android/create-keystore-properties: release-keystore: ./upload-keystore.jks working-directory: << parameters.secrets-dir >> - run: command: mv keystore.properties upload-keystore.properties name: Rename generated keystore properties to upload-keystore.properties working_directory: << parameters.secrets-dir >> - android/create-google-play-key: working-directory: << parameters.secrets-dir >> setup-ios-app: description: | Sets up a single iOS app. Must be used once per app in a monorepo. parameters: app-dir: description: The directory containing the app project (and Gemfile) type: string cache: default: true description: Whether or not to cache dependencies (CocoaPods, Ruby) type: boolean install-pods: default: true description: Whether or not to install Cocoapods for this app. type: boolean pod-install-directory: default: ios description: The location of the "ios" directory relative to app-dir type: string steps: - setup-react-native-app: app-dir: << parameters.app-dir >> cache: << parameters.cache >> pre-bundle-install-steps: - run: command: bundle lock --add-platform arm64-darwin-21 name: Add arm64-darwin-21 platform to Gemfile.lock working_directory: << parameters.app-dir >> - run: command: bundle lock --add-platform arm64-darwin-22 name: Add arm64-darwin-22 platform to Gemfile.lock working_directory: << parameters.app-dir >> - when: condition: << parameters.install-pods >> steps: - pod-install: app-dir: << parameters.app-dir >> cache: << parameters.cache >> pod-install-directory: << parameters.pod-install-directory >> - setup-ios-code-signing: secrets-dir: << parameters.app-dir >>/ios/secrets setup-ios-code-signing: description: | Sets up code signing for a single iOS app. Must be used once per app in a monorepo. parameters: secrets-dir: description: Location of the Secrets directory relative to the `app-dir` parameter type: string steps: - run: command: | #! /usr/bin/env bash mkdir -p $SECRETS_DIR echo $APP_STORE_CONNECT_KEY | base64 -d -o "$SECRETS_DIR/app-store-connect-key.p8" environment: SECRETS_DIR: << parameters.secrets-dir >> name: Decode App Store Connect key setup-machine: description: | Installs additional required dependencies for machine executor like Node.js and Dockerize parameters: node-version: default: lts/gallium description: Full version tag of the version of node to use. type: string steps: - run: command: | #! /usr/bin/env bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash # Load new NVM version into current shell export NVM_DIR="/opt/circleci/.nvm" # shellcheck disable=1090,1091 [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # shellcheck disable=1090,1091 [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" echo "nvm use default &>/dev/null" >> ~/.bashrc name: Update NVM - node/install: install-yarn: true node-version: << parameters.node-version >> - docker/install-docker - docker/install-docker-compose - docker/install-dockerize setup-macos: description: | Sets up a macOS executor for various React Native tasks. A significant portion of this command is ripped and modified from the react-native-community/react-native orb, which seems to expect full Detox configurations _and_ Android testing on macOS executors (which is silly given the cost). parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string homebrew-cache: default: true description: Should we cache after brew install? type: boolean homebrew-update: default: false description: Should we run brew update? type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean install-watchman: default: false description: Whether or not to install Watchman type: boolean install-xcodes: default: true description: Whether or not to install Xcodes for switching between Xcode versions type: boolean node-version: default: 18 description: | Major version of Node to use. Specific minor and patch versions are not supported due to needing to install Node through homebrew. (https://discuss.circleci.com/t/nodejs-regularly-fails-to-install-after-10min/49170/3) type: integer nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean setup-nx: default: true description: Whether or not to run Nx-specific setup commands type: boolean simulator-device: default: iPhone 14 description: The simulator device name to use (e.g. iPhone 14) type: string simulator-version: default: "16.4" description: The simulator OS version to use (e.g. 16.4) type: string with-simulator: default: false description: Whether or not to set up the executor with a simulator type: boolean yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: << parameters.with-simulator >> steps: - macos/preboot-simulator: device: << parameters.simulator-device >> version: << parameters.simulator-version >> - checkout - run: command: | #! /usr/bin/env bash set -e { echo 'export PATH="$PATH:/usr/local/opt/node@$NODE_VERSION/bin:~/.yarn/bin:~/project/node_modules/.bin:~/project/example/node_modules/.bin"' echo 'export ANDROID_HOME="/usr/local/share/android-commandlinetools"' echo 'export ANDROID_SDK_ROOT="/usr/local/share/android-commandlinetools"' echo 'export PATH="$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH"' echo 'export QEMU_AUDIO_DRV=none' echo 'export JAVA_HOME=$(/usr/libexec/java_home)' } >> $BASH_ENV # shellcheck disable=1090 source $BASH_ENV environment: NODE_VERSION: << parameters.node-version >> name: Configure Environment Variables - when: condition: and: - << parameters.homebrew-cache >> - not: << parameters.with-simulator >> steps: - restore_cache: key: brew-cache-{{ arch }}-{{ .Environment.CACHE_VERSION }}-without-simulator-tools - when: condition: and: - << parameters.homebrew-cache >> - << parameters.with-simulator >> steps: - restore_cache: key: brew-cache-{{ arch }}-{{ .Environment.CACHE_VERSION }}-with-simulator-tools - when: condition: << parameters.homebrew-update >> steps: - run: command: brew update >/dev/null name: Update brew - run: command: | #! /usr/bin/env bash set -e existing_node_version=$(node --version) if [[ $existing_node_version == v$NODE_VERSION* ]]; then echo "Node $existing_node_version already installed. Skipping install of Node via Homebrew." else echo "Installing Node via Homebrew." HOMEBREW_NO_AUTO_UPDATE=1 brew install node@$NODE_VERSION new_node_version=$(node --version) echo "Installed $new_node_version via Homebrew." fi environment: NODE_VERSION: << parameters.node-version >> name: Install node@<< parameters.node-version >> - when: condition: << parameters.install-watchman >> steps: - run: command: | HOMEBREW_NO_AUTO_UPDATE=1 brew install watchman > /dev/null command watchman -v name: Install Watchman - when: condition: << parameters.with-simulator >> steps: - run: command: | HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew > /dev/null HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils > /dev/null name: Install Simulator Tools - when: condition: << parameters.install-xcodes >> steps: - run: command: brew install xcodesorg/made/xcodes name: Install Xcodes - when: condition: and: - << parameters.homebrew-cache >> - not: << parameters.with-simulator >> steps: - save_cache: key: brew-cache-{{ arch }}-{{ .Environment.CACHE_VERSION }}-without-simulator-tools paths: - ~/Library/Caches/Homebrew - when: condition: and: - << parameters.homebrew-cache >> - << parameters.with-simulator >> steps: - save_cache: key: brew-cache-{{ arch }}-{{ .Environment.CACHE_VERSION }}-with-simulator-tools paths: - ~/Library/Caches/Homebrew - setup-react-native: app-dir: << parameters.app-dir >> checkout: false init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> setup-nx: << parameters.setup-nx >> yarn-berry: << parameters.yarn-berry >> - when: condition: << parameters.with-simulator >> steps: - macos/wait-until-simulator-booted setup-react-native: description: | Runs common workspace-level setup steps for React Native projects. This command should be run once. There is a separate package-specific command that sets up individual apps. parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string checkout: default: true description: Whether or not to checkout as the first step of this command type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean setup-nx: default: true description: Whether or not to run Nx-specific setup commands type: boolean yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - setup: app-dir: << parameters.app-dir >> checkout: << parameters.checkout >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - when: condition: << parameters.setup-nx >> steps: - run: command: yarn nx run-many --target=ensure-symlink name: Ensure Symlink - run: command: yarn nx run-many --target=sync-deps name: Sync Deps setup-react-native-app: description: | Runs common setup steps for a single React Native app. This command needs to be run once per React Native app included in the project. parameters: app-dir: description: The directory containing the app project (and Gemfile) type: string cache: default: true description: Whether or not to enable automatic caching of Gemfile dependencies for increased speed. type: boolean pre-bundle-install-steps: default: [] description: Steps to run after the bundler is installed but before Ruby dependencies are installed type: steps steps: - ruby/install-deps: app-dir: << parameters.app-dir >> pre-install-steps: << parameters.pre-bundle-install-steps >> with-cache: << parameters.cache >> - run: command: bundle exec fastlane install_plugins name: Install Fastlane plugins working_directory: << parameters.app-dir >> start-android-emulator: description: | Create and start an Android emulator parameters: build-tools-version: default: 34.0.0 description: The version of the Android build tools to install. type: string device-name: default: Detox description: The name of the AVD device to create type: string platform-version: default: android-34 description: The platform version to use for the AVD type: string steps: - run: command: | #! /usr/bin/env bash set -e (yes || true) | sdkmanager "platform-tools" "tools" > /dev/null (yes || true) | sdkmanager "platforms;$ANDROID_PLATFORM_VERSION" > /dev/null (yes || true) | sdkmanager "emulator" > /dev/null (yes || true) | sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION" > /dev/null environment: ANDROID_BUILD_TOOLS_VERSION: << parameters.build-tools-version >> ANDROID_PLATFORM_VERSION: << parameters.platform-version >> name: Install Emulator dependencies - run: background: true command: adb start-server name: Start ADB Server - android/create-avd: avd-name: << parameters.device-name >> install: true system-image: system-images;<< parameters.platform-version >>;default;x86_64 - android/start-emulator: avd-name: << parameters.device-name >> no-window: true post-emulator-launch-assemble-command: "" wait-for-emulator: false upload-monorepo-coverage: description: | This command uploads coverage reports for monorepos to Codecov parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string coverage-dir: default: reports/coverage description: Path relative to app-dir where coverage reports can be found type: string validate: default: true description: Validate the uploader before uploading the codecov result. type: boolean version: default: latest description: Version of the Codecov uploader to use type: string xtra_args: default: "" description: Any extra flags as provided by the bash uploader (e.g. `-v -Z`). type: string steps: - write-shared-script: script: | #! /usr/bin/env bash parse_nx_projects() { JSON_FILE=$1 local -n _projects=$2 local project_names IFS=" " read -r -a project_names \<<< "$(parse_nx_project_names "$JSON_FILE")" local project_paths IFS=" " read -r -a project_paths \<<< "$(parse_nx_project_paths "$JSON_FILE")" for (( i=0; i<${#project_names[@]}; i++ )); do # shellcheck disable=SC2034 _projects[${project_names[$i]}]=${project_paths[$i]} done } parse_nx_project_names() { JSON_FILE=$1 local project_names_strings project_names_strings=$(jq '.projects | to_entries[] | "\(.key)"' "$JSON_FILE") format_json_output "$project_names_strings" } parse_nx_project_paths() { JSON_FILE=$1 local project_paths_strings project_paths_strings=$(jq '.projects | to_entries[] | "\(.value)"' "$JSON_FILE") format_json_output "$project_paths_strings" } format_json_output() { string=$1 replace_newlines_with_spaces "$(remove_quotes "$string")" } remove_quotes() { string=$1 string="${string//\"/""}" # shellcheck disable=SC2086 echo $string } replace_newlines_with_spaces() { string=$1 string="${string//\\n/" "}" # shellcheck disable=SC2086 echo $string } script-name: parseNxProjects.sh - run: command: | #! /usr/bin/env bash family=$(uname -s | tr '[:upper:]' '[:lower:]') os="windows" [[ $family == "darwin" ]] && os="macos" [[ $family == "linux" ]] && os="linux" [[ $os == "linux" ]] && \ osID=$(grep -e "^ID=" /etc/os-release | cut -c4-) [[ $osID == "alpine" ]] && os="alpine" echo "Detected ${os}" echo "export OS=${os}" >> "$BASH_ENV" filename="codecov" [[ $os == "windows" ]] && filename+=".exe" echo "export CODECOV_FILENAME=${filename}" >> "$BASH_ENV" [[ $os == "macos" ]] && \ HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg cwd=$(pwd) CODECOV_BINARY="$cwd/$filename" echo "export CODECOV_BINARY=\"${CODECOV_BINARY}\"" >> "$BASH_ENV" codecov_url="https://uploader.codecov.io" codecov_url="$codecov_url/$VERSION" codecov_url="$codecov_url/${os}/${filename}" echo "Downloading from $codecov_url" curl -Os "$codecov_url" chmod +x "$CODECOV_BINARY" environment: VERSION: << parameters.version >> name: Download Codecov Uploader - when: condition: << parameters.validate >> steps: - run: command: | #! /usr/bin/env bash # shellcheck source=/dev/null source "$BASH_ENV" curl https://keybase.io/codecovsecurity/pgp_keys.asc | \ gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step sha_url="https://uploader.codecov.io" sha_url="$sha_url/$VERSION/${OS}" sha_url="$sha_url/${CODECOV_FILENAME}.SHA256SUM" curl -Os "$sha_url" curl -Os "$sha_url.sig" gpgv "$CODECOV_FILENAME".SHA256SUM.sig "$CODECOV_FILENAME".SHA256SUM shasum -a 256 -c "$CODECOV_FILENAME".SHA256SUM || \ sha256sum -c "$CODECOV_FILENAME".SHA256SUM environment: VERSION: << parameters.version >> name: Validate Codecov Uploader - run: command: | #! /usr/bin/env bash set -e # See https://github.com/codecov/uploader/issues/475 unset NODE_OPTIONS # shellcheck source=/dev/null source "$BASH_ENV" # shellcheck disable=1090,1091 source "$PARSE_NX_PROJECTS_SCRIPT" declare -A projects parse_nx_projects "$WORKSPACE_JSON" projects [ -n "$XTRA_ARGS" ] && \ set - "${@}" "$XTRA_ARGS" for project_name in "${!projects[@]}" do project_path=${projects[$project_name]} project_coverage_dir="$COVERAGE_DIR/$project_path" if [ ! -d "$project_coverage_dir" ] then echo "Skipping coverage upload for $project_name because $project_coverage_dir does not exist" continue fi $CODECOV_BINARY \ -t "$CODECOV_TOKEN" \ -n "$CIRCLE_BUILD_NUM" \ --dir "$project_coverage_dir" \ -F "$project_name" \ "$@" done environment: COVERAGE_DIR: << parameters.app-dir >>/<< parameters.coverage-dir >> PARSE_NX_PROJECTS_SCRIPT: ../@chiubaka/circleci-orb/scripts/parseNxProjects.sh WORKSPACE_JSON: << parameters.app-dir >>/workspace.json XTRA_ARGS: << parameters.xtra_args >> name: Upload Monorepo Coverage Results wait-for-android-emulator: description: | Wait for Android emulator to be ready steps: - run: command: | #! /usr/bin/env bash set -xe echo "Waiting for AVD to finish booting" adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82' sleep 15 adb shell settings put global window_animation_scale 0 adb shell settings put global transition_animation_scale 0 adb shell settings put global animator_duration_scale 0 echo "Android Virtual Device is now ready." name: Wait for AVD to be ready no_output_timeout: 5m wait-for-docker-service: description: | Waits for a particular docker service to be up and running parameters: container-name: description: Name of the container to wait for type: string retry-interval: default: 2s description: Interval at which to check whether or not the service is ready type: string timeout: default: 20s description: Total time to wait for the service to be ready type: string url: description: URL to check to determine whether or not service is ready type: string steps: - run: command: | #! /usr/bin/env bash set -e DOCKER_BINARY=${DOCKER_BINARY:-docker} $DOCKER_BINARY container run --network "container:$CONTAINER_NAME" \ docker.io/jwilder/dockerize \ -wait "$URL" \ -wait-retry-interval "$RETRY_INTERVAL" \ -timeout "$TIMEOUT" environment: CONTAINER_NAME: << parameters.container-name >> RETRY_INTERVAL: << parameters.retry-interval >> TIMEOUT: << parameters.timeout >> URL: << parameters.url >> name: Wait for << parameters.container-name >> to be ready write-shared-script: description: | This command writes shared scripts to disk so they can be consumed by other scripts parameters: script: description: The script to write. Should be included here using the include directive. type: string script-dir: default: ../@chiubaka/circleci-orb/scripts description: Path to the directory to write shared scripts to. Relative to project root. type: string script-name: description: Name of the script to write type: string steps: - run: command: | #! /usr/bin/env bash SCRIPT_PATH="$SCRIPT_DIR/$SCRIPT_NAME" mkdir -p "$SCRIPT_DIR" echo "$SCRIPT" > "$SCRIPT_PATH" chmod +x "$SCRIPT_PATH" environment: SCRIPT: << parameters.script >> SCRIPT_DIR: << parameters.script-dir >> SCRIPT_NAME: << parameters.script-name >> name: Write << parameters.script-name >> to disk executors: android: description: | This selects an Android machine image. CircleCI's Android machine images are recommended for Android emulator tests. CircleCI's docker executors don't easily support nested virtualization. machine: image: android:<< parameters.tag >> resource_class: << parameters.resource-class >> parameters: resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum tag: default: 2023.09.1 description: | The Android image tag to use. Choose a tag from https://circleci.com/developer/machine/image/android#image-tags type: string docker-node: description: | Runs node on docker docker: - image: cimg/node:<< parameters.tag >> parameters: resource-class: default: medium description: Resource class to use for Docker type: string tag: default: lts description: | Pick a specific cimg/node image variant: https://hub.docker.com/r/cimg/node/tags type: string resource_class: << parameters.resource-class >> machine: description: | Runs a machine executor configured with NodeJS and docker-compose machine: docker_layer_caching: true image: ubuntu-2004:202010-01 parameters: resource-class: default: medium description: Resource class to use for Docker type: string resource_class: << parameters.resource-class >> macos: description: | MacOS executor for running Apple-specific React Native tasks macos: xcode: << parameters.xcode-version >> parameters: resource-class: default: macos.m1.medium.gen1 description: MacOS executor resource class to use. type: string xcode-version: default: 14.3.1 description: XCode version to use. type: string resource_class: << parameters.resource-class >> jobs: build: description: | Builds the project code using the build script provided by package.json executor: name: docker-node resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-steps: default: [] description: Steps to run as part of setup for this job type: steps yarn-berry: default: false description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - setup: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-steps >> - run: command: yarn run build:ci name: Build code working_directory: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> build-android: description: | Builds Android project code using the script provided by package.json executor: name: android resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps enabled: default: true description: | Whether or not this job should be run. When false the job will pass without doing anything type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-apps-steps: description: | Steps to run in order to initialize Android apps within this repository. Refer to the setup-android-app command, which was designed to setup an individual Android app. This parameter most likely consists of one setup-android-app command per Android app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you. type: steps setup-steps: default: [] description: Additional steps to run as part of setup for this job type: steps yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: not: << parameters.enabled >> steps: - run: command: circleci-agent step halt name: Skip disabled job - setup-android: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-apps-steps >> - steps: << parameters.setup-steps >> - run: command: yarn run build:android:ci name: Build code working_directory: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> build-ios: description: | Builds iOS project code using the script provided by package.json executor: name: macos resource-class: << parameters.resource-class >> xcode-version: << parameters.xcode-version >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps enabled: default: true description: | Whether or not this job should be run. When false the job will pass without doing anything type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: macos.m1.medium.gen1 description: Resource class used for the executor. type: string setup-apps-steps: description: | Steps to run in order to initialize iOS apps within this repository. Refer to the setup-ios-app command, which was designed to setup an individual iOS app. This parameter most likely consists of one setup-ios-app command per iOS app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you. type: steps setup-steps: default: [] description: Additional steps to run as part of setup for this job type: steps xcode-version: default: 14.3.1 description: XCode version to use. type: string yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: not: << parameters.enabled >> steps: - run: command: circleci-agent step halt name: Skip disabled job - setup-macos: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-apps-steps >> - steps: << parameters.setup-steps >> - run: command: yarn run build:ios:ci name: Build code working_directory: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> deploy: description: | Deploys the project (or a subset of packages in a monorepo). executor: name: docker-node resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps configure-git-user: default: false description: Whether or not to ensure that a git user is set before running this job. type: boolean dry-run: default: false description: Whether or not to run a real deploy or just a dry run type: boolean git-user-email: default: circleci@chiubaka.com description: Email of the git user to configure type: string git-user-name: default: CircleCI description: Name of the git user to configure type: string init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean monorepo: default: true description: Whether or not this is a monorepo type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-steps: default: [] description: Steps to run as part of setup for this job type: steps task-name: default: Deploy description: The name of this deploy task to display in the CircleCI UI type: string yarn-berry: default: false description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - setup: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - when: condition: << parameters.configure-git-user >> steps: - run: command: git config --global user.name << parameters.git-user-name >> && git config --global user.email << parameters.git-user-email >> name: Configure git user working_directory: << parameters.app-dir >> - steps: << parameters.setup-steps >> - run: command: | #! /usr/bin/env bash npmrc_path=${NPMRC_PATH:-~/.npmrc} echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> "$npmrc_path" name: Authenticate with NPM - run: command: | #! /usr/bin/env bash npmrc_path=${NPMRC_PATH:-~/.npmrc} echo "//registry.yarnpkg.com/:_authToken=${NPM_TOKEN}" >> "$npmrc_path" name: Authenticate with Yarn - deploy: app-dir: << parameters.app-dir >> dry-run: << parameters.dry-run >> monorepo: << parameters.monorepo >> task-name: << parameters.task-name >> - steps: << parameters.cleanup-steps >> deploy-android: description: | Deploy Android project code using the script provided by package.json executor: name: android resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-apps-steps: description: | Steps to run in order to initialize Android apps within this repository. Refer to the setup-android-app command, which was designed to setup an individual Android app. This parameter most likely consists of one setup-android-app command per Android app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you. type: steps setup-steps: default: [] description: Additional steps to run as part of setup for this job type: steps yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - setup-android: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-apps-steps >> - steps: << parameters.setup-steps >> - deploy-android: app-dir: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> deploy-ios: description: | Builds iOS project code using the script provided by package.json executor: name: macos resource-class: << parameters.resource-class >> xcode-version: << parameters.xcode-version >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: macos.m1.medium.gen1 description: Resource class used for the executor. type: string setup-apps-steps: description: | Steps to run in order to initialize iOS apps within this repository. Refer to the setup-ios-app command, which was designed to setup an individual iOS app. This parameter most likely consists of one setup-ios-app command per iOS app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you. type: steps setup-steps: default: [] description: Additional steps to run as part of setup for this job type: steps xcode-version: default: 14.3.1 description: XCode version to use. type: string yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - setup-macos: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-apps-steps >> - steps: << parameters.setup-steps >> - deploy-ios: app-dir: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> dynamic-setup: description: | Setup job for dynamic configuration. Does some basic setup of the repository and then generates config from a set of expected templates for continuation. Client projects must include a `.circleci/react-native.template.yml` file and a `.circleci/js.template.yml` file. A main.yml file will be generated for continuation using one of these files using the `envsubst` command. React Native templates will be supplied with the following variables: - $IOS_SEMVER_REGEX: a regular expression that matches tags for all iOS-enabled projects - $ANDROID_SEMVER_REGEX: a regular expression that matches tags for all Android-enabled projects - $SETUP_IOS_APPS_STEPS: a list of automatically generated steps for initializing all iOS-enabled projects. This is meant to be used as part of an alias in the `constants` block. See the react-native example for details. - $SETUP_ANDROID_APPS_STEPS: a list of automatically generated steps for initializing all Android-enabled projects. This is meant to be used as part of an alias in the `constants` block. See the react-native example for details. executor: name: docker-node resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: small description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-steps: default: [] description: Steps to run as part of setup for this job type: steps yarn-berry: default: true description: Whether or not to use Yarn berry for package management. type: boolean steps: - setup: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-steps >> - run: command: | #! /usr/bin/env bash MONOREPO_ROOT="${CIRCLE_WORKING_DIRECTORY/#\~/$HOME}" CIRCLECI_ROOT="$MONOREPO_ROOT/.circleci" print_generated_files() { echo "Contents of $CIRCLECI_ROOT/main.yml:" cat "$CIRCLECI_ROOT/main.yml" echo "Contents of $CIRCLECI_ROOT/params.json:" cat "$CIRCLECI_ROOT/params.json" } all_ios_projects=$(yarn nx show projects --with-target run:ios) all_android_projects=$(yarn nx show projects --with-target run:android) { [ -n "$all_ios_projects" ] || [ -n "$all_android_projects" ]; } && react_native=true || react_native=false declare -A all_react_native_projects_map for project in $all_ios_projects; do all_react_native_projects_map[$project]=0 done for project in $all_android_projects; do all_react_native_projects_map[$project]=0 done all_react_native_projects=${!all_react_native_projects_map[*]} # This is a normal JS project! Copy the JS config template and exit. if [ "$react_native" = false ]; then echo "No React Native projects found. Using JS CI template." jq -n "{}" > "$CIRCLECI_ROOT/params.json" envsubst < "$CIRCLECI_ROOT/js.template.yml" > "$CIRCLECI_ROOT/main.yml" print_generated_files exit 0 fi echo "Detected React Native projects. Using React Native CI template." # We should never skip jobs and validations on the primary branch! { [ "$CIRCLE_BRANCH" == "master" ] || [ "$CIRCLE_BRANCH" == "main" ]; } && affected_options="" || affected_options="--affected --base=$NX_BASE --head=$NX_HEAD" [ -n "$(yarn nx show projects $affected_options --with-target build:ios)" ] && build_ios=true || build_ios=false [ -n "$(yarn nx show projects $affected_options --with-target build:android)" ] && build_android=true || build_android=false [ -n "$(yarn nx show projects $affected_options --with-target test:ios)" ] && test_ios=true || test_ios=false [ -n "$(yarn nx show projects $affected_options --with-target test:android)" ] && test_android=true || test_android=false [ -n "$(yarn nx show projects $affected_options --with-target e2e:ios)" ] && e2e_ios=true || e2e_ios=false [ -n "$(yarn nx show projects $affected_options --with-target e2e:android)" ] && e2e_android=true || e2e_android=false ios_semver_regex="/^(${all_ios_projects// /|})-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/" android_semver_regex="/^(${all_android_projects// /|})-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/" # Must use perl to evaluate tag matches because CircleCI regex format is # perl-compatible, but not natively bash-compatible. ios_tag_match=$(echo $CIRCLE_TAG | perl -ne "$ios_semver_regex and print \$1") android_tag_match=$(echo $CIRCLE_TAG | perl -ne "$android_semver_regex and print \$1") # If this is a tag-based deployment, for each platform, if that platform's semver # regex is matched: # 1. The only affected project for this platform is the project referenced in the # tag # 2. All jobs for the affected platform should be enabled if [ -n "$ios_tag_match" ]; then echo "Detected matching iOS project in tag: $ios_tag_match" affected_ios_projects=$ios_tag_match build_ios=true test_ios=true e2e_ios=true else affected_ios_projects=$(yarn nx show projects $affected_options --with-target run:ios) fi if [ -n "$android_tag_match" ]; then echo "Detected matching android project in tag: $android_tag_match" affected_android_projects=$android_tag_match build_android=true test_android=true e2e_android=true else affected_android_projects=$(yarn nx show projects $affected_options --with-target run:android) fi setup_ios_apps_steps="" if [ -n "$affected_ios_projects" ]; then echo "Found affected iOS projects: $affected_ios_projects" for project in $affected_ios_projects; do project_root=$(yarn nx show project $project | jq -r ".root") setup_ios_apps_steps+=" - chiubaka/setup-ios-app: app-dir: $project_root" done else echo "No affected iOS projects" setup_ios_apps_steps=[] fi setup_android_apps_steps="" if [ -n "$affected_android_projects" ]; then echo "Found affected Android projects: $affected_android_projects" for project in $affected_android_projects; do project_root=$(yarn nx show project $project | jq -r ".root") setup_android_apps_steps+=" - chiubaka/setup-android-app: app-dir: $project_root" done else echo "No affected Android projects" setup_android_apps_steps=[] fi declare -A xcode_versions_map for project in $all_ios_projects; do project_root=$(yarn nx show project $project | jq -r ".root") project_xcode_version=$(cat $project_root/.xcode-version) xcode_versions_map[$project_xcode_version]=0 done xcode_versions=("${!xcode_versions_map[@]}") num_xcode_versions=${#xcode_versions[@]} if (( num_xcode_versions == 0 )); then echo "No Xcode versions configured. Will default to Xcode version specified in react-native.template.yml." else xcode_version=${xcode_versions[0]} if (( num_xcode_versions > 1 )); then # shellcheck disable=2145 echo "WARNING: Multiple Xcode versions detected: ${xcode_versions[@]}. Using $xcode_version. Additional versions may incur additional CI execution time as they cannot be pre-installed on the executor." fi fi for project in $all_react_native_projects; do project_root=$(yarn nx show project $project | jq -r ".root") fastlane_env=$project_root/fastlane/Fastlane.env if [ -n "$IOS_SIMULATOR_DEFAULT_DEVICE" ] || [ -n "$IOS_SIMULATOR_DEFAULT_OS" ]; then echo "WARNING: Fastlane environment variables have already been imported. Values will be overwritten and only the last imported set of values will be used. This may occur if you have multiple React Native projects and muliple Fastlane.env files." fi set -o allexport # shellcheck disable=1090 source "$fastlane_env" set +o allexport echo "Imported environment variables from $fastlane_env" done [ -n "$xcode_version" ] && xcode_version="\"$xcode_version\"" || xcode_version=null [ -n "$IOS_SIMULATOR_DEFAULT_DEVICE" ] && ios_simulator_device="\"$IOS_SIMULATOR_DEFAULT_DEVICE\"" || ios_simulator_device=null [ -n "$IOS_SIMULATOR_DEFAULT_VERSION" ] && ios_simulator_version="\"$IOS_SIMULATOR_DEFAULT_VERSION\"" || ios_simulator_version=null [ -n "$ANDROID_EMULATOR_DEFAULT_BUILD_TOOLS_VERSION" ] && android_emulator_build_tools_version="\"$ANDROID_EMULATOR_DEFAULT_BUILD_TOOLS_VERSION\"" || android_emulator_build_tools_version=null [ -n "$ANDROID_EMULATOR_DEFAULT_PLATFORM_VERSION" ] && android_emulator_platform_version="\"$ANDROID_EMULATOR_DEFAULT_PLATFORM_VERSION\"" || android_emulator_platform_version=null jq -n \ "{ \ \"xcode-version\": $xcode_version, \ \"ios-simulator-device\": $ios_simulator_device, \ \"ios-simulator-version\": $ios_simulator_version, \ \"android-emulator-build-tools-version\": $android_emulator_build_tools_version, \ \"android-emulator-platform-version\": $android_emulator_platform_version, \ \"build-ios\": $build_ios, \ \"build-android\": $build_android, \ \"test-ios\": $test_ios, \ \"test-android\": $test_android, \ \"e2e-ios\": $e2e_ios, \ \"e2e-android\": $e2e_android, \ }" > "$CIRCLECI_ROOT/params.json" IOS_SEMVER_REGEX=$ios_semver_regex \ ANDROID_SEMVER_REGEX=$android_semver_regex \ SETUP_IOS_APPS_STEPS=$setup_ios_apps_steps \ SETUP_ANDROID_APPS_STEPS=$setup_android_apps_steps \ envsubst < "$CIRCLECI_ROOT/react-native.template.yml" > "$CIRCLECI_ROOT/main.yml" print_generated_files name: Generate .circleci/main.yml and .circleci/params.json - steps: << parameters.cleanup-steps >> - continuation/continue: configuration_path: .circleci/main.yml parameters: .circleci/params.json e2e: description: | Runs the project E2E tests using the E2E script provided by package.json executor: name: docker-node resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps configure-git-user: default: false description: Whether or not to ensure that a git user is set before running this job. type: boolean docker-compose: default: false description: Whether or not to run docker-compose as part of testing setup type: boolean git-user-email: default: circleci@chiubaka.com description: Email of the git user to configure type: string git-user-name: default: CircleCI description: Name of the git user to configure type: string init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean monorepo: default: true description: Whether or not this repo is a monorepo type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-steps: default: [] description: Steps to run as part of setup for this job type: steps wait-for-docker-services: default: [] description: Steps to run to verify that docker services are all ready. Pair with wait-for-docker-service command. type: steps yarn-berry: default: false description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: << parameters.docker-compose >> steps: - setup-machine - setup: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-steps >> - when: condition: << parameters.docker-compose >> steps: - compose-docker: app-dir: << parameters.app-dir >> wait-for-services: << parameters.wait-for-docker-services >> - when: condition: << parameters.configure-git-user >> steps: - run: command: git config --global user.name << parameters.git-user-name >> && git config --global user.email << parameters.git-user-email >> name: Configure git user working_directory: << parameters.app-dir >> - run: command: yarn run e2e:ci name: Run E2E tests working_directory: << parameters.app-dir >> - when: condition: not: << parameters.monorepo >> steps: - codecov/upload - when: condition: << parameters.monorepo >> steps: - upload-monorepo-coverage: app-dir: << parameters.app-dir >> - store_test_results: path: << parameters.app-dir >>/reports/ - store_artifacts: path: << parameters.app-dir >>/reports/ - steps: << parameters.cleanup-steps >> e2e-android: description: | Run Android project E2E tests using the script provided by package.json executor: name: android resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string build-tools-version: default: 34.0.0 description: The version of the Android build tools to install. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps enabled: default: true description: | Whether or not this job should be run. When false the job will pass without doing anything type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean platform-version: default: android-34 description: The platform version to use for the AVD type: string resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-apps-steps: description: | Steps to run in order to initialize Android apps within this repository. Refer to the setup-android-app command, which was designed to setup an individual Android app. This parameter most likely consists of one setup-android-app command per Android app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you. type: steps setup-steps: default: [] description: Additional steps to run as part of setup for this job type: steps yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: not: << parameters.enabled >> steps: - run: command: circleci-agent step halt name: Skip disabled job - setup-android: app-dir: << parameters.app-dir >> build-tools-version: << parameters.build-tools-version >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> platform-version: << parameters.platform-version >> with-emulator: true yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-apps-steps >> - steps: << parameters.setup-steps >> - run: command: yarn run e2e:android:ci name: Run E2E tests working_directory: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> e2e-ios: description: | Run iOS project E2E tests using the script provided by package.json executor: name: macos resource-class: << parameters.resource-class >> xcode-version: << parameters.xcode-version >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps enabled: default: true description: | Whether or not this job should be run. When false the job will pass without doing anything type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: macos.m1.medium.gen1 description: Resource class used for the executor. type: string setup-apps-steps: description: | Steps to run in order to initialize iOS apps within this repository. Refer to the setup-ios-app command, which was designed to setup an individual iOS app. This parameter most likely consists of one setup-ios-app command per iOS app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you. type: steps setup-steps: default: [] description: Additional steps to run as part of setup for this job type: steps simulator-device: default: iPhone 14 description: The simulator device name to use (e.g. iPhone 14) type: string simulator-version: default: "16.4" description: The simulator OS version to use (e.g. 16.4) type: string xcode-version: default: 14.3.1 description: XCode version to use. type: string yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: not: << parameters.enabled >> steps: - run: command: circleci-agent step halt name: Skip disabled job - setup-macos: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> simulator-device: << parameters.simulator-device >> simulator-version: << parameters.simulator-version >> with-simulator: true yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-apps-steps >> - steps: << parameters.setup-steps >> - run: command: yarn run e2e:ios:ci name: Run tests working_directory: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> lint: description: | Lints the project code using the lint script provided by package.json executor: name: docker-node resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-steps: default: [] description: Steps to run as part of setup for this job type: steps yarn-berry: default: false description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - setup: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-steps >> - run: command: yarn run lint:ci name: Lint code working_directory: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> test: description: | Tests the project code using the test script provided by package.json executor: name: docker-node resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps configure-git-user: default: false description: Whether or not to ensure that a git user is set before running this job. type: boolean docker-compose: default: false description: Whether or not to run docker-compose as part of testing setup type: boolean git-user-email: default: circleci@chiubaka.com description: Email of the git user to configure type: string git-user-name: default: CircleCI description: Name of the git user to configure type: string init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean monorepo: default: true description: Whether or not this repo is a monorepo type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-steps: default: [] description: Steps to run as part of setup for this job type: steps wait-for-docker-services: default: [] description: Steps to run to verify that docker services are all ready. Pair with wait-for-docker-service command. type: steps yarn-berry: default: false description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: << parameters.docker-compose >> steps: - setup-machine - setup: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-steps >> - when: condition: << parameters.docker-compose >> steps: - compose-docker: app-dir: << parameters.app-dir >> wait-for-services: << parameters.wait-for-docker-services >> - when: condition: << parameters.configure-git-user >> steps: - run: command: git config --global user.name << parameters.git-user-name >> && git config --global user.email << parameters.git-user-email >> name: Configure git user working_directory: << parameters.app-dir >> - run: command: yarn run test:ci name: Run tests working_directory: << parameters.app-dir >> - when: condition: not: << parameters.monorepo >> steps: - codecov/upload - when: condition: << parameters.monorepo >> steps: - upload-monorepo-coverage: app-dir: << parameters.app-dir >> - store_test_results: path: << parameters.app-dir >>/reports/ - store_artifacts: path: << parameters.app-dir >>/reports/ - steps: << parameters.cleanup-steps >> test-android: description: | Test Android project code using the script provided by package.json executor: name: android resource-class: << parameters.resource-class >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps enabled: default: true description: | Whether or not this job should be run. When false the job will pass without doing anything type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: medium description: Resource class used for the executor. enum: - small - medium - medium+ - large - xlarge - 2xlarge - 2xlarge+ type: enum setup-apps-steps: description: | Steps to run in order to initialize Android apps within this repository. Refer to the setup-android-app command, which was designed to setup an individual Android app. This parameter most likely consists of one setup-android-app command per Android app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you. type: steps setup-steps: default: [] description: Additional steps to run as part of setup for this job type: steps yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: not: << parameters.enabled >> steps: - run: command: circleci-agent step halt name: Skip disabled job - setup-android: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-apps-steps >> - steps: << parameters.setup-steps >> - run: command: yarn run test:android:ci name: Run tests working_directory: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> test-ios: description: | Test iOS project code using the script provided by package.json executor: name: macos resource-class: << parameters.resource-class >> xcode-version: << parameters.xcode-version >> parameters: app-dir: default: . description: Path to the directory containing your package.json file. Not needed if package.json lives in the root. type: string cleanup-steps: default: [] description: Steps to run as part of cleanup for this job type: steps enabled: default: true description: | Whether or not this job should be run. When false the job will pass without doing anything type: boolean init-submodules: default: false description: Whether or not to initialize submodules included in this repository. type: boolean nx-affected: default: true description: Whether or not to set up environment variables for `nx affected`. type: boolean resource-class: default: macos.m1.medium.gen1 description: Resource class used for the executor. type: string setup-apps-steps: description: | Steps to run in order to initialize iOS apps within this repository. Refer to the setup-ios-app command, which was designed to setup an individual iOS app. This parameter most likely consists of one setup-ios-app command per iOS app in this repository. If using chiubaka/dynamic-setup, this parameter can be generated for you. type: steps setup-steps: default: [] description: Additional steps to run as part of setup for this job type: steps simulator-device: default: iPhone 14 description: The simulator device name to use (e.g. iPhone 14) type: string simulator-version: default: "16.4" description: The simulator OS version to use (e.g. 16.4) type: string xcode-version: default: 14.3.1 description: XCode version to use. type: string yarn-berry: default: true description: Whether or not to use Yarn berry for package management. Defaults to Yarn v1. type: boolean steps: - when: condition: not: << parameters.enabled >> steps: - run: command: circleci-agent step halt name: Skip disabled job - setup-macos: app-dir: << parameters.app-dir >> init-submodules: << parameters.init-submodules >> nx-affected: << parameters.nx-affected >> simulator-device: << parameters.simulator-device >> simulator-version: << parameters.simulator-version >> with-simulator: true yarn-berry: << parameters.yarn-berry >> - steps: << parameters.setup-apps-steps >> - steps: << parameters.setup-steps >> - run: command: yarn run test:ios:ci name: Run tests working_directory: << parameters.app-dir >> - steps: << parameters.cleanup-steps >> examples: dynamic-setup: description: | Using dynamic configuration to generate a continuation config based off of a template. usage: version: "2.1" setup: true orbs: chiubaka: chiubaka/circleci-orb@dev:alpha workflows: dynamic-setup: jobs: - chiubaka/dynamic-setup js: description: | A basic lint, build, test, and deploy example for a JavaScript-only project. usage: version: "2.1" orbs: chiubaka: chiubaka/circleci-orb@0.11.4 workflows: lint-build-test-deploy: jobs: - chiubaka/lint: filters: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: lint - chiubaka/build: filters: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build - chiubaka/test: configure-git-user: true filters: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test - chiubaka/deploy: context: - npm-publishing filters: branches: ignore: /.*/ name: deploy requires: - lint - build - test react-native: description: | A basic lint, build, test, and deploy example for a React Native project usage: version: "2.1" orbs: chiubaka: chiubaka/circleci-orb@dev:alpha workflows: react-native-build-test-e2e-deploy: jobs: - chiubaka/lint: filter: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: lint - chiubaka/build: filter: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build - chiubaka/test: filter: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test - chiubaka/e2e: filter: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: e2e requires: - build - chiubaka/deploy: filter: branches: ignore: /.*/ name: deploy requires: - build - test - e2e - chiubaka/build-android: enabled: << pipeline.parameters.build-android >> filter: tags: only: /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build-android requires: - build setup-apps-steps: - chiubaka/setup-android-app: app-dir: apps/kagami - chiubaka/build-ios: enabled: << pipeline.parameters.build-ios >> filter: tags: only: /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build-ios requires: - build setup-apps-steps: - chiubaka/setup-ios-app: app-dir: apps/kagami - chiubaka/test-android: enabled: << pipeline.parameters.test-android >> filter: tags: only: /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test-android requires: - build - build-android - test - e2e setup-apps-steps: - chiubaka/setup-android-app: app-dir: apps/kagami - chiubaka/test-ios: enabled: << pipeline.parameters.test-ios >> filter: tags: only: /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test-ios requires: - build - build-ios - test - e2e setup-apps-steps: - chiubaka/setup-ios-app: app-dir: apps/kagami - chiubaka/e2e-android: enabled: << pipeline.parameters.e2e-android >> filter: tags: only: /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: e2e-android requires: - build-android - test-android setup-apps-steps: - chiubaka/setup-android-app: app-dir: apps/kagami - chiubaka/e2e-ios: enabled: << pipeline.parameters.e2e-ios >> filter: tags: only: /^(kagami)-v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: e2e-ios requires: - build-ios - test-ios setup-apps-steps: - chiubaka/setup-ios-app: app-dir: apps/kagami - chiubaka/deploy-android: enabled: << pipeline.parameters.deploy-android >> filters: branches: ignore: /.*/ name: deploy-android requires: - e2e-android setup-apps-steps: - chiubaka/setup-android-app: app-dir: apps/kagami - chiubaka/deploy-ios: enabled: << pipeline.parameters.deploy-ios >> filters: branches: ignore: /.*/ name: deploy-ios requires: - e2e-ios setup-apps-steps: - chiubaka/setup-ios-app: app-dir: apps/kagami when: << pipeline.parameters.react-native >> react-native-template: description: | A sample template config for React Native to be used in combination with chiubaka/dynamic-setup. Environment variables will be substituted for dynamic values using the `envsubst` command. usage: version: "2.1" orbs: chiubaka: chiubaka/circleci-orb@dev:alpha workflows: lint-build-test-e2e-deploy: jobs: - chiubaka/lint: filters: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: lint - chiubaka/build: filters: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: build - chiubaka/test: filters: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: test - chiubaka/e2e: filters: tags: only: /^(\w+-)+v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ name: e2e requires: - build - chiubaka/deploy: filters: branches: ignore: /.*/ name: deploy requires: - build - test - e2e - chiubaka/build-android: build-tools-version: << pipeline.parameters.android-emulator-build-tools-version >> enabled: << pipeline.parameters.build-android >> filters: tags: only: $ANDROID_SEMVER_REGEX name: build-android platform-version: << pipeline.parameters.android-emulator-platform-version >> requires: - build setup-apps-steps: $SETUP_ANDROID_APPS_STEPS - chiubaka/build-ios: context: - ios-deployment enabled: << pipeline.parameters.build-ios >> filters: tags: only: $ANDROID_SEMVER_REGEX name: build-ios requires: - build setup-apps-steps: $SETUP_IOS_APPS_STEPS simulator-device: << pipeline.parameters.ios-simulator-device >> simulator-version: << pipeline.parameters.ios-simulator-version >> xcode-version: << pipeline.parameters.xcode-version >> - chiubaka/test-android: build-tools-version: << pipeline.parameters.android-emulator-build-tools-version >> enabled: << pipeline.parameters.test-android >> filters: tags: only: $ANDROID_SEMVER_REGEX name: test-android platform-version: << pipeline.parameters.android-emulator-platform-version >> requires: - build - build-android - test - e2e setup-apps-steps: $SETUP_ANDROID_APPS_STEPS - chiubaka/test-ios: context: - ios-deployment enabled: << pipeline.parameters.test-ios >> filters: tags: only: $ANDROID_SEMVER_REGEX name: test-ios requires: - build - build-ios - test - e2e setup-apps-steps: $SETUP_IOS_APPS_STEPS simulator-device: << pipeline.parameters.ios-simulator-device >> simulator-version: << pipeline.parameters.ios-simulator-version >> xcode-version: << pipeline.parameters.xcode-version >> - chiubaka/e2e-android: build-tools-version: << pipeline.parameters.android-emulator-build-tools-version >> enabled: << pipeline.parameters.e2e-android >> filters: tags: only: $ANDROID_SEMVER_REGEX name: e2e-android platform-version: << pipeline.parameters.android-emulator-platform-version >> requires: - build-android - test-android setup-apps-steps: $SETUP_ANDROID_APPS_STEPS - chiubaka/e2e-ios: context: - ios-deployment enabled: << pipeline.parameters.e2e-ios >> filters: tags: only: $ANDROID_SEMVER_REGEX name: e2e-ios requires: - build-ios - test-ios setup-apps-steps: $SETUP_IOS_APPS_STEPS simulator-device: << pipeline.parameters.ios-simulator-device >> simulator-version: << pipeline.parameters.ios-simulator-version >> xcode-version: << pipeline.parameters.xcode-version >> - chiubaka/deploy-android: build-tools-version: << pipeline.parameters.android-emulator-build-tools-version >> filters: branches: ignore: /.*/ name: deploy-android platform-version: << pipeline.parameters.android-emulator-platform-version >> requires: - e2e-android setup-apps-steps: $SETUP_ANDROID_APPS_STEPS - chiubaka/deploy-ios: context: - ios-deployment filters: branches: ignore: /.*/ name: deploy-ios requires: - e2e-ios setup-apps-steps: $SETUP_IOS_APPS_STEPS simulator-device: << pipeline.parameters.ios-simulator-device >> simulator-version: << pipeline.parameters.ios-simulator-version >> xcode-version: << pipeline.parameters.xcode-version >>
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.