Skip to content

Commit

Permalink
Add android-desktop target option
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvanyo committed Feb 9, 2023
1 parent e1248ae commit 2b4826e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
api-level: [16, 23, 29]
target: [default, google_apis]
arch: [x86]
profile: ["Galaxy Nexus"]
exclude:
- os: ubuntu-latest
api-level: 23
Expand All @@ -38,14 +39,22 @@ jobs:
api-level: 24
target: playstore
arch: x86
profile: "Galaxy Nexus"
- os: macos-latest
api-level: 30
target: aosp_atd
arch: x86
profile: "Galaxy Nexus"
- os: macos-11
api-level: 31
target: google_apis
arch: x86_64
profile: "Galaxy Nexus"
- os: macos-latest
api-level: 32
target: android-desktop
arch: x86_64
profile: "desktop_medium"

steps:
- name: checkout
Expand Down Expand Up @@ -73,7 +82,7 @@ jobs:
~/.android/avd/*
~/.android/adb*
~/.android/debug.keystore
key: avd-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}
key: avd-${{ matrix.api-level }}-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.profile }}

- name: assemble tests
uses: gradle/gradle-build-action@v2
Expand All @@ -88,7 +97,7 @@ jobs:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
profile: Galaxy Nexus
profile: ${{ matrix.profile }}
cores: 2
sdcard-path-or-size: 100M
avd-name: test
Expand All @@ -105,7 +114,7 @@ jobs:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
profile: Galaxy Nexus
profile: ${{ matrix.profile }}
cores: 2
ram-size: 2048M
sdcard-path-or-size: 100M
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
| **Input** | **Required** | **Default** | **Description** |
|-|-|-|-|
| `api-level` | Required | N/A | API level of the platform system image - e.g. 23 for Android Marshmallow, 29 for Android 10. **Minimum API level supported is 15**. |
| `target` | Optional | `default` | Target of the system image - `default`, `google_apis`, `playstore`, `android-wear`, `android-wear-cn`, `android-tv`, `google-tv`, `aosp_atd` or `google_atd`. Note that `aosp_atd` and `google_atd` currently require the following: `api-level: 30`, `arch: x86` or `arch: arm64-v8` and `channel: canary`. |
| `target` | Optional | `default` | Target of the system image - `default`, `google_apis`, `playstore`, `android-wear`, `android-wear-cn`, `android-tv`, `google-tv`, `android-desktop`, `aosp_atd` or `google_atd`. Note that `aosp_atd` and `google_atd` currently require the following: `api-level: 30`, `arch: x86` or `arch: arm64-v8` and `channel: canary`. |
| `arch` | Optional | `x86` | CPU architecture of the system image - `x86`, `x86_64` or `arm64-v8a`. Note that `x86_64` image is only available for API 21+. `arm64-v8a` images require Android 4.2+ and are limited to fewer API levels (e.g. 30). |
| `profile` | Optional | N/A | Hardware profile used for creating the AVD - e.g. `Nexus 6`. For a list of all profiles available, run `avdmanager list device`. |
| `cores` | Optional | 2 | Number of cores to use for the emulator (`hw.cpu.ncore` in config.ini). |
Expand Down
5 changes: 5 additions & 0 deletions __tests__/input-validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ describe('target validator tests', () => {
validator.checkTarget('google-tv');
};
expect(func9).not.toThrow();

const func10 = () => {
validator.checkTarget('android-desktop');
};
expect(func10).not.toThrow();
});
});

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ inputs:
description: 'API level of the platform and system image - e.g. 23 for Android Marshmallow, 29 for Android 10'
required: true
target:
description: 'target of the system image - default, google_apis, google_apis_playstore, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv or google-tv'
description: 'target of the system image - default, google_apis, google_apis_playstore, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv, google-tv or android-desktop'
default: 'default'
arch:
description: 'CPU architecture of the system image - x86, x86_64 or arm64-v8a'
Expand Down
13 changes: 12 additions & 1 deletion src/input-validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
export const MIN_API_LEVEL = 15;
export const VALID_TARGETS: Array<string> = ['default', 'google_apis', 'aosp_atd', 'google_atd', 'google_apis_playstore', 'android-wear', 'android-wear-cn', 'android-tv', 'google-tv'];
export const VALID_TARGETS: Array<string> = [
'default',
'google_apis',
'aosp_atd',
'google_atd',
'google_apis_playstore',
'android-wear',
'android-wear-cn',
'android-tv',
'google-tv',
'android-desktop',
];
export const VALID_ARCHS: Array<string> = ['x86', 'x86_64', 'arm64-v8a'];
export const VALID_CHANNELS: Array<string> = ['stable', 'beta', 'dev', 'canary'];

Expand Down

0 comments on commit 2b4826e

Please sign in to comment.