Skip to content

Add Tools & Scripts that build testapps #41

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

Merged
merged 7 commits into from
Aug 11, 2021
Merged

Conversation

sunmou99
Copy link
Contributor

@sunmou99 sunmou99 commented Aug 3, 2021

Tested locally with Unity 2017.4.37f1 and 2019.2.8f1.
firestore testapp uses Unity Test Framework, which requires at least Unity 2019.2.
Except for firestore in 2017.4.37f1 and iOS analytics testapps, the rest testapps build successfully with All platform: iOS,Android,Win64,OSXUniversal,Linux64.
For in-editor test, MacOS' Gatekeeper (which blocks untrusted binaries) will prevent playmode tests on MacOS.

  • Migrated Tools that automate the test. Tools are MenuScene, automated_testapp and etc., under pathscripts/gha/integration_test
  • Migrated Scripts that build testapps. Python scripts under path scripts/gha. Modified the scripts and configs for GitHub.
  • Updated the Unity Project setting.

To test locally:

  1. Prerequisite:
    Make sure you have Unity 2017.4.37f1 installed and activated.
    For iOS, using XCode 10 by default,
    For Android, using SDK tool 25.2.*, JAVA_HOME set to JDK8
    (For Unity 2019.2.8f1, we need newer JDK, and Android SDK)
  2. Restore secret: python scripts/gha/restore_secrets.py --passphrase ${passphrase}
  3. Build testapps: python scripts/gha/build_testapps.py --t auth,database --u 2017.4.37f1 --p iOS,Android,Win64,OSXUniversal,Linux64 --force_latest_runtime

Copy link
Collaborator

@a-maurice a-maurice left a comment

Choose a reason for hiding this comment

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

This is really big, and thus hard to actually review. I know most of this is being brought over from the internal versions of these files. Can you call out the major changes that had to be done, cause that will make it easier to note what is changing.

@@ -166,7 +166,7 @@ PlayerSettings:
buildNumber:
iOS: 0
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 16
AndroidMinSdkVersion: 26
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not a fan of this being updated. We should figure out what the issue here is, because 16 should be fine, and bumping this up just hides the problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update the version for now to unblock the build process.
Shawn created a ticket for this problem, and VJ is working on it. Will revert the change once it problem solved.

Choose a reason for hiding this comment

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

To make sure we don't forget to revert it back, do you want to add a TODO in the code and link to the ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a ticket. And talked with Shawn and VJ today, we are working on it now.

@sunmou99
Copy link
Contributor Author

sunmou99 commented Aug 5, 2021

This is really big, and thus hard to actually review. I know most of this is being brought over from the internal versions of these files. Can you call out the major changes that had to be done, cause that will make it easier to note what is changing.

build_testapps.py: copy tools that automate the test to our unity project.
build_testapps.json: updated app info (name & path), and deleted obsolete configs.
xcodebuild.py: build for unsigned iOS apps.

yifanyang
yifanyang previously approved these changes Aug 5, 2021
Copy link

@yifanyang yifanyang left a comment

Choose a reason for hiding this comment

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

I skimmed through all the python code and left a few comments, but they look largely good to me. I hope that once I'm more familiar with the Games stacks, I'll be able to review more type of code.

@@ -166,7 +166,7 @@ PlayerSettings:
buildNumber:
iOS: 0
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 16
AndroidMinSdkVersion: 26

Choose a reason for hiding this comment

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

To make sure we don't forget to revert it back, do you want to add a TODO in the code and link to the ticket?

Comment on lines +103 to +105
for _, directories, _ in os.walk(iphone_build_dir):
for directory in directories:
if directory.endswith('.app'):

Choose a reason for hiding this comment

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

Would it be simpler if we use glob here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good to know! We use os.walk in a few other scripts. Maybe worthing have a separate PR solve them at once.

shutil.move(app_path, payload_path)
shutil.make_archive(
payload_path, "zip", root_dir=iphone_build_dir, base_dir="Payload")
shutil.move("%s.%s"%(payload_path, "zip"), ipa_path)

Choose a reason for hiding this comment

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

f-string appears to be the modern way for formatting strings. I think they are more readable than str.format() and % operator. It's up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

f-string is a new feature in python 3.6. Our script used to support python 2. But I think that it's worth doing this cleaning for the python scripts.

@yifanyang
Copy link

This is really big, and thus hard to actually review. I know most of this is being brought over from the internal versions of these files. Can you call out the major changes that had to be done, cause that will make it easier to note what is changing.

build_testapps.py: copy tools that automate the test to our unity project.
build_testapps.json: updated app info (name & path), and deleted obsolete configs.
xcodebuild.py: build for unsigned iOS apps.

I feel it will be clearer if this code change is structured as two separate pull requests:

  • one PR that consists of pure copy-pasting old code from google3
  • another PR that contains the real change that needs in-depth review

This would make the PR easier to review and faster to merge (go/small-cls). It's okay to me if it's hard to split this time, but maybe starting from next PR, let's be more conscious of the size of our PR. What do you think?

cynthiajoan
cynthiajoan previously approved these changes Aug 11, 2021
Copy link
Contributor

@cynthiajoan cynthiajoan left a comment

Choose a reason for hiding this comment

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

A few nit comments, this is really an epic PR, great job!

@sunmou99 sunmou99 merged commit f948c75 into main Aug 11, 2021
@sunmou99 sunmou99 deleted the feature/testapp-build-script branch August 11, 2021 18:39
@sunmou99 sunmou99 changed the title Tools & Scripts that build testapps Add Tools & Scripts that build testapps Nov 29, 2021
@firebase firebase locked and limited conversation to collaborators Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants