Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 118 additions & 116 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
testApplication: "example/appTest.apk"
platform: "android"
name: "android_3_0_simple"
analyticsReadOnly: "true"

- name: Show failure message
if: failure()
Expand All @@ -38,122 +39,122 @@ jobs:
echo "1. Ensure that you have updated lib/index.js. See README for updating details."
exit 1

check_output_android:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Setup Marathon Cloud
uses: MarathonLabs/setup-marathon-cloud@2.0.1
with:
version: "1.0.38"

- name: Run Marathon Cloud action-invoke
uses: ./
with:
apiKey: ${{ secrets.RUN_TOKEN }}
application: "example/app.apk"
testApplication: "example/appTest.apk"
platform: "android"
name: "android_3_0_output"
output: "output"
resultFile: "some-result.json"
branch: "develop"

- name: Check if output folder exists and is not empty
run: |
if [ -d "output" ] && [ "$(ls -A output)" ]; then
echo "Output folder exists and is not empty."
else
echo "Output folder does not exist or is empty."
exit 1
fi

- name: Check if resultFile exists
run: |
if [ ! -f "some-result.json" ]; then
echo "Error: some-result.json does not exist."
exit 1
fi

- name: Upload artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: android_output
path: output

- name: Upload resultFile
if: always()
uses: actions/upload-artifact@v4
with:
name: some-result.json
path: some-result.json

- name: Show failure message
if: failure()
run: |
echo "❌ Marathon Cloud action-invoke failed. Please check the following:"
echo "1. Ensure that you have updated lib/index.js. See README for updating details."
exit 1

check_output_failed_android:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Setup Marathon Cloud
uses: MarathonLabs/setup-marathon-cloud@2.0.1
with:
version: "1.0.38"

- name: Run Marathon Cloud action-invoke
uses: ./
with:
apiKey: ${{ secrets.RUN_TOKEN }}
application: "example/app.apk"
testApplication: "example/appTestFailed.apk"
platform: "android"
name: "android_3_0_failed"
output: "output"
ignoreTestFailures: "true"

- name: Check if output folder exists and is not empty
run: |
if [ -d "output" ] && [ "$(ls -A output)" ]; then
echo "Output folder exists and is not empty."
else
echo "Output folder does not exist or is empty."
exit 1
fi

- name: Upload artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: android_failed_output
path: output

- name: Show failure message
if: failure()
run: |
echo "❌ Marathon Cloud action-invoke failed. Please check the following:"
echo "1. Ensure that you have updated lib/index.js. See README for updating details."
exit 1
# check_output_android:
# runs-on: ubuntu-latest

# steps:
# - name: Checkout repository
# uses: actions/checkout@v2

# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: "16"

# - name: Setup Marathon Cloud
# uses: MarathonLabs/setup-marathon-cloud@2.0.1
# with:
# version: "1.0.38"

# - name: Run Marathon Cloud action-invoke
# uses: ./
# with:
# apiKey: ${{ secrets.RUN_TOKEN }}
# application: "example/app.apk"
# testApplication: "example/appTest.apk"
# platform: "android"
# name: "android_3_0_output"
# output: "output"
# resultFile: "some-result.json"
# branch: "develop"

# - name: Check if output folder exists and is not empty
# run: |
# if [ -d "output" ] && [ "$(ls -A output)" ]; then
# echo "Output folder exists and is not empty."
# else
# echo "Output folder does not exist or is empty."
# exit 1
# fi

# - name: Check if resultFile exists
# run: |
# if [ ! -f "some-result.json" ]; then
# echo "Error: some-result.json does not exist."
# exit 1
# fi

# - name: Upload artifact
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: android_output
# path: output

# - name: Upload resultFile
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: some-result.json
# path: some-result.json

# - name: Show failure message
# if: failure()
# run: |
# echo "❌ Marathon Cloud action-invoke failed. Please check the following:"
# echo "1. Ensure that you have updated lib/index.js. See README for updating details."
# exit 1

# check_output_failed_android:
# runs-on: ubuntu-latest

# steps:
# - name: Checkout repository
# uses: actions/checkout@v2

# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: "16"

# - name: Setup Marathon Cloud
# uses: MarathonLabs/setup-marathon-cloud@2.0.1
# with:
# version: "1.0.38"

# - name: Run Marathon Cloud action-invoke
# uses: ./
# with:
# apiKey: ${{ secrets.RUN_TOKEN }}
# application: "example/app.apk"
# testApplication: "example/appTestFailed.apk"
# platform: "android"
# name: "android_3_0_failed"
# output: "output"
# ignoreTestFailures: "true"

# - name: Check if output folder exists and is not empty
# run: |
# if [ -d "output" ] && [ "$(ls -A output)" ]; then
# echo "Output folder exists and is not empty."
# else
# echo "Output folder does not exist or is empty."
# exit 1
# fi

# - name: Upload artifact
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: android_failed_output
# path: output

# - name: Show failure message
# if: failure()
# run: |
# echo "❌ Marathon Cloud action-invoke failed. Please check the following:"
# echo "1. Ensure that you have updated lib/index.js. See README for updating details."
# exit 1

check_ios:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -181,6 +182,7 @@ jobs:
platform: "ios"
name: "ios_3_0"
output: "output"
analyticsReadOnly: "true"

- name: Check if output folder exists and is not empty
run: |
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This action wraps [marathon-cloud][] CLI in your GitHub Actions workflow.
| `branch` (optional) | Branch for run, for example it could be git branch like develop or feature/about-screen | `` | `develop` |
| `project` (optional) | The unique identifier (slug) for the project | `` | `` |
| `grantedPermission` (optional) | Grant permission to application. Important: Granting is conducted before each test batch (not each test). If you need to grant before each test, please use --isolated mode. Available permissions: calendar, contacts-limited, contacts, location, location-always, photos-add, photos, media-library, microphone, motion, reminders, siri | `` | `motion,siri,calendar` |
| `analyticsReadOnly` (optional) | If true then test run will not affect any statistical measurements | `false` | `true`, `false` |

## Usage Examples

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ inputs:
grantedPermission:
description: "Grant permission to application. Important: Granting is conducted before each test batch (not each test). If you need to grant before each test, please use --isolated mode. Available permissions: calendar, contacts-limited, contacts, location, location-always, photos-add, photos, media-library, microphone, motion, reminders, siri. Format: 'motion,siri'"
required: false
analyticsReadOnly:
description: "If true then test run will not affect any statistical measurements [possible values: true, false]"
required: false
branding:
icon: "play"
color: "purple"
Expand Down
15 changes: 11 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3986,7 +3986,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.buildDownloadArgs = exports.buildiOSArgs = exports.buildAndroidArgs = void 0;
const core = __importStar(__nccwpck_require__(186));
function buildAndroidArgs(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures, resultFile, pullFiles, branch, project, grantedPermission) {
function buildAndroidArgs(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures, resultFile, pullFiles, branch, project, grantedPermission, analyticsReadOnly) {
const args = [
"run",
"android",
Expand Down Expand Up @@ -4058,10 +4058,13 @@ function buildAndroidArgs(apiKey, application, testApplication, link, osVersion,
if (grantedPermission) {
core.warning(`grantedPermission argument is only for iOS`);
}
if (analyticsReadOnly) {
args.push("--analytics-read-only", analyticsReadOnly);
}
return args;
}
exports.buildAndroidArgs = buildAndroidArgs;
function buildiOSArgs(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures, resultFile, pullFiles, branch, project, grantedPermission) {
function buildiOSArgs(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures, resultFile, pullFiles, branch, project, grantedPermission, analyticsReadOnly) {
const args = [
"run",
"ios",
Expand Down Expand Up @@ -4137,6 +4140,9 @@ function buildiOSArgs(apiKey, application, testApplication, link, osVersion, sys
args.push("--granted-permission", env.trim());
});
}
if (analyticsReadOnly) {
args.push("--analytics-read-only", analyticsReadOnly);
}
return args;
}
exports.buildiOSArgs = buildiOSArgs;
Expand Down Expand Up @@ -4232,15 +4238,16 @@ function main() {
const branch = core.getInput("branch");
const project = core.getInput("project");
const grantedPermission = core.getInput("grantedPermission");
const analyticsReadOnly = core.getInput("analyticsReadOnly");
let args = [];
const lowercasePlatform = platform.toLowerCase();
switch (lowercasePlatform) {
case "android": {
args = (0, command_1.buildAndroidArgs)(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, "", resultFile, pullFiles, branch, project, grantedPermission);
args = (0, command_1.buildAndroidArgs)(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, "", resultFile, pullFiles, branch, project, grantedPermission, analyticsReadOnly);
break;
}
case "ios": {
args = (0, command_1.buildiOSArgs)(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, "", resultFile, pullFiles, branch, project, grantedPermission);
args = (0, command_1.buildiOSArgs)(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, "", resultFile, pullFiles, branch, project, grantedPermission, analyticsReadOnly);
break;
}
default: {
Expand Down
10 changes: 10 additions & 0 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function buildAndroidArgs(
branch: string,
project: string,
grantedPermission: string,
analyticsReadOnly: string,
): string[] {
const args = [
"run",
Expand Down Expand Up @@ -116,6 +117,10 @@ export function buildAndroidArgs(
core.warning(`grantedPermission argument is only for iOS`);
}

if (analyticsReadOnly) {
args.push("--analytics-read-only", analyticsReadOnly);
}

return args;
}

Expand Down Expand Up @@ -143,6 +148,7 @@ export function buildiOSArgs(
branch: string,
project: string,
grantedPermission: string,
analyticsReadOnly: string,
): string[] {
const args = [
"run",
Expand Down Expand Up @@ -243,6 +249,10 @@ export function buildiOSArgs(
});
}

if (analyticsReadOnly) {
args.push("--analytics-read-only", analyticsReadOnly);
}

return args;
}

Expand Down
3 changes: 3 additions & 0 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ async function main() {
const branch = core.getInput("branch");
const project = core.getInput("project");
const grantedPermission = core.getInput("grantedPermission");
const analyticsReadOnly = core.getInput("analyticsReadOnly");

let args: string[] = [];

Expand Down Expand Up @@ -62,6 +63,7 @@ async function main() {
branch,
project,
grantedPermission,
analyticsReadOnly,
);
break;
}
Expand Down Expand Up @@ -90,6 +92,7 @@ async function main() {
branch,
project,
grantedPermission,
analyticsReadOnly,
);
break;
}
Expand Down
Loading