Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c4a1492

Browse files
committedSep 15, 2021
[ConfigSample] Initial commit
1 parent cb136a9 commit c4a1492

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1156
-0
lines changed
 

‎.github/ci-gradle.properties

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright 2021 The Android Open Source Project
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
org.gradle.daemon=false
18+
org.gradle.parallel=true
19+
org.gradle.jvmargs=-Xmx5120m
20+
org.gradle.workers.max=2
21+
22+
kotlin.incremental=false
23+
kotlin.compiler.execution.strategy=in-process
24+
25+
# Controls KotlinOptions.allWarningsAsErrors. This is used in CI and can be set in local properties.
26+
warningsAsErrors=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: TestConfigurationSample
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'TestConfigurationSample/**'
9+
pull_request:
10+
paths:
11+
- 'TestConfigurationSample/**'
12+
13+
env:
14+
SAMPLE_PATH: TestConfigurationSample
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
25+
- name: Copy CI gradle.properties
26+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
27+
28+
- name: Set up JDK 11
29+
uses: actions/setup-java@v1
30+
with:
31+
java-version: 11
32+
33+
- name: Generate cache key
34+
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
35+
36+
- uses: actions/cache@v2
37+
with:
38+
path: |
39+
~/.gradle/caches/modules-*
40+
~/.gradle/caches/jars-*
41+
~/.gradle/caches/build-cache-*
42+
key: gradle-${{ hashFiles('checksum.txt') }}
43+
44+
- name: Build project and run local tests
45+
working-directory: ${{ env.SAMPLE_PATH }}
46+
run: ./gradlew spotlessCheck assembleDebug lintDebug testDebug --stacktrace --no-build-cache --rerun-tasks
47+
48+
gradleManagedVirtualDevicesTest:
49+
needs: build
50+
runs-on: macOS-latest # enables hardware acceleration in the virtual machine
51+
timeout-minutes: 90
52+
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v2
56+
57+
- name: Copy CI gradle.properties
58+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
59+
60+
- name: Set up JDK 11
61+
uses: actions/setup-java@v1
62+
with:
63+
java-version: 11
64+
65+
- name: Generate cache key
66+
run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt
67+
68+
- uses: actions/cache@v2
69+
with:
70+
path: |
71+
~/.gradle/caches/modules-*
72+
~/.gradle/caches/jars-*
73+
~/.gradle/caches/build-cache-*
74+
key: gradle-${{ hashFiles('checksum.txt') }}
75+
76+
- name: AVD cache
77+
uses: actions/cache@v2
78+
id: avd-cache
79+
with:
80+
path: |
81+
~/.android/gradle/avd/*
82+
key: avd
83+
84+
- name: Run instrumented tests
85+
working-directory: ${{ env.SAMPLE_PATH }}
86+
run: |
87+
./gradlew pixel2api29DebugAndroidTest -Pandroid.experimental.androidTest.useUnifiedTestPlatform=true -Pandroid.testInstrumentationRunnerArguments.notAnnotation=com.example.android.testing.testconfigurationsample.TestDeviceLargeScreen
88+
./gradlew pixel2api23DebugAndroidTest -Pandroid.experimental.androidTest.useUnifiedTestPlatform=true -Pandroid.testInstrumentationRunnerArguments.annotation=com.example.android.testing.testconfigurationsample.TestDeviceApi23
89+
./gradlew nexus9api29DebugAndroidTest -Pandroid.experimental.androidTest.useUnifiedTestPlatform=true -Pandroid.testInstrumentationRunnerArguments.annotation=com.example.android.testing.testconfigurationsample.TestDeviceLargeScreen
90+
91+
- name: Upload test reports
92+
if: always()
93+
uses: actions/upload-artifact@v2
94+
with:
95+
name: test-reports
96+
path: ${{ env.SAMPLE_PATH }}/app/build/reports/androidTests

0 commit comments

Comments
 (0)
Please sign in to comment.