Skip to content

wcastand/react-native-ci-cli

 
 

Repository files navigation

🤔 Why?

React Native CI CLI is meant to simplify CI/CD setup in your React Native project.

📖 Usage

Simply go to your project root directory and run:

npx setup-ci

If your project has a monorepo structure, run the script from the root directory of the app for which you want to set up workflows.

💡 Demo

Say we want to set up GitHub actions that run ESLint check and Jest tests on our project every time we create or push to an existing Pull Request. Let's try to use react-native-ci-cli to do the heavy lifting and generate all the necessary configurations.

Alternatively, we can go fully automatic by passing flags --preset --lint --jest to avoid all interaction with the script. You can check the section below for more information about available flags!

⚙️ Features

  • Currently, only GitHub actions are supported as your CI.
  • npm and yarn are supported as package managers, and they will be detected automatically.
  • Monorepo structure is supported, but make sure you run the script from the app directory, not the monorepo root.

When using react-native-ci-cli, you can provide additional flags to modify its default behavior.

Flag Description
--preset Run the script with your own preset. Combine it with feature flags to specify what workflows you want to generate.
--skip-git-check By default, the script will prompt the user if there are uncommitted changes in the working repository. Use this flag to proceed without asking.

The following are feature flags that can be used with --preset flag (they are ignored if --preset is not provided).

Flag Description
--lint Generate ESLint workflow to run on every PR
--jest Generate Jest workflow to run on every PR
--ts Generate Typescript check workflow to run on every PR
--prettier Generate Prettier check workflow to run on every PR
--eas-update Generate EAS Update and preview workflow to run on every PR (Expo projects only)
--detox Generate workflow to run Detox e2e tests on every PR

🔐 Repository secrets

Some workflows generated by react-native-ci-cli require setting up repository secrets that can be then accessed by workflows as ${{ secrets.* }}. Make sure to read logs printed by the script as you will always be prompted to create secrets if necessary. The following table shows a summary of secrets you might have to create for generated workflows to work properly.

Secret Description
EXPO_TOKEN Used for authentication in workflows using your Expo account. Learn more at Expo with GitHub actions.

💬 Your feedback

This tool is supposed to be helpful to as many developers as possible - and therefore we are open to your ideas and general feedback! If you want to share your opinion about react-native-ci-cli or have some thoughts about how it could be further developed, don't hesitate to create an issue or contact the maintainers directly.

🚸 Roadmap

  • Build Expo DevClient when fingerprint changes
  • Maestro support for E2E tests
  • Different workflows for different branches (ex. PR, main, release)
  • Upload source maps to Sentry
  • Handle different vendors

📋 License

React Native CI CLI is licensed under The MIT License.

💸 Credits

This project has been built and is maintained thanks to the support from Software Mansion

swm

React Native CI CLI is created by Software Mansion

Since 2012 Software Mansion is a software agency with experience in building web and mobile apps. We are Core React Native Contributors and experts in dealing with all kinds of React Native issues. We can help you build your next dream product – Hire us.

About

CLI to spin your CI/CD for react-native!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.0%
  • EJS 4.1%
  • JavaScript 1.9%