nearform / polaris

NearForm multi-platform application accelerator
Apache License 2.0
35 stars 8 forks source link

Polaris: Deployment pipeline to create Android or iOS binaries #102

Open katie-roberts opened 3 years ago

katie-roberts commented 3 years ago

As a Polaris developer I want a Github Actions pipeline that will create binary packages Which are signed with my developer keys and API keys So that I can manually push these to the Play or Apple stores

floridemai commented 3 years ago

Scope: Automate builds for iOS and Android and push those builds to the stores (apple store & google play) Nice to have: Run automated tests against builds and only publish the valid ones.

This has been achieved in a project we worked on, task here: https://github.com/covid-alert-ny/covid-green-app/issues/11#issuecomment-668276446.

In order to achieve the goals covered by this issue we need to solve for the following:

  1. Android and iOS build tool
  2. Android and iOS build server/environment
  3. Testing environment
  4. Automation to trigger the build and tests

Android and iOS build tool

Nearform is already using, and I recommend, that we use FastLane for the build tool. This can handle various types of builds and ship those builds where needed. The app repo as it stands currently does not have fastlane setup. I will generate an issue to track this work.

Android and iOS build server/environment

Since the iOS version of the app requires MacOS with XCode, we should build both versions of the app on a Mac. Although > there are some solutions out there for a Mac in the cloud, I do not have any personal experience with them. Furthermore, > this would require bringing in a new vendor, something for which we do not have the time.

For other projects at Bloomberg, we have placed Macs in the datacenters and integrated them with Jenkins, setting up the Macs as workers for Jenkins. The existing hardware and software in place for this approach is not setup in a manner that would allow other projects/teams to use it. If we wanted to follow this approach, we would have to acquire some Mac hardware and install it in the datacenter.

To this end, I propose that the builds are run on a local development machine for the near term. The build scripts will be triggered manually and can ship the resulting packages to a testing environment such as AWS Device Farm.

In the longer term, as NYS will be responsible for managing this process, they will likely want to select their own solution accordingly.

Testing environment

The testing environment includes two things: the testing framework and a place to run those tests. Nearform has configured Detox in the project, however, there are no tests written at this time. The two main options for automated e2e tests are Detox and Appium. Detox is recommended over Appium, however, we would need to confirm that AWS Device Farm supports Detox (it does support Appium and some writing indicates that Detox will also work, but I have not seen it myself).

Which leads to the next concern: where to run the tests. In addition to being able to run the tests on a developer's local machine, we will want to be able to run the tests across a broad variety of both Android and iOS devices. AWS Device Farm can provide for this (see note above about Detox v. Appium). We should select the types of devices we want included in the test cycles. I will generate an issue to track that.

Automation to trigger builds and tests

In the near term we will not be automating the trigger for builds. The tests, however, can be triggered via the fastlane script delivering the build to the AWS Device Farm.

In the future it is recommended that pushing to particular branches or the like would trigger a fastlane build and test cycle.

Working implementation here: https://github.com/covid-alert-ny/covid-green-app/blob/nys/.github/workflows/build.yaml

Implementation notes:

Feel free to ping me to get started, happy to help.

cc @colmharte (anything else to add?)

simoneb commented 3 years ago

There is also this spreadsheet that @irelandm shared about requirements for submission to apple/play store which may be relevant: https://docs.google.com/spreadsheets/d/14CMcqM6ucC9Yg7Q4fM5jPD5qU_qRbUDgbeRmpq4UIi4/edit#gid=0

bamaralf commented 3 years ago

I added a branch (https://github.com/nearform/polaris/tree/build-pipeline) with the scaffold of the Github Actions workflow for performing the build of the packages. The code add a manual triggered workflow with dynamic inputs. More work is still required to clean up the code and remove comments. The workflow should be moved to a Github Actions shared workflow and the inputs should be removed in favor of ENV vars.