ci: PR检查时的自动化测试的最新API调整为34 #313
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Check | |
on: | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build-and-test-on-macos: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
include: | |
- api-level: 16 #16是最低支持的API | |
arch: x86 | |
- api-level: 28 #28是项目长期使用的测试API | |
arch: x86_64 | |
- api-level: 34 #目前最新的稳定API | |
arch: x86_64 | |
env: | |
DISABLE_TENCENT_MAVEN_MIRROR: true | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v3.x | |
- name: checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: revert gradle wrapper mirror setting | |
run: echo 'distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip' > gradle/wrapper/gradle-wrapper.properties | |
- name: buildSdk | |
run: ./gradlew buildSdk -S | |
- name: build sample/source | |
run: ./gradlew build | |
- name: unit test | |
run: ./gradlew jvmTestSdk -S | |
- name: run androidTestSdk | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
emulator-build: 8420304 | |
target: default | |
arch: ${{ matrix.arch }} | |
profile: pixel_xl | |
script: ./gradlew androidTestSdk | |
- name: stop gradle deamon for actions/cache | |
run: ./gradlew --stop | |
build-on-windows: | |
runs-on: windows-latest | |
env: | |
DISABLE_TENCENT_MAVEN_MIRROR: true | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v3.x | |
- name: checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: revert gradle wrapper mirror setting | |
run: echo 'distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip' > gradle/wrapper/gradle-wrapper.properties | |
- name: buildSdk | |
run: ./gradlew buildSdk -S | |
- name: build sample/source | |
run: ./gradlew build | |
- name: stop gradle deamon for actions/cache | |
run: ./gradlew --stop | |
build-samples: | |
runs-on: ubuntu-latest | |
env: | |
DISABLE_TENCENT_MAVEN_MIRROR: true | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v3.x | |
- name: checkout | |
uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: revert gradle wrapper mirror setting | |
run: echo 'distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip' > gradle/wrapper/gradle-wrapper.properties | |
- name: revert gradle wrapper mirror setting for sample host-project | |
working-directory: projects/sample/maven/host-project | |
run: echo 'distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip' > gradle/wrapper/gradle-wrapper.properties | |
- name: revert gradle wrapper mirror setting for sample manager-project | |
working-directory: projects/sample/maven/manager-project | |
run: echo 'distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip' > gradle/wrapper/gradle-wrapper.properties | |
- name: revert gradle wrapper mirror setting for sample plugin-project | |
working-directory: projects/sample/maven/plugin-project | |
run: echo 'distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip' > gradle/wrapper/gradle-wrapper.properties | |
- name: build sample/maven/host-project | |
working-directory: projects/sample/maven/host-project | |
run: ./gradlew assemble | |
- name: build sample/maven/manager-project | |
working-directory: projects/sample/maven/manager-project | |
run: ./gradlew assemble | |
- name: build sample/maven/plugin-project | |
working-directory: projects/sample/maven/plugin-project | |
run: ./gradlew assemble | |
- name: stop gradle deamon for actions/cache | |
run: ./gradlew --stop |