0
0
React Nativemobile~20 mins

CI/CD pipeline setup in React Native - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
React Native CI/CD Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Output of a basic React Native build command in CI
What is the expected output snippet when running npx react-native run-android --variant=release in a CI environment after a successful build?
React Native
npx react-native run-android --variant=release
ABUILD SUCCESSFUL in 45s\n3 actionable tasks: 3 executed\nInstalling APK on device\nStarting the app
BBUILD FAILED\nExecution failed for task ':app:compileDebugJavaWithJavac'.
CError: Could not find an installed version of Gradle
DCommand not found: npx
Attempts:
2 left
💡 Hint
Look for messages indicating a successful build and app installation.
Configuration
intermediate
2:00remaining
Correct GitHub Actions step to cache React Native dependencies
Which GitHub Actions step correctly caches node_modules and ~/.gradle folders to speed up React Native CI builds?
A- name: Cache Gradle\n uses: actions/cache@v3\n with:\n path: ~/.gradle\n key: gradle-cache-${{ runner.os }}
B- name: Cache dependencies\n uses: actions/cache@v2\n with:\n path: node_modules\n key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
C
- name: Cache node modules and Gradle\n  uses: actions/cache@v3\n  with:\n    path: |
      node_modules
      ~/.gradle
    key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
D- name: Cache all files\n uses: actions/cache@v3\n with:\n path: .\n key: full-cache-${{ runner.os }}
Attempts:
2 left
💡 Hint
Caching both node_modules and Gradle folders together with a proper key is best.
🔀 Workflow
advanced
2:30remaining
Correct order of steps in a React Native CI/CD pipeline
Arrange the following steps in the correct order for a React Native CI/CD pipeline on Android:
A2,3,1,4
B3,2,1,4
C1,2,3,4
D2,1,3,4
Attempts:
2 left
💡 Hint
You must install dependencies before testing and building.
Troubleshoot
advanced
2:00remaining
Diagnosing a failed React Native Android build in CI
A CI build fails with the error: Execution failed for task ':app:mergeReleaseResources'. What is the most likely cause?
AMissing or conflicting resource files in the Android project
BNode.js version is too old
CGradle daemon is not running
DIncorrect React Native version in package.json
Attempts:
2 left
💡 Hint
The error relates to merging resources, not Node.js or React Native versions.
Best Practice
expert
2:30remaining
Best practice for securing secrets in React Native CI/CD pipelines
Which method is the best practice to securely manage API keys and secrets in a React Native CI/CD pipeline?
AWrite secrets in plain text in the CI pipeline YAML file
BStore secrets in environment variables configured in the CI platform and inject them at build time
CSave secrets in a public JSON file included in the app bundle
DHardcode secrets in the React Native source code and commit to the repository
Attempts:
2 left
💡 Hint
Secrets should never be committed to source code or exposed publicly.