WIP - Test sdcard.

This commit is contained in:
Yang
2020-10-30 15:23:16 +11:00
parent 4690ba2920
commit 517fe314d7
3 changed files with 67 additions and 43 deletions
+45 -29
View File
@@ -3,39 +3,41 @@ on:
pull_request: pull_request:
push: push:
branches: branches:
- main # - main
- 'yc/*'
paths-ignore: paths-ignore:
- '**.md' - '**.md'
jobs: jobs:
test: test:
runs-on: ${{ matrix.os }} # runs-on: ${{ matrix.os }}
runs-on: macos-latest
env: env:
JAVA_TOOL_OPTIONS: -Xmx4g JAVA_TOOL_OPTIONS: -Xmx4g
timeout-minutes: 15 timeout-minutes: 15
strategy: strategy:
matrix: matrix:
os: [macos-latest, ubuntu-latest] # os: [macos-latest, ubuntu-latest]
api-level: [16, 23, 29] api-level: [23, 30]
target: [default, google_apis] # target: [default, google_apis]
exclude: # exclude:
- os: ubuntu-latest # - os: ubuntu-latest
api-level: 23 # api-level: 23
- os: ubuntu-latest # - os: ubuntu-latest
api-level: 29 # api-level: 29
- target: google_apis # - target: google_apis
api-level: 16 # api-level: 16
- target: google_apis # - target: google_apis
api-level: 23 # api-level: 23
- target: google_apis # - target: google_apis
api-level: 29 # api-level: 29
include: # include:
- os: macos-latest # - os: macos-latest
api-level: 30 # api-level: 30
target: google_apis # target: google_apis
- os: macos-latest # - os: macos-latest
api-level: 24 # api-level: 24
target: playstore # target: playstore
steps: steps:
- name: checkout - name: checkout
@@ -46,7 +48,7 @@ jobs:
- name: build, test and lint - name: build, test and lint
run: | run: |
npm install npm ci
npm run build npm run build
npm run lint npm run lint
npm test npm test
@@ -65,15 +67,29 @@ jobs:
uses: ./ uses: ./
with: with:
api-level: ${{ matrix.api-level }} api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }} target: google_apis
arch: x86 arch: x86
profile: Nexus 6 # profile: Nexus 6
avd-name: test profile: pixel_3a
# avd-name: test
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none
disable-animations: true disable-animations: true
working-directory: ./test-fixture/ working-directory: ./test-fixture/
script: | script: |
echo $GITHUB_REPOSITORY echo $GITHUB_REPOSITORY
adb devices adb devices
./gradlew help adb shell ls -la /sdcard
./gradlew connectedDebugAndroidTest adb shell ls -la /storage
adb emu geo fix 0 51
adb shell screenrecord --verbose /sdcard/capture.mpg &
adb shell pkill -INT screenrecord
mkdir -p app/build/report
cd app/build/report && adb pull /sdcard/capture.mpg
# ./gradlew help
# ./gradlew connectedDebugAndroidTest
- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: build-outputs
path: ./test-fixture/app/build/report
+10 -7
View File
@@ -32,10 +32,11 @@ exports.installAndroidSdk = void 0;
const core = __importStar(require("@actions/core")); const core = __importStar(require("@actions/core"));
const exec = __importStar(require("@actions/exec")); const exec = __importStar(require("@actions/exec"));
const io = __importStar(require("@actions/io")); const io = __importStar(require("@actions/io"));
const tc = __importStar(require("@actions/tool-cache"));
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const BUILD_TOOLS_VERSION = '30.0.2'; const BUILD_TOOLS_VERSION = '30.0.2';
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6609375_latest.zip'; const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip';
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip'; const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip';
/** /**
* Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator, * Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
* and the system image for the chosen API level, CPU arch, and target. * and the system image for the chosen API level, CPU arch, and target.
@@ -50,12 +51,14 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cm
if (!fs.existsSync(cmdlineToolsPath)) { if (!fs.existsSync(cmdlineToolsPath)) {
console.log('Installing new cmdline-tools.'); console.log('Installing new cmdline-tools.');
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX; const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
yield io.mkdirP(`${process.env.ANDROID_HOME}/cmdline-tools`); // await io.mkdirP(cmdlineToolsPath);
yield exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`); const downloadPath = yield tc.downloadTool(sdkUrl);
yield exec.exec(`unzip -q commandlinetools.zip -d ${cmdlineToolsPath}`); yield tc.extractZip(downloadPath, cmdlineToolsPath);
yield io.rmRF('commandlinetools.zip'); yield io.mv(`${cmdlineToolsPath}/cmdline-tools`, `${cmdlineToolsPath}/latest`);
yield exec.exec(`ls -la ${cmdlineToolsPath}`);
// add paths for commandline-tools and platform-tools // add paths for commandline-tools and platform-tools
core.addPath(`${cmdlineToolsPath}/tools:${cmdlineToolsPath}/tools/bin:${process.env.ANDROID_HOME}/platform-tools`); core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_HOME}/platform-tools`);
yield exec.exec(`ls -la ${cmdlineToolsPath}/latest`);
} }
// additional permission and license requirements for Linux // additional permission and license requirements for Linux
const sdkPreviewLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license`; const sdkPreviewLicensePath = `${process.env.ANDROID_HOME}/licenses/android-sdk-preview-license`;
+12 -7
View File
@@ -1,11 +1,12 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as exec from '@actions/exec'; import * as exec from '@actions/exec';
import * as io from '@actions/io'; import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import * as fs from 'fs'; import * as fs from 'fs';
const BUILD_TOOLS_VERSION = '30.0.2'; const BUILD_TOOLS_VERSION = '30.0.2';
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6609375_latest.zip'; const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip';
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip'; const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip';
/** /**
* Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator, * Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator,
@@ -22,13 +23,17 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
if (!fs.existsSync(cmdlineToolsPath)) { if (!fs.existsSync(cmdlineToolsPath)) {
console.log('Installing new cmdline-tools.'); console.log('Installing new cmdline-tools.');
const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX; const sdkUrl = isOnMac ? CMDLINE_TOOLS_URL_MAC : CMDLINE_TOOLS_URL_LINUX;
await io.mkdirP(`${process.env.ANDROID_HOME}/cmdline-tools`); // await io.mkdirP(cmdlineToolsPath);
await exec.exec(`curl -fo commandlinetools.zip ${sdkUrl}`); const downloadPath = await tc.downloadTool(sdkUrl);
await exec.exec(`unzip -q commandlinetools.zip -d ${cmdlineToolsPath}`); await tc.extractZip(downloadPath, cmdlineToolsPath);
await io.rmRF('commandlinetools.zip'); await io.mv(`${cmdlineToolsPath}/cmdline-tools`, `${cmdlineToolsPath}/latest`);
await exec.exec(`ls -la ${cmdlineToolsPath}`);
// add paths for commandline-tools and platform-tools // add paths for commandline-tools and platform-tools
core.addPath(`${cmdlineToolsPath}/tools:${cmdlineToolsPath}/tools/bin:${process.env.ANDROID_HOME}/platform-tools`); core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_HOME}/platform-tools`);
await exec.exec(`ls -la ${cmdlineToolsPath}/latest`);
} }
// additional permission and license requirements for Linux // additional permission and license requirements for Linux