Skip to content

Commit

Permalink
feat: add Maestro recipe (#92)
Browse files Browse the repository at this point in the history
* feat: add Maestro recipe

* update readme with maestro recipe

* move BuildMode to build recipe

* change build mode to enum

* lower timeouts
  • Loading branch information
km1chno authored Sep 13, 2024
1 parent d35c96c commit 4a125e7
Show file tree
Hide file tree
Showing 15 changed files with 829 additions and 111 deletions.
7 changes: 5 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ The following are **feature flags** that can be used with `--preset` flag (they
<td style="vertical-align: middle;">--detox</td>
<td style="vertical-align: middle;">Generate workflow to run Detox e2e tests on every PR</td>
</tr>
<tr>
<td style="vertical-align: middle;">--maestro</td>
<td style="vertical-align: middle;">Generate workflow to run Maestro e2e tests on every PR</td>
</tr>
</table>

## 🔐 Repository secrets
Expand Down Expand Up @@ -113,7 +117,7 @@ the maintainers directly.
## 🚸 Roadmap

- [ ] Build Expo DevClient when fingerprint changes
- [ ] Maestro support for E2E tests
- [x] Maestro support for E2E tests
- [ ] Different workflows for different branches (ex. PR, main, release)
- [ ] Upload source maps to Sentry
- [ ] Handle different vendors
Expand All @@ -128,7 +132,6 @@ This project has been built and is maintained thanks to the support from [Softwa

[![swm](https://logo.swmansion.com/logo?color=white&variant=desktop&width=150&tag=react-native-reanimated-github 'Software Mansion')](https://swmansion.com)


## React Native CI CLI is created by Software Mansion

Since 2012 [Software Mansion](https://swmansion.com) 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](https://swmansion.com/contact/projects?utm_source=reanimated&utm_medium=readme).
11 changes: 10 additions & 1 deletion src/commands/react-native-ci-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import typescriptCheck from '../recipes/typescript'
import prettierCheck from '../recipes/prettier'
import easUpdate from '../recipes/eas-update'
import detox from '../recipes/detox'
import maestro from '../recipes/maestro'
import isGitDirty from 'is-git-dirty'
import sequentialPromiseMap from '../utils/sequentialPromiseMap'
import { CycliRecipe, CycliToolbox, ProjectContext } from '../types'
Expand All @@ -27,7 +28,15 @@ export type CycliCommand = GluegunCommand & {
featureOptions: Option[]
}

const RECIPES = [lint, jest, typescriptCheck, prettierCheck, easUpdate, detox]
const RECIPES = [
lint,
jest,
typescriptCheck,
prettierCheck,
easUpdate,
detox,
maestro,
]

const getSelectedOptions = async (toolbox: CycliToolbox): Promise<string[]> => {
if (toolbox.options.isPreset()) {
Expand Down
20 changes: 20 additions & 0 deletions src/extensions/projectConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,32 @@ module.exports = (toolbox: CycliToolbox) => {
return packageJson().name
}

const getAppId = (): string | undefined => {
let appId = appJson()?.expo?.android?.package

// If no appId was found in app.json, try to obtain it from native Android code.
if (!appId) {
const buildGradlePath = join('android', 'app', 'build.gradle')
appId = filesystem
.read(buildGradlePath)
?.split('\n')
.find((line) => line.includes('applicationId'))
?.trim()
.split(' ')[1]
.replace(/"/g, '')
}

return appId
}

toolbox.projectConfig = {
packageJson,
appJsonFile,
appJson,
nodeVersionFile,
isExpo,
getName,
getAppId,
}
}

Expand All @@ -115,5 +134,6 @@ export interface ProjectConfigExtension {
nodeVersionFile: (context: ProjectContext) => string
isExpo: () => boolean
getName: () => string
getAppId: () => string | undefined
}
}
6 changes: 4 additions & 2 deletions src/extensions/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = (toolbox: CycliToolbox) => {
template: string,
context: ProjectContext,
props: Record<string, string> = {}
) => {
): Promise<string> => {
const pathRelativeToRoot = context.path.relFromRepoRoot(
context.path.packageRoot
)
Expand Down Expand Up @@ -48,6 +48,8 @@ module.exports = (toolbox: CycliToolbox) => {
toolbox.filesystem.write(target, workflowString)

toolbox.interactive.step(`Created ${workflowFileName} workflow file.`)

return workflowFileName
}

toolbox.workflows = { generate }
Expand All @@ -59,6 +61,6 @@ export interface WorkflowsExtension {
template: string,
context: ProjectContext,
props?: Record<string, string>
) => Promise<void>
) => Promise<string>
}
}
103 changes: 0 additions & 103 deletions src/recipes/build-release.ts

This file was deleted.

Loading

0 comments on commit 4a125e7

Please sign in to comment.