Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Github action SDD proposal #1590

Merged
merged 1 commit into from
Feb 12, 2021
Merged
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
168 changes: 168 additions & 0 deletions docs/flank-github-action/flank_github_acton_sdd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Flank Github action

Add Github action which allows running Flank

# References

- [Github actions documentation](https://github.com/features/actions)

- [Creating a Docker container action](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action)

- [Creating a JavaScript action](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action)

- [Creating a composite run steps action](https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action)

- [Github actions marketplace](https://github.com/marketplace?type=actions)



# Motivation

Bitrise and Circle CI have steps in their CIs to run Flank. As Github is a widely used code repository and Github actions become more and more popular there should be also Github action that allows running Flank.

After creating Github action, Flank could reach more users.

# Goals

- Flank actions should be as easy as possible to run
- Flank action should be maintainable together with Flank runner (always be up to date with options)
- Flank action should be available on the public repository

# Design

There should be a possibility to specify all flank options using Github action variables as input, as well as passing the configuration itself.

User must provide at least:

- Flank version (default latest)
- platform to run (iOS or Android)
- Flank service account file to authenticate
- Flank options or flank configuration file path

# API

Flank Github action will be developed using [composite run steps action](https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action) which just packs other actions and runs it as a single action.

### Design proposal

```yaml
name: 'Flank'
description: 'Run Flank from Github actions!'
inputs:
version:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This red line looks odd?

description: 'Version of flank to run'
required: true
default: <latest>
platform:
description: 'Platform to run iOS or Android'
required: true
flank_option1:
description: 'Description of option 1'
required: false # validation will done when running
...
flank_optionX:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually in Maths we denote it as 1...N its the most common way to show it.
Is X used for a reason?

description: 'Description of option X'
required: false # validation will done when running
flank_configuration_file:
description: 'Path to configuration file'
required: false # validation will done when running
flank_service_account:
description: 'Path to service account file to authenticate'
required: true
outputs:
output_report:
description: "Output report"
value: ${{ steps.report.outputs.random-id }}
runs:
using: "composite"
steps:
- id: download flank
run: <download flank>
shell: bash
- id: validate configuration
run: <check if configuation file or any options are specified>
shell: bash
- id: run flank
run: <check if configuation file or any options are specified>
shell: bash
- id: report
run: <show run report to user>
shell: bash
```



### Usage

##### With config file

```yaml
on: [push]

jobs:
hello_world_job:
runs-on: ubuntu-latest
name: A job to say hello
steps:
- uses: actions/checkout@v2
- id: flank
uses: actions/flank@v1
with:
version: '21.01.0'
platform: 'android'
flank_service_account: './service_account.json'
flank_configuration_file: './flank.yml'
- run: cat ${{ steps.flank.outputs.output_report }}
shell: bash
```

##### With options

```yaml
on: [push]

jobs:
hello_world_job:
runs-on: ubuntu-latest
name: A job to say hello
steps:
- uses: actions/checkout@v2
- id: flank
uses: actions/flank@v1
with:
version: '21.01.0'
platform: 'android'
flank_service_account: './service_account.json'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

service_account.json - shound't be kept in secrets? I am not sure, just asking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be provided by the user, so it will be his responsibility to keep it safe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if it's file path user should add service acc to repo or create before this step yes? Maybe we could allow users to provide a string with service acc data instead of the file path.

app: "../test_projects/android/apks/app-debug.apk"
test: "../test_projects/android/apks/app-debug-androidTest.apk"
results-dir: test_dir
legacy-junit-result: true
- run: cat ${{ steps.flank.outputs.output_report }}
shell: bash
```



# Results

After finishing Flank GitHub actions should be published to [Github actions marketplace](https://github.com/marketplace?type=actions).

There should be also an announcement on Flank channel on Slack.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once off announcement?


The thing to consider is also using it for our internal verification together with integration tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great. Always good to dogfood our own releases.


# Dependencies

Github action needs to have `action.yml` file in the root of the repository, however, Flank repository has the file for posting Slack message after release. However it is only used by Flank team, so it will be best to move it as a side repository and keep the main Flank action in Flank's mono repository
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please tag me in this and ill gladly move it to another repository as i was the author. It can be done alongisde me optimizaing the release notification.


# Testing

A new testing repository will be set up to test action as described in [GitHub actions documentation](https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action#testing-out-your-action-in-a-workflow)

# Alternatives Considered

The investigation was done to choose the best way to develop custom GitHub action.

[Docker container action](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action) is not the best choice, because users are [forced to run Flank action on Ubuntu workflow](https://docs.github.com/en/actions/creating-actions/about-actions#types-of-actions).

The second alternative considered was using [JavaScript as action language](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action). However, this is another language to maintain in our project and it will not be the best option to choose for such an important thing