config.yml 4.3 KB
Newer Older
1 2
version: 2

J
Jose Alcérreca 已提交
3 4
config_android: &config_android
  docker:
5
    - image: circleci/android:api-29
J
Jose Alcérreca 已提交
6 7 8 9 10
      environment:
        JAVA_TOOL_OPTIONS: "-Xmx1024m"
        GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2 -Dkotlin.incremental=false"
        TERM: dumb
  working_directory: ~/project
11

J
Jose Alcérreca 已提交
12 13 14 15 16 17
setup_ftl: &setup_ftl
  name: Authorize gcloud and set config defaults
  command: |
    echo $GCLOUD_SERVICE_KEY | base64 -di > ${HOME}/gcloud-service-key.json
    sudo gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
    sudo gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
18 19

download_results: &download_results
J
Jose Alcérreca 已提交
20 21 22 23 24
  name: Install gsutil dependency and copy test results data
  command: |
    BUCKETNAME=${PROJECT_DIR:0:29} # limit length
    sudo pip install -U crcmod
    sudo gsutil -m cp -r -U `sudo gsutil ls gs://cloud-test-${GOOGLE_PROJECT_ID}-arch-${BUCKETNAME,,}/ | tail -1` ${CIRCLE_ARTIFACTS}/ | true
25 26

test_sample: &test_sample
J
Jose Alcérreca 已提交
27
    <<: *config_android
28 29 30
    steps:
      - checkout
      - run:
J
Jose Alcérreca 已提交
31
          <<: *setup_ftl
32 33 34 35
      - run:
          name: Assemble APKs
          command: |
            cd ${PROJECT_DIR}
J
Jose Alcérreca 已提交
36
            ./gradlew :app:assembleDebug :app:assembleDebugAndroidTest :app:test :app:lint
37 38 39 40 41 42 43 44 45 46
      - run:
          name: Test $PROJECT_DIR with Firebase Test Lab
          command: |
            BUCKETNAME=${PROJECT_DIR:0:29} # limit length
            sudo gcloud firebase test android run \
              --app ${PROJECT_DIR}/app/build/outputs/apk/debug/app-debug.apk \
              --test ${PROJECT_DIR}/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
              --results-bucket cloud-test-${GOOGLE_PROJECT_ID}-arch-${BUCKETNAME,,}
      - run:
          <<: *download_results
J
Jose Alcérreca 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
      - run:
          name: Save test results
          command: |
            mkdir -p ~/junit/
            find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} ~/junit/ \;
          when: always
      - store_test_results:
          path: ~/junit
      - store_artifacts:
          path: ~/junit
          destination: tests
      - run:
          name: Save test/lint reports
          command: |
            mkdir -p ~/reports/${PROJECT_DIR}/
            cp -R ./${PROJECT_DIR}/app/build/reports/* ~/reports/${PROJECT_DIR}/
          when: always
      - store_artifacts:
          path: ~/reports/
          destination: reports
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

jobs:
  test_basic_sample:
    environment:
      PROJECT_DIR: BasicSample
    <<: *test_sample
  test_rx_java_sample:
    environment:
      PROJECT_DIR: BasicRxJavaSample
    <<: *test_sample
  test_rx_java_sample_kotlin:
    environment:
      PROJECT_DIR: BasicRxJavaSampleKotlin
    <<: *test_sample
  test_github_browser_sample:
    environment:
      PROJECT_DIR: GithubBrowserSample
    <<: *test_sample
J
Jose Alcérreca 已提交
85 86 87 88
  test_livedata_sample:
    environment:
      PROJECT_DIR: LiveDataSample
    <<: *test_sample
89 90 91 92
  test_navigation_basic_sample:
    environment:
      PROJECT_DIR: NavigationBasicSample
    <<: *test_sample
93 94 95 96
  test_navigation_advanced_sample:
    environment:
      PROJECT_DIR: NavigationAdvancedSample
    <<: *test_sample
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
  test_paging_sample:
    environment:
      PROJECT_DIR: PagingSample
    <<: *test_sample
  test_paging_network_sample:
    environment:
      PROJECT_DIR: PagingWithNetworkSample
    <<: *test_sample
  test_persistence_content_provider_sample:
    environment:
      PROJECT_DIR: PersistenceContentProviderSample
    <<: *test_sample
  test_persistence_migrations_sample:
    environment:
      PROJECT_DIR: PersistenceMigrationsSample
    <<: *test_sample
  test_workmanager_sample:
    environment:
      PROJECT_DIR: WorkManagerSample
    <<: *test_sample
J
Jose Alcérreca 已提交
117 118 119 120
  test_viewbinding_sample:
    environment:
      PROJECT_DIR: ViewBindingSample
    <<: *test_sample
121 122 123 124 125 126 127 128 129

workflows:
  version: 2
  build_and_test:
    jobs:
      - test_basic_sample
      - test_rx_java_sample
      - test_rx_java_sample_kotlin
      - test_github_browser_sample
J
Jose Alcérreca 已提交
130
      - test_livedata_sample
131
      - test_navigation_basic_sample
132
      - test_navigation_advanced_sample
133
      - test_paging_sample
134
      # flaky, deprecated - test_paging_network_sample
135 136
      - test_persistence_content_provider_sample
      # inst tests with flavors - test_persistence_migrations_sample
137
      # temporarily disabled due to #804 - test_workmanager_sample
J
Jose Alcérreca 已提交
138
      - test_viewbinding_sample