Skip to content

Instantly share code, notes, and snippets.

@pftg
Created March 6, 2020 07:24
Show Gist options
  • Save pftg/24b3568d6cb253b0fcf9c953cac795ea to your computer and use it in GitHub Desktop.
Save pftg/24b3568d6cb253b0fcf9c953cac795ea to your computer and use it in GitHub Desktop.
CirclecCI config to support React Native development. Run tests and verify builds of androdi
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
# https://circleci.com/docs/2.0/configuration-reference
version: 2
jobs:
android:
working_directory: ~/project/android
docker:
- image: circleci/android:api-29-node
steps:
- checkout:
path: ~/project
- attach_workspace:
at: ~/project
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Build debug APK and release APK
command: |
(cd .. && ./node_modules/.bin/jetifier)
./gradlew :app:bundleRelease
- run:
name: Run Tests
command: ./gradlew test
test:
docker:
- image: circleci/node:10-browsers
steps:
- checkout
- restore_cache:
keys:
- yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-packages-v1-{{ .Branch }}-
- yarn-packages-v1-
- run:
name: Yarn install
command: yarn install
- save_cache:
paths:
- ~/.cache/yarn
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run:
name: Jest Tests with coverage
command: |
yarn test --ci --runInBand --reporters=default --reporters=jest-junit --coverage --coverageDirectory=reports/coverage
environment:
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
- store_artifacts:
path: reports/coverage
- persist_to_workspace:
root: ~/project
paths:
- node_modules
workflows:
version: 2
build_and_test:
jobs:
- test
- approve_android_build:
type: approval
requires:
- test
filters:
branches:
only:
- master
- production
- staging
- develop
- android:
requires:
- approve_android_build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment