Skip to content

Conversation

@titanous
Copy link
Contributor

@titanous titanous commented Jan 5, 2021

This configuration is equivalent, except that Ubuntu and Java are updated to the latest LTS releases.

Fixes: #4174

@gnprice
Copy link
Member

gnprice commented Jan 6, 2021

Excellent, thanks!

I don't see results from it shown here on this PR thread. Perhaps the workflow needs to exist on a branch in the repo itself? I'll go read some of the docs, and experiment with pushing this commit to a branch here.

@gnprice
Copy link
Member

gnprice commented Jan 6, 2021

... Ha, OK! I:

image

In fact it looks like two of them: one for having pushed to a branch, and one for having made a PR from that branch.

I guess because it's the same commit, it's probably showing the same runs' results on both PRs.

@titanous
Copy link
Contributor Author

titanous commented Jan 6, 2021

The (push) runs against the latest ref from the branch, and the (pull_request) runs against a trial merge into the base of the PR. This article explains in more detail.

Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @titanous ! Small comments below -- otherwise this looks great.

There's a couple of bits this drops from the config, which are good to drop because we haven't been using them but it'd be good to mention in the commit message.


env:
global:
- COVERALLS_REPO_TOKEN=4eYQDtWoBJlDz2QkxoQ2UcnmJFcOB7zkv
Copy link
Member

Choose a reason for hiding this comment

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

This gets dropped.

That's fine, because we haven't actually been using Coveralls in this repo for several years.

Copy link
Contributor Author

@titanous titanous Jan 6, 2021

Choose a reason for hiding this comment

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

Noted in commit message.

Comment on lines -11 to -23
android:
components:
# all the android components used in the zulip-mobile and it's dependencies
- tools
- platform-tools
- build-tools-28.0.3
- android-29 # corresponds to compileSdkVersion
- extra-google-m2repository
- extra-android-m2repository
- extra-google-android-support

licenses:
- 'android-sdk-license-.+'
Copy link
Member

Choose a reason for hiding this comment

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

Huh, all this detail goes away!

As best I can tell from that action's implementation:
https://github.com/android-actions/setup-android/blob/main/src/main.ts
it just installs all versions of the tools:

  await exec.exec(
    sdkManager,
    ['--include_obsolete', `--sdk_root=${ANDROID_SDK_ROOT}`, 'tools'],
    {input: acceptBuffer}
  )

There seems to be no downside, though, because it's quite fast -- only takes 1s to run (and GH Actions doesn't show times at finer granularity than that.) I guess the caching must be pretty great!

Copy link
Contributor Author

@titanous titanous Jan 6, 2021

Choose a reason for hiding this comment

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

Noted in commit message.


language: android

jdk: oraclejdk8
Copy link
Member

Choose a reason for hiding this comment

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

This gets updated to version 11. That's for the best -- since 0e45fda we've been recommending at least that version for development, so ideally this would have been already updated then.

Copy link
Contributor Author

@titanous titanous Jan 6, 2021

Choose a reason for hiding this comment

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

Noted in commit message.

@@ -1,46 +0,0 @@
dist: trusty
Copy link
Member

Choose a reason for hiding this comment

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

Glad to be rid of this line! Don't know if you've already spotted this in the Git history, but here's the reason we've been running our Travis builds on Trusty:

commit 64e02a8
Author: Greg Price [email protected]
Date: Tue Jul 23 14:53:47 2019 -0700

travis: Stay on working Trusty, while "xenial" is really Precise.

Fixes #3565.

Travis CI is migrating their default build environments from
14.04 Trusty to 16.04 Xenial.  That's more than reasonable --
Trusty went EOL a few months ago.

But for Android they don't yet have a Xenial image.  And when you
request a Xenial image for Android... what you actually get turns
out to be a *12.04 Precise* image.  Which went EOL over two years
ago, and which naturally things don't always run on.

[…]

Fix it by explicitly sticking with Trusty, as the least-ancient
option available.

More details in the issue thread #3565.  I also just reported the
issue to Travis on their forum:
  https://travis-ci.community/t/android-builds-default-to-precise-which-is-2-years-eol/4352

It looks like currently ubuntu-latest on GH Actions means 18.04 Bionic, and presumably at some point it'll start meaning 20.04 Focal. Sounds good.

Copy link
Contributor Author

@titanous titanous Jan 6, 2021

Choose a reason for hiding this comment

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

Noted in commit message.

Comment on lines -25 to -31
notifications:
email: false
webhooks:
urls:
- https://zulip.org/zulipbot/travis
on_success: always
on_failure: always
Copy link
Member

Choose a reason for hiding this comment

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

This gets dropped.

That's fine, because we don't have zulipbot actually doing anything with these notifications, and haven't for years.

Copy link
Contributor Author

@titanous titanous Jan 6, 2021

Choose a reason for hiding this comment

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

Noted in commit message.

Comment on lines 25 to 28
- name: Run yarn install
uses: bahmutov/npm-install@v1
Copy link
Member

Choose a reason for hiding this comment

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

Huh, does this actually -- huh, I guess this does indeed use Yarn!

Probably deserves a one-line comment to acknowledge that yes, the name sounds like it does npm install, but it actually does yarn install.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted in comment.

Comment on lines -39 to -42
# See the mention of `inotify` in docs/. If we attempt assembleRelease,
# then without this line the JS bundle step fails with a baffling ENOSPC
# error, even though there's tons of free space on the filesystem.
- echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Copy link
Member

Choose a reason for hiding this comment

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

This bit goes away. Here's the commit that added it (and nothing else):

commit 65882db
Author: Greg Price [email protected]
Date: Wed Nov 14 17:59:19 2018 -0800

travis: Add incantation to fix release build (but don't actually do it.)

With this rather arcane, but harmless, command, the mysterious ENOSPC
error caused in Travis by switching to the release build no longer
happens, and the build completes successfully.

On the downside, the build is about 4 minutes longer -- over 50%
longer -- than with the debug build.  That JS bundle step is *slow* in
Travis.  So although it works, it's not worth the time penalty to do
on every PR; we'll leave it on debug.

We may sometimes want to turn it on in the future, though.  So leave
this here to prevent repeating this debugging session.

I think that's still a good reason to keep it in. In fact now that we'll be on GH Actions, I think it becomes more likely that we'll try re-adding a release build. We'd do it as a separate job running in parallel, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment with this info. Given that it will run in a separate job, I don't think we need to actually run the command in the current config.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, makes sense.

with:
node-version: '12'
check-latest: true

Copy link
Member

Choose a reason for hiding this comment

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

nit: whitespace at end of line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, it seems like it wasn't. But easy for me to fix before merge 🙂

@gnprice
Copy link
Member

gnprice commented Jan 6, 2021

The (push) runs against the latest ref from the branch, and the (pull_request) runs against a trial merge into the base of the PR. This article explains in more detail.

Ah, good to know.

In our usual workflow we don't push to branches here -- we each push feature branches to our respective personal forks and send those as PRs. So I think that means that typically push won't run on a PR, only pull_request, and push will run when there's a push to master (the only branch we routinely push to.)

@gnprice
Copy link
Member

gnprice commented Jan 6, 2021

After the small changes discussed above and after we merge this, If you're interested, I think there's a couple of followups this opens up that would potentially make the CI significantly faster and nicer than it's ever previously been:

  • Cache node_modules, to save a good chunk of the time.
  • Split into several jobs that run in parallel (and call tools/test with specific suite names to do different parts of the tests), to make it faster still.
    • Probably these would all depend on a common initial job that does yarn install and saves to the aforementioned cache.
  • Persuade Flow to stop spewing "Please wait. Server is initializing (parsed files 30000)" messages, and persuade Jest and Flow and other tools to use color.
    • This would probably involve adding an option like --ci to tools/test and passing it here. Then each suite in tools/test would pass the appropriate options to tell the respective underlying tool what to do.
    • It'd replace the TERM=dumb, which is a bit of a crude solution explained in 6614384 for getting Gradle to stop spewing something a lot like that Flow spew. That TERM=dumb is likely the reason Jest isn't showing color; and on the other hand Flow didn't take the hint.
  • Get the fancy log grouping like some of the upstream actions do, with ⯈/⯆ expandos. It looks like they do this with calls like core.startGroup('Running foo'), using the NPM package @actions/core. ... And looking at that function's implementation (1, 2), I think that boils down to echo "::group::Running foo". (With a bit of percent-encoding in case the message contains newlines.)
    • This might not be relevant if we end up splitting the tools/test run completely into separate jobs. Or for that matter we could split it into separate steps, which might also make this irrelevant. Well, it was entertaining for me to dig into just now. 🙂

@titanous
Copy link
Contributor Author

titanous commented Jan 6, 2021

Thanks for the detailed review!

Cache node_modules, to save a good chunk of the time.

The npm-install action already does this.

The configuration is similar, with these changes:

- Update from Java 8 to Java 11, the recommended version for
  development
- Update from Ubuntu 14.04 to 18.04 (and eventually 20.04
  automatically)
- Rely on the setup-android action to provide all versions of the
  tools
- Remove unused Zulipbot webhook
- Remove unused Coveralls token

Fixes: zulip#4174
@gnprice gnprice merged commit 7dfa1c2 into zulip:master Jan 6, 2021
@gnprice
Copy link
Member

gnprice commented Jan 6, 2021

And merged 🎉 -- thanks!

I made some small whitespace changes, and small edits to the commit message -- mostly just wrapping it to within 70 columns.

@gnprice
Copy link
Member

gnprice commented Jan 6, 2021

Cache node_modules, to save a good chunk of the time.

The npm-install action already does this.

Hmm! That'd make sense, but... it looks like that step took 1m29s on the run after your update. That's about as long as it was on the previous revision (1m35s), and seems like long enough to install the node_modules from scratch.

Maybe the cache will only work after there's a version in master? I guess we'll find out. If it continues to not benefit from caching, then I guess we'll want to debug.

@titanous titanous deleted the github-actions branch January 6, 2021 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to GitHub Actions (from Travis CI)

2 participants