Skip to content

Commit

Permalink
Merge pull request #8 from Genymobile/features/support-api-token
Browse files Browse the repository at this point in the history
[Feature] Support api token
  • Loading branch information
thomascarpentier authored Oct 30, 2024
2 parents 28dbbcb + 69e4f00 commit 2329faa
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 88 deletions.
61 changes: 28 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '12.x'
node-version: '20'
- run: npm install
- run: npm run lint

Expand All @@ -21,26 +21,25 @@ jobs:
name: With Adb Serial Port
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.11"
python-version: "3.12.0"

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3

- name: Start Genymotion Cloud SaaS instance
uses: ./
with:
email: ${{ secrets.GMSAAS_EMAIL }}
password: ${{ secrets.GMSAAS_PASSWORD }}
api_token: ${{ secrets.GMSAAS_APITOKEN }}
recipe_uuid: ${{ matrix.recipe_uuid }}
adb_serial_port: "47021"

Expand All @@ -55,27 +54,26 @@ jobs:
name: Start Several devices
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.11"
python-version: "3.12.0"

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3

- name: Genymotion
uses: ./
with:
email: ${{ secrets.GMSAAS_EMAIL }}
password: ${{ secrets.GMSAAS_PASSWORD }}
recipe_uuid: ${{ matrix.recipe_uuid }}
api_token: ${{ secrets.GMSAAS_APITOKEN }}

test-integration-specific_gmsaas_version:
runs-on: ubuntu-latest
Expand All @@ -87,28 +85,26 @@ jobs:
name: Use a specific gmsaas version
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.11"
python-version: "3.12.0"

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3

- name: Genymotion
uses: ./
with:
gmsaas_version: "1.6.0"
email: ${{ secrets.GMSAAS_EMAIL }}
password: ${{ secrets.GMSAAS_PASSWORD }}
recipe_uuid: ${{ matrix.recipe_uuid }}
gmsaas_version: "1.12.0"
api_token: ${{ secrets.GMSAAS_APITOKEN }}


test-integration-install_configure_gmsaas:
Expand All @@ -117,23 +113,22 @@ jobs:
name: Only install and configure gmsaas
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.11"
python-version: "3.12.0"

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"

- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3

- name: Genymotion
uses: ./
with:
email: ${{ secrets.GMSAAS_EMAIL }}
password: ${{ secrets.GMSAAS_PASSWORD }}
api_token: ${{ secrets.GMSAAS_APITOKEN }}
49 changes: 22 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ that credentials keys should be stored as [GitHub secrets](https://docs.github.c

## Inputs

- `email` {string} {required} Email of your Genymotion Cloud SaaS account, if you don't have an account please create it first at [https://cloud.geny.io](https://cloud.geny.io/?&utm_source=web-referral&utm_medium=docs&utm_campaign=githubactions&utm_content=signup). `GMSAAS_EMAIL` should be stored as a [GitHub secret](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-an-organization) and passed as in the
example below. **Never** store your `GMSAAS_EMAIL` as plain text in your YAML workflow.
- `password` {string} {required} The password of your Genymotion Cloud SaaS account. `GMSAAS_PASSWORD` should be stored as a [GitHub secret](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-an-organization) and passed as in the
example below. **Never** store your `GMSAAS_PASSWORD` as plain text in your YAML workflow.
- `api_token` {string} {required} API Token to authenticate to your Genymotion Cloud SaaS account. If you don't have an account please register on [https://cloud.geny.io](https://cloud.geny.io/?&utm_source=web-referral&utm_medium=docs&utm_campaign=githubactions&utm_content=signup) and create an [API Token](https://cloud.geny.io/api). `GMSAAS_APITOKEN` should be stored as a [GitHub secret](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-an-organization) and passed as in the
example below. **Never** store your `GMSAAS_APITOKEN` as plain text in your YAML workflow.
- `gmsaas_version` {string} {optional} Install a specific version of gmsaas (not recommended). Defaults to the latest version if not specified.
- `recipe_uuid` {string} {optional} Recipe UUID is the identifier used when starting an instance; it can be retrieved using `gmsaas recipes list`,
or check [availables recipes](https://support.genymotion.com/hc/en-us/articles/360007473658-Supported-Android-devices-templates-for-Genymotion-Cloud-SaaS) for a comprehensive list of all currently available recipes.
Expand All @@ -38,26 +36,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.11"
python-version: "3.12.0"
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3
- name: Start Genymotion Cloud SaaS instance
uses: genymobile/genymotion-saas-github-action@v0.4
uses: genymobile/genymotion-saas-github-action@v1
with:
email: ${{ secrets.GMSAAS_EMAIL }}
password: ${{ secrets.GMSAAS_PASSWORD }}
api_token: ${{ secrets.GMSAAS_APITOKEN }}
recipe_uuid: ea5fda48-fa8b-48c1-8acc-07d910856141 # Google Pixel XL 8.1
```

Expand All @@ -79,26 +76,25 @@ jobs:
- 4c015ada-e64e-4f5d-a320-06cbf6e95648 # android 10
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.11"
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3
- name: Start Genymotion Cloud SaaS instance
uses: genymobile/genymotion-saas-github-action@v0.4
uses: genymobile/genymotion-saas-github-action@v1
with:
email: ${{ secrets.GMSAAS_EMAIL }}
password: ${{ secrets.GMSAAS_PASSWORD }}
api_token: ${{ secrets.GMSAAS_APITOKEN }}
recipe_uuid: ${{ matrix.recipe_uuid }}
```

Expand All @@ -115,26 +111,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.11"
python-version: "3.12.0"
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3
- name: Start Genymotion Cloud SaaS instance
uses: genymobile/genymotion-saas-github-action@v0.4
uses: genymobile/genymotion-saas-github-action@v1
with:
email: ${{ secrets.GMSAAS_EMAIL }}
password: ${{ secrets.GMSAAS_PASSWORD }}
api_token: ${{ secrets.GMSAAS_APITOKEN }}
recipe_uuid: ea5fda48-fa8b-48c1-8acc-07d910856141 # Google Pixel XL 8.1
adb_serial_port: "47021"
```
Expand Down
9 changes: 3 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ description: |-
Launch Android devices on Genymotion SaaS.
Run your automation tests (Appium, Espresso and others) on those devices.
inputs:
email:
description: Email of your Genymotion Cloud SaaS account, if you don't have an account please create it first on [https://cloud.geny.io](https://cloud.geny.io/?&utm_source=web-referral&utm_medium=docs&utm_campaign=githubactions&utm_content=signup).
required: true
password:
description: Password of your Genymotion Cloud SaaS account.
api_token:
description: API Token to authenticate to your Genymotion Cloud SaaS account. If you don't have an account please register on [https://cloud.geny.io](https://cloud.geny.io/?&utm_source=web-referral&utm_medium=docs&utm_campaign=githubactions&utm_content=signup) and create an [API Token](https://cloud.geny.io/api)
required: true
recipe_uuid:
description: |-
Expand All @@ -35,7 +32,7 @@ outputs:
This output will include the instance UUID of started and connected instance.
runs:
using: 'node12'
using: 'node20'
main: 'dist/setup/index.js'
post: 'dist/cleanup/index.js'

Expand Down
7 changes: 7 additions & 0 deletions dist/cleanup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/cleanup/index.js.map

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/setup/index.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/cleanup/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ async function run() {
core.setFailed(error.message);
}
}

try {
core.info('Reset Genymotion SaaS authentication');
await exec.exec('gmsaas auth reset');
} catch (error) {
core.setFailed(error.message);
}
}

run();
Loading

0 comments on commit 2329faa

Please sign in to comment.