Git Product home page Git Product logo

android-automation-tools's People

Contributors

mcomella avatar mozilla-github-standards avatar pocmo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-automation-tools's Issues

Automate upload of releases to archive.mozilla.org

We upload releases of Focus/Klar manually to archive.mozilla.org.

This is a source of errors (inconsistent file names, wrong directory structure, forgotten releases) and we should do this automatically as part of our release pipeline.

Create cron job for running losslessly optimizing png assets on repos

Like MickeyMoz's regular l10n imports, it'd be great to regularly run a lossless image optimization on registered repositories (saving size is a big deal in Android) and open PRs on all the relevant repositories.

Currently: with #19, we have scripts for a local user to do this process but we don't automatically open PRs (just provide links for the user to open them). Unfortunately, they're probably not robust enough to run on a server. I intend to run it about once a month but it'd be cool to automate.


Sebastian previously gave me info about how MickeyMoz runs:

MickeyMoz runs on taskcluster. We use the "hooks" service to run tasks periodically like cron jobs.

For example that's the task we run for creating the strings import PRs:
https://tools.taskcluster.net/hooks/project-focus/strings-import

In this case the code lives in the focus repository:
https://github.com/mozilla-mobile/focus-android/blob/master/tools/taskcluster/import_strings_and_create_pull_request.sh
https://github.com/mozilla-mobile/focus-android/blob/master/tools/taskcluster/create-pull-request.py

gradle-plugin can't be imported with new plugins DSL syntax

https://plugins.gradle.org/plugin/org.mozilla.android suggests:

plugins {
  id "org.mozilla.android" version "0.1"
}

However, when trying this in Echo Show, this results in the error:

Could not find com.android.tools.build:gradle:3.2.0.
Searched in the following locations:
  - https://plugins.gradle.org/m2/com/android/tools/build/gradle/3.2.0/gradle-3.2.0.pom
Required by:
    project :app > org.mozilla.android:org.mozilla.android.gradle.plugin:0.1 > org.mozilla.android:gradle-plugin:0.1

My best guess is that we don't include the google plugin repository in our gradle plugin definition, which the new syntax requires, but the old syntax works fine (because it uses the config from the application).

Share codecov configuration between repos

The configurations are basically duplicated for components, focus, and TV.

fwiw, on Fire TV, I noticed that there appears to be a coverage task we don't use:

./gradlew -Pcoverage tasks | grep -i coverage
createDebugCoverageReport - Creates test coverage reports for the debug variant.

I wonder if this is generated automatically rather than the jacoco task we created and use?

In the Github Browser Sample on Android Archictecture components samples repo, this task is also created and seems to cover UI tests (which we don't measure coverage for).

Add android app release validation task

Before building a release build, we should verify:

  • No uncommitted changes
  • We have a git tag checked out
  • The buildVersion matches the git tag (since git tags are unique, this ensures build versions are never re-used)
  • API keys were properly added

The first three are already addressed in a firefox-tv buildSrc/ task: https://github.com/mozilla-mobile/firefox-tv/blob/master/buildSrc/src/main/java/org/mozilla/gradle/tasks/ValidateAndroidAppReleaseConfiguration.kt

Provide recommended static analysis configuration files

Each project we set up has to get static analysis up and running. Usually, this is neglected in favor of features and then it becomes a pain to get static analysis working after the fact when many things are already failing. It'd be great if we could provide:

  • A list of recommended static analysis tools
  • Default configuration files for these tools
  • Snippets about how to add and activate these tools

So that setting it up initially is trivial so it gets done early.

Unfortunately there is no easy distribution mechanism for XML files but it only needs to happen once (and there are likely to be local edits to the configs) so I think this is fine.


Focus-android has a list of their CI tools: https://github.com/mozilla-mobile/focus-android/wiki/Automation

And the Firefox TV repo uses the most strict Android lint we can put together (in combination with warningsAsErrors). We're also working on detekt mozilla-mobile/firefox-tv#807 and those are the major configurable kotlin-friendly tools we use.

Consider striving for reproducible builds

Summary from Slack: reproducible builds allows others to guarantee that the compiled application you're running comes from the source code you've compiled so you can audit the source code (among other perks). It's not too hard to do with gradle/kotlin but currently, in Focus & friends, we:

  • Sometimes bundle API keys
  • Dynamically generate the versionCode

Full conversation:

mcomella [14:46]
Are bintray dependencies distributed with bytecode or by source? Wondering about this issue in components where a dependency includes java 8 bytecode: https://github.com/mozilla-mobile/android-components/issues/925
pocmo
#925 Cannot use dependencies with Java 8 bytecode
```The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle
android {
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
 Show more
Labels
:building_construction: build
mozilla-mobile/android-componentsToday at 05:59Added by GitHub


nalexander [15:26]
@mcomella in general, they’re distributed as JVM bytecode (.aar/.jar/.class files).

mcomella [15:39]
@nalexander Is that a problem for us? Would we prefer to build by source?

nalexander [15:39]
@mcomella I think it’s an advantage for us — shipping compiled JVM bytecode is a hell of a lot faster than building from source!
And building Google Support Libraries from source — when it’s available — probably requires checking out most of the Android source tree… it’s a huge endeavour.
Be thankful that the JVM engineers worked this out 20 years ago!
30 years ago?  Early 90s, I think.

mcomella [15:43]
:slightly_smiling_face: And I guess if we’re compiling against the libs, they can’t obfuscate their bytecode so we know what we’re getting.

@nalexander Is there any way to verify the authenticity of the source? Like this bytecode was compiled from this source tree beyond doing the compilation ourselves? And, provided we had infinite time, would it be worth us verifying our dependencies are what we think they are regularly?

nalexander [15:44]
@mcomella aye, there’s that — although Java essentially does *no* obfuscation.
It’s entirely possible (and I do it semi-regularly) to decompile Java and read the input Java.
Presumably Kotlin is a little harder to read.
And no, there’s no input-to-output verification that incorporates the sources directly.  (This is exactly like reproducible builds.)
There’s a web of trust that runs through hashes and signatures in the distribution network (Maven!).  But the hash is of the output and doesn’t capture the inputs.
And even if you could make that link, it’s incredibly difficult to capture the toolchains and local configurations…

mcomella [15:48]
Interesting, thanks for the run down

nalexander [15:52]
yw.

mcomella [15:53]
@nalexander Do you think reproduce builds is something we should strive for? It seems like it'd be straight forward with kotlin/gradle provided upstream dependencies don't change published packages but 1) we package API keys sometimes and 2) we generate the app version code

nalexander [15:54]
In general, you should strive for reproducible builds, and you probably are very close to having them.  Don’t put dates/file paths in your source code and you’re probably very close to reproducible already.
Pinning your dependencies exactly helps: i.e., don’t rely on loose semver to take patch upgrades.
But after that, it’s not worth really fighting too hard, in my opinion.

Set up continuous integration

After #30, we'll have some tests for our gradle plugin: we should add continuous integration to ensure those tests are run every build and don't fail.

Generate license.html pages for products based on gradle dependencies

Currently, we create the license.html files (firefox-tv example) by hand which is a lot of work and error-prone: it'd be great to generate the license pages and share this code across all of our projects.

Note that we may require an ability to add in extra dependencies/licenses that wouldn't show up in gradle (e.g. maybe we compile node.js dependencies into the javascript we inject into pages).

Create script to losslessly optimize image assets in repositories, create PR

i.e.

for repo in registered_moz_repostiories:
  pushd repo_dir
  optimize .
  git commit . -am "No issue: optimize!"
  git push --no-verify # and provide link to user to create PR on GH interface
  popd ..

This can be used by a user (e.g. me) on a regular basis (e.g. monthly) to optimize our assets across a few repositories. Eventually, it'd preferably move to cron job, like MickeyMoz's string imports.

Generic automated Script for String imports

We do have scripts in the Focus repository for a bot that opens PRs for string imports:

https://github.com/mozilla-mobile/focus-android/blob/master/tools/taskcluster/import_strings_and_create_pull_request.sh
https://github.com/mozilla-mobile/focus-android/blob/master/tools/taskcluster/create-pull-request.py

Those scripts are triggered from a taskcluster hook. Can we make them generic and trigger them for multiple projects without every project needing its own hook/scripts?

Consider moving AC plugin code over

We have some plugin code in our ac repository. Maybe it should live here instead?

GVNightlyVersionVerifierPlugin: This plugin can automatically update a local GeckoView dependency (currently only Nightly and currently only for a very specific configured project) if there's a newer version available. It only updates if the major version hasn't changed.
https://github.com/mozilla-mobile/android-components/blob/master/buildSrc/src/main/java/GVNightlyVersionVerifierPlugin.kt#L15

GitHubPlugin: A plugin that can open pull requests or issues in a project.
https://github.com/mozilla-mobile/android-components/blob/master/buildSrc/src/main/java/GitHubPlugin.kt

Also see docs in PR:
mozilla-mobile/android-components#934

CODE_OF_CONDUCT.md file missing

As of January 1 2019, Mozilla requires that all GitHub projects include this CODE_OF_CONDUCT.md file in the project root. The file has two parts:

  1. Required Text - All text under the headings Community Participation Guidelines and How to Report, are required, and should not be altered.
  2. Optional Text - The Project Specific Etiquette heading provides a space to speak more specifically about ways people can work effectively and inclusively together. Some examples of those can be found on the Firefox Debugger project, and Common Voice. (The optional part is commented out in the raw template file, and will not be visible until you modify and uncomment that part.)

If you have any questions about this file, or Code of Conduct policies and procedures, please see Mozilla-GitHub-Standards or email [email protected].

(Message COC001)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.