Commit b459cd62 authored by Mark Harding's avatar Mark Harding
Browse files

(test): circle ci

parent 716df031
Loading
Loading
Loading
Loading

.circleci/config.yml

0 → 100644
+149 −0
Original line number Original line Diff line number Diff line
version: 2
jobs:
  node:
    working_directory: ~/mobile-native
    docker:
      - image: circleci/node:10
    steps:
      - checkout

      - restore_cache:
          key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}

      - restore_cache:
          key: node-v1-{{ checksum "package.json" }}-{{ arch }}

      - run: yarn install

      - save_cache:
          key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
          paths:
            - ~/.cache/yarn

      - save_cache:
          key: node-v1-{{ checksum "package.json" }}-{{ arch }}
          paths:
            - node_modules

      - run:
          name: jest tests
          command: |
            mkdir -p test-results/jest
            yarn run test --maxWorkers=2
          environment:
            JEST_JUNIT_OUTPUT: test-results/jest/junit.xml

      - persist_to_workspace:
          root: ~/mobile-native
          paths:
            - node_modules

      - store_test_results:
          path: test-results

      - store_artifacts:
          path: test-results
  
  ios:
    macos:
      xcode: "10.1"
    working_directory: ~/mobile-native

    # use a --login shell so our "set Ruby version" command gets picked up for later steps
    shell: /bin/bash --login -o pipefail

    steps:
      - checkout

      - run:
          name: set Ruby version
          command:  echo "ruby-2.4" > ~/.ruby-version

      - restore_cache:
          key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}

      - restore_cache:
          key: node-v1-{{ checksum "package.json" }}-{{ arch }}

      # not using a workspace here as Node and Yarn versions
      # differ between our macOS executor image and the Docker containers above
      - run: yarn install

      - save_cache:
          key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
          paths:
            - ~/.cache/yarn

      - save_cache:
          key: node-v1-{{ checksum "package.json" }}-{{ arch }}
          paths:
            - node_modules

      - restore_cache:
          key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}

      - run:
          command: gem update --system && gem install bundler && bundle install
          working_directory: ios

      - save_cache:
          key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}-{{ arch }}
          paths:
            - vendor/bundle

      ### TODO- get tests running with fastlane

      #- run:
      #    command: bundle exec fastlane test
      #    working_directory: ios

      #- run:
      #    name: set up test results
      #    working_directory: ios
      #    when: always
      #    command: |
      #      mkdir -p test-results/fastlane test-results/xcode
      #      mv fastlane/report.xml test-results/fastlane
      #      mv fastlane/test_output/report.junit test-results/xcode/junit.xml
      #- store_test_results:
      #    path: ios/test-results

      #- store_artifacts:
      #    path: ios/test-results

      - run: 
          name: Build release .ipa
          command: fastlane buildrelease
          working_directory: ios
          branches:
            only:
              - /stable-*/
              - /release-*/
              - test/circle-ci

      - run: 
          name: Upload to crashalytics 
          command: echo "TODO"
          working_directory: ios
          branches:
            only:
              - /release-*/

      - run:
          name: Upload to Testflight release
          command: fastlane testflight
          working_directory: ios
          branches:
            only:
              - /stable-*/
              - /release-*/
              - test/circle-ci

workflows:
  version: 2
  node-ios:
    jobs:
      - node
      - ios:
          requires:
            - node
+8 −13
Original line number Original line Diff line number Diff line
@@ -21,8 +21,8 @@ test_spec:
  tags:
  tags:
    - docker
    - docker


build:
build_android:
  image: reactnativecommunity/react-native-android
  image: circleci/android:api-28-node
  stage: build
  stage: build
  cache:
  cache:
    key: ${CI_COMMIT_REF_SLUG}
    key: ${CI_COMMIT_REF_SLUG}
@@ -30,18 +30,12 @@ build:
      - .gradle/wrapper
      - .gradle/wrapper
      - .gradle/caches
      - .gradle/caches
      - node_modules/
      - node_modules/
  before_script:
      - android/vendor/bundle
    - echo 999999 > /proc/sys/fs/inotify/max_user_instances
    - echo 999999 > /proc/sys/fs/inotify/max_user_watches
    - echo 999999 > /proc/sys/fs/inotify/max_queued_events
    - echo $ANDROID_KEYSTORE | base64 --decode > android/app/minds.keystore
    - echo "MYAPP_RELEASE_STORE_PASSWORD=${KEYSTORE_PASSWORD}" >> ./android/gradle.properties
    - echo "MYAPP_RELEASE_KEY_PASSWORD=${KEYSTORE_PASSWORD}" >> ./android/gradle.properties

  script:
  script:
    - yarn install
    - yarn install
    - cd android && chmod +x gradlew
    - cd android
    - ./gradlew assembleRelease
    - bundle install
    - fastlane assemble_build
    - cp app/build/outputs/apk/release/app-release.apk ../Minds.apk
    - cp app/build/outputs/apk/release/app-release.apk ../Minds.apk
  artifacts:
  artifacts:
    name: "Minds APK"
    name: "Minds APK"
@@ -68,7 +62,8 @@ test_e2e:
  tags:
  tags:
    - docker
    - docker
  dependencies:
  dependencies:
    - build
    - build_android
  only:
  only:
    variables:
    variables:
      - $CI_PROJECT_NAMESPACE == "minds"
      - $CI_PROJECT_NAMESPACE == "minds"
  allow_failure: true
+24 −1
Original line number Original line Diff line number Diff line
# Minds Mobile Apps
# Minds Mobile Apps


## Branch Structure

| Branch    |                                                                                                                                    |
|-----------|------------------------------------------------------------------------------------------------------------------------------------|
| master    | Approved code ready to merged into the next stable release. All tests should pass and be in a 'ready' state                        |
| stable/*  | Stable builds, inherited from `release/*` branches. Fastlane automatically deploys these builds.                                   |
| release/* | WIP builds. Run `fastlane run increment_version_number` upon creating the branch.                                                  |
| feat/*    | New branches should be made for each Gitlab issue. Merge requests should be opened pointing towards the respective release branch. |

## Increasing the version number

### Patch

`fastlane run increment_version_number bump_type:patch`

### Minor

`fastlane run increment_version_number bump_type:minor`

### Major

`fastlane run increment_version_number bump_type:major`

## Platforms
## Platforms


- iOS
- iOS

android/.gitignore

0 → 100644
+14 −0
Original line number Original line Diff line number Diff line
# fastlane specific
fastlane/report.xml

# deliver temporary files
fastlane/Preview.html

# snapshot generated screenshots
fastlane/screenshots

# scan temporary files
fastlane/test_output

# Fastlane builds
builds/*

android/Gemfile

0 → 100644
+3 −0
Original line number Original line Diff line number Diff line
source "https://rubygems.org"

gem "fastlane"
Loading