Skip to content

Commit

Permalink
v1.0.0 (#2)
Browse files Browse the repository at this point in the history
* init

* Add new line

* Add new line

* Add badge

* Fix validation

* fix test

* fix test

* fix test

* fix test

* fix test

* Update README

* Fix test

* Update

* Update
  • Loading branch information
sotayamashita authored Jan 2, 2022
1 parent 154c5ef commit 40bebde
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 23 deletions.
10 changes: 10 additions & 0 deletions .github/config/.markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# MD013/line-length - Line length
MD013: false

# MD033/no-inline-html - Inline HTML
MD033:
# Allowed elements
allowed_elements: ["br", "a", "img"]

# MD034/no-bare-urls - Bare URL used
MD034: false
11 changes: 0 additions & 11 deletions .github/workflows/example-basic.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "integration-test"

# Controls when the action will run.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]

- name: Output current branch name
run: >
echo "Running on pr: ${{ steps.branch-name.outputs.current_branch }}"
- name: Run a Test Plan on Autify for Mobile
id: run-test-plan
uses: ./
with:
autify_for_mobile_api_token: ${{ secrets.AUTIFY_FOR_MOBILE_API_TOKEN }}
test_plan_id: ${{ secrets.TEST_PLAN_ID }}
build_id: ${{ secrets.BUILD_ID }}

- name: Ouputs
run: >
echo "Test Result ID is $(echo ${{ steps.run-test-plan.outputs.response }} | jq -R 'fromjson? | .id')"
20 changes: 20 additions & 0 deletions .github/workflows/markdown-link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: markdown-link-check

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Markdown links check
uses: ruzickap/action-my-markdown-link-checker@v1
24 changes: 24 additions & 0 deletions .github/workflows/markdown-lint-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: markdown-lint-check

# Controls when the action will run.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
markdown-lint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Markdown lint check
uses: docker://avtodev/markdown-lint:v1 # fastest way
with:
config: './.github/config/.markdownlint.yml'
args: './README.md'
29 changes: 29 additions & 0 deletions .github/workflows/yaml-lint-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: yaml-lint-check

# Controls when the action will run.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
yaml-lint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: YAML lint check
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: action.yml
config_data: |
extends: default
rules:
line-length:
max: 80
level: warning
62 changes: 58 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,67 @@
[integration-test-badge]: https://github.com/autifyhq/mobile-run-test-plan-action/actions/workflows/integration-test.yml/badge.svg
[integration-test-url]: https://github.com/autifyhq/mobile-run-test-plan-action/actions/workflows/integration-test.yml

[release-badge]: https://img.shields.io/github/v/release/autifyhq/mobile-run-test-plan-action.svg
[release-url]: https://github.com/autifyhq/mobile-run-test-plan-action/releases

[release-date-badge]: https://img.shields.io/github/release-date/autifyhq/mobile-run-test-plan-action.svg
[release-date-url]: https://github.com/autifyhq/mobile-run-test-plan-action/releases

[license-badge]: https://img.shields.io/badge/license-MIT-lightgrey.svg
[license-url]: https://raw.githubusercontent.com/autifyhq/mobile-run-test-plan-action/main/LICENSE

# Autify for Mobile Run Test Plan Action

[![Test][integration-test-badge]][integration-test-url]
[![Release][release-badge]][release-url]
[![Release date][release-date-badge]][release-date-url]
[![License][license-badge]][license-url]

## Inputs

| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
| --- | --- | --- | --- | --- |
| **autify_for_mobile_api_token** | Autify for Mobile API Token | Yes | - | string |
| **test_plan_id** | Test Plan ID that you want to run | Yes | - | string |
| **build_id** | Build ID that you want to run | Yes | - | string |
| **test_plan_api_base_url** | Test Plan API base URL | No | `https://mobile-app.autify.com/api/v1/test_plans/` | string |

## Outputs

| Name | Description |
| --- | --- |
| **response** | API response json |

## Usage Examples

> Runs a Test Plan on Autify for Mobile.
```yaml
name: "example"
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Funtional test
id: functional-test
uses: autifyhq/[email protected]
with:
autify_for_mobile_api_token: ${{ secrets.AUTIFY_FOR_MOBILE_API_TOKEN }}
test_plan_id: ${{ secrets.TEST_PLAN_ID }}
build_id: ${{ secrets.BUILD_ID }}
```
## See Also
API docs
### API docs
- [Autify for Mobile API reference](https://mobile-app.autify.com/api/docs/index.html)
GitHub Actions from Autify
### GitHub Actions from Autify
- [autifyhq/mobile-upload-build-action](https://github.com/autifyhq/mobile-upload-build-action)
- [Autify for Web Run Test Plan Action](https://github.com/autifyhq/web-run-test-plan-action)
## License
[MIT License](LICENSE)
[MIT License](LICENSE)
78 changes: 70 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,78 @@
# https://docs.github.com/ja/actions/creating-actions/metadata-syntax-for-github-actions

name: "Run Test Plan at Autify for Mobile"
description: "Run a Test Plan at Autify for Mobile on GitHub Actions"
---
name: "Autify for Mobile Run Test Plan"
description: "Runs a Test Plan to execute automated E2E tests on Autify for Mobile"
author: "Autify"

branding:
icon: "check-circle"
color: "purple"

inputs:
autify_for_mobile_api_token:
description: "Personal Access Token"
required: true

test_plan_id:
description: "Test Plan ID that you want to run"
required: true

build_id:
description: "Build ID that you want to use"
required: true

test_plan_api_base_url:
description: "Test Plan API base URL"
default: https://mobile-app.autify.com/api/v1/test_plans/
required: false

outputs:
response:
value: ${{ steps.run-test-plan-action.outputs.response }}

runs:
using: "composite"
steps:
- name: Run Test Plan
- name: "Run a Test Plan on Autify for Web"
shell: bash
id: result
run: >
echo "hello"
id: run-test-plan-action
run: |
error () {
echo "::error ::${1}"
}
# Mask the value if it is passed in a way other than GitHub secrets
echo "::add-mask::${{ inputs.autify_for_mobile_api_token }}"
# Validate parameters
if [ -z "${{ inputs.autify_for_mobile_api_token }}" ]; then
error "Token should exist"
exit 1
fi
if ! echo "${{ inputs.test_plan_id }}" | grep -Eq '^[a-zA-Z0-9]+$'; then
error "Test Plan ID should be string of alphabet or digits"
exit 1
fi
if ! echo "${{ inputs.build_id }}" | grep -Eq '^[a-zA-Z0-9]+$'; then
error "Build ID should be string of alphabet or digits"
exit 1
fi
# Call API
response=$(curl -s -X POST \
-H "Authorization: Bearer ${{ inputs.autify_for_mobile_api_token }}" \
-H "Content-Type: application/json" \
-d "{\"build_id\":\"${{ inputs.build_id }}\"}" \
"${{ inputs.test_plan_api_base_url }}${{ inputs.test_plan_id }}/test_plan_results")
# Validate response
if [ "$( echo ${response} | jq -R 'fromjson? | has("errors")' )" == true ]; then
error "Error running the test plan. The error messages are : ${response}"
exit 1
fi
# Outputs
echo "Successfully started the Test Plan."
echo ${response} | jq -R 'fromjson?'
echo "::set-output name=response::'${response}'"

0 comments on commit 40bebde

Please sign in to comment.