Skip to content

Commit

Permalink
Release: Version 1.8.0 (#31)
Browse files Browse the repository at this point in the history
Adds timeout argument
  • Loading branch information
igorsmotto committed Nov 15, 2023
1 parent 4499213 commit 796e192
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Run your Flows on [Maestro Cloud](https://cloud.mobile.dev).
Add the following to your workflow. Note that you can use the `v1` tag if you want to keep using the latest version of the action, which will automatically resolve to all `v1.minor.patch` versions as they get published.

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: <path_to_your_app_file>
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
# Android

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app/build/outputs/apk/debug/app-debug.apk
Expand All @@ -58,7 +58,7 @@ jobs:
Include the Proguard mapping file to deobfuscate Android performance traces:

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app/build/outputs/apk/release/app-release.apk
Expand All @@ -68,7 +68,7 @@ Include the Proguard mapping file to deobfuscate Android performance traces:
# iOS

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: <app_name>.app
Expand All @@ -80,7 +80,7 @@ Include the Proguard mapping file to deobfuscate Android performance traces:
### .dSYM file

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: <app_name>.app
Expand All @@ -94,7 +94,7 @@ Include the Proguard mapping file to deobfuscate Android performance traces:
By default, the action is looking for a `.maestro` folder with Maestro flows in the root directory of the project. If you would like to customize this behaviour, you can override it with a `workspace` argument:

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
Expand All @@ -112,7 +112,7 @@ A name will automatically be provided according to the following order:
If you want to override this behaviour and specify your own name, you can do so by setting the `name` argument:

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
Expand All @@ -124,7 +124,7 @@ If you want to override this behaviour and specify your own name, you can do so
If you don't want the action to wait until the Upload has been completed as is the default behaviour, set the `async` argument to `true`:

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
Expand All @@ -134,7 +134,7 @@ If you don't want the action to wait until the Upload has been completed as is t
Alternatively, you might want to still wait for the action but would like to configure the timeout period, set `timeout` argument to a number of minutes:

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
Expand All @@ -146,7 +146,7 @@ Alternatively, you might want to still wait for the action but would like to con
If you want to pass environment variables along with your upload, add a multiline `env` argument:

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
Expand All @@ -162,7 +162,7 @@ You can use Maestro (Tags)[https://maestro.mobile.dev/cli/tags] to filter which
You can either pass a single value, or comma-separated (`,`) values.

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
Expand All @@ -177,7 +177,7 @@ You can specify what Android API level to use when running in Maestro Cloud usin
The default API level is 30.

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.apk
Expand All @@ -191,7 +191,7 @@ You can specify what **major** iOS Version to use when running in Maestro Cloud
The default iOS version is 15.

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
Expand All @@ -204,12 +204,12 @@ You can use an already uploaded App binary in Maestro Cloud using the `app-binar

```yaml
- id: upload
uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-binary-id: ${{ steps.upload.outputs.MAESTRO_CLOUD_APP_BINARY_ID }}
Expand All @@ -220,7 +220,7 @@ You can use an already uploaded App binary in Maestro Cloud using the `app-binar
To switch the device locale on a remote device from a default one (en_US) `device-locale` parameter should be used. The value is a combination of lowercase ISO-639-1 code and uppercase ISO-3166-1 code, i.e. "de_DE" for Germany.

```yaml
- uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
- uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: app.zip
Expand All @@ -241,7 +241,7 @@ In order to access these variables you can use the following approach:

```yaml
- id: upload
uses: mobile-dev-inc/action-maestro-cloud@v1.7.0
uses: mobile-dev-inc/action-maestro-cloud@v1.8.0
with:
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
app-file: <your_app_file>
Expand Down
25 changes: 18 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46725,19 +46725,23 @@ class StatusPoller {
this.uploadId = uploadId;
this.consoleUrl = consoleUrl;
this.completedFlows = {};
this.stopped = false;
}
markFailed(msg) {
core.setFailed(msg);
}
onError(errMsg, error) {
let msg = `${errMsg}`;
if (!!error)
msg += ` - receveied error ${error}`;
msg += ` - received error ${error}`;
msg += `. View the Upload in the console for more information: ${this.consoleUrl}`;
this.markFailed(msg);
}
poll(sleep, prevErrorCount = 0) {
return __awaiter(this, void 0, void 0, function* () {
if (this.stopped) {
return;
}
try {
const { completed, status, flows } = yield this.client.getUploadStatus(this.uploadId);
for (const flow of flows.filter(isCompleted)) {
Expand Down Expand Up @@ -46790,23 +46794,24 @@ class StatusPoller {
}
});
}
registerTimeout() {
registerTimeout(timeoutInMinutes) {
this.timeout = setTimeout(() => {
(0, log_1.warning)(`Timed out waiting for Upload to complete. View the Upload in the console for more information: ${this.consoleUrl}`);
}, WAIT_TIMEOUT_MS);
this.stopped = true;
}, timeoutInMinutes ? (timeoutInMinutes * 60 * 1000) : WAIT_TIMEOUT_MS);
}
teardown() {
this.timeout && clearTimeout(this.timeout);
}
startPolling() {
startPolling(timeout) {
try {
this.poll(INTERVAL_MS);
(0, log_1.info)('Waiting for analyses to complete...\n');
}
catch (err) {
this.markFailed(err instanceof Error ? err.message : `${err} `);
}
this.registerTimeout();
this.registerTimeout(timeout);
}
}
exports["default"] = StatusPoller;
Expand Down Expand Up @@ -47046,7 +47051,7 @@ const getConsoleUrl = (uploadId, teamId, appId) => {
};
exports.getConsoleUrl = getConsoleUrl;
const run = () => __awaiter(void 0, void 0, void 0, function* () {
const { apiKey, apiUrl, name, appFilePath, mappingFile, workspaceFolder, branchName, commitSha, repoOwner, repoName, pullRequestId, env, async, androidApiLevel, iOSVersion, includeTags, excludeTags, appBinaryId, deviceLocale, } = yield (0, params_1.getParameters)();
const { apiKey, apiUrl, name, appFilePath, mappingFile, workspaceFolder, branchName, commitSha, repoOwner, repoName, pullRequestId, env, async, androidApiLevel, iOSVersion, includeTags, excludeTags, appBinaryId, deviceLocale, timeout, } = yield (0, params_1.getParameters)();
let appFile = null;
if (appFilePath !== "") {
appFile = yield (0, app_file_1.validateAppFile)(yield (0, archive_utils_1.zipIfFolder)(appFilePath));
Expand Down Expand Up @@ -47078,7 +47083,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
(0, log_1.info)(`Visit the web console for more details about the upload: ${consoleUrl}\n`);
core.setOutput('MAESTRO_CLOUD_CONSOLE_URL', consoleUrl);
core.setOutput('MAESTRO_CLOUD_APP_BINARY_ID', uploadedBinaryId);
!async && new StatusPoller_1.default(client, uploadId, consoleUrl).startPolling();
!async && new StatusPoller_1.default(client, uploadId, consoleUrl).startPolling(timeout);
});
run().catch(e => {
core.setFailed(`Error running Maestro Cloud Upload Action: ${e.message}`);
Expand Down Expand Up @@ -47223,6 +47228,9 @@ function getAndroidApiLevel(apiLevel) {
function getIOSVersion(iosVersion) {
return iosVersion ? +iosVersion : undefined;
}
function getTimeout(timeout) {
return timeout ? +timeout : undefined;
}
function parseTags(tags) {
if (tags === undefined || tags === '')
return [];
Expand Down Expand Up @@ -47254,6 +47262,7 @@ function getParameters() {
throw new Error("Either app-file or app-binary-id must be used");
}
const deviceLocale = core.getInput('device-locale', { required: false });
const timeoutString = core.getInput('timeout', { required: false });
var env = {};
env = core.getMultilineInput('env', { required: false })
.map(it => {
Expand All @@ -47274,6 +47283,7 @@ function getParameters() {
const pullRequestId = getPullRequestId();
const androidApiLevel = getAndroidApiLevel(androidApiLevelString);
const iOSVersion = getIOSVersion(iOSVersionString);
const timeout = getTimeout(timeoutString);
return {
apiUrl,
name,
Expand All @@ -47294,6 +47304,7 @@ function getParameters() {
excludeTags,
appBinaryId,
deviceLocale,
timeout,
};
});
}
Expand Down

0 comments on commit 796e192

Please sign in to comment.