Skip to content

[URGENT] Reducing our usage of GitHub Runners #14376

Closed

Description

@lupyuen

Hi All: We have an ultimatum to reduce (drastically) our usage of GitHub Actions. Or our Continuous Integration will halt totally in Two Weeks. Here's what I'll implement within 24 hours for nuttx and nuttx-apps repos:

  1. When we submit or update a Complex PR that affects All Architectures (Arm, RISC-V, Xtensa, etc): CI Workflow shall run only half the jobs. Previously CI Workflow will run arm-01 to arm-14, now we will run only arm-01 to arm-07. (This will reduce GitHub Cost by 32%)

  2. When the Complex PR is Merged: CI Workflow will still run all jobs arm-01 to arm-14

    (Simple PRs with One Single Arch / Board will build the same way as before: arm-01 to arm-14)

  3. For NuttX Admins: Our Merge Jobs are now at github.com/NuttX/nuttx. We shall have only Two Scheduled Merge Jobs per day

    I shall quickly Cancel any Merge Jobs that appear in nuttx and nuttx-apps repos. Then at 00:00 UTC and 12:00 UTC: I shall start the Latest Merge Job at nuttxpr. (This will reduce GitHub Cost by 17%)

  4. macOS and Windows Jobs (msys2 / msvc): They shall be totally disabled until we find a way to manage their costs. (GitHub charges 10x premium for macOS runners, 2x premium for Windows runners!)

    Let's monitor the GitHub Cost after disabling macOS and Windows Jobs. It's possible that macOS and Windows Jobs are contributing a huge part of the cost. We could re-enable and simplify them after monitoring.

    (This must be done for BOTH nuttx and nuttx-apps repos. Sadly the ASF Report for GitHub Runners doesn't break down the usage by repo, so we'll never know how much macOS and Windows Jobs are contributing to the cost. That's why we need CI: Disable all jobs for macOS and Windows #14377)

    (Wish I could run NuttX CI Jobs on my M2 Mac Mini. But the CI Script only supports Intel Macs sigh. Buy a Refurbished Intel Mac Mini?)

We have done an Analysis of CI Jobs over the past 24 hours:

https://docs.google.com/spreadsheets/d/1ujGKmUyy-cGY-l1pDBfle_Y6LKMsNp7o3rbfT1UkiZE/edit?gid=0#gid=0

Many CI Jobs are Incomplete: We waste GitHub Runners on jobs that eventually get superseded and cancelled

Screenshot 2024-10-17 at 1 18 14 PM

When we Half the CI Jobs: We reduce the wastage of GitHub Runners

Screenshot 2024-10-17 at 1 15 30 PM

Scheduled Merge Jobs will also reduce wastage of GitHub Runners, since most Merge Jobs don't complete (only 1 completed yesterday)

Screenshot 2024-10-17 at 1 16 16 PM

See the ASF Policy for GitHub Actions

Activity

  1. linked a pull request that will close this issueCI: Disable all jobs for macOS and Windows #14377on Oct 17, 2024
  2. linked a pull request that will close this issueCI: Disable all jobs for macOS and Windows #2750on Oct 17, 2024
  3. lupyuen commented on Oct 17, 2024

    @lupyuen
    MemberAuthor

    As commented by @xiaoxiang781216:

    can we reduce the board on Linux host to keep macOS/Windows? it's very easy to break these host if without these basic coverage.

    I suggest that we monitor the GitHub Cost after disabling macOS and Windows Jobs. It's possible that macOS and Windows Jobs are contributing a huge part of the cost. We could re-enable and simplify them after monitoring.

  4. raiden00pl commented on Oct 17, 2024

    @raiden00pl
    Member

    One of the methods proposed by, if I remember correctly @btashton, is to replace many simple configurations for some boards (mostly for peripherals testing) with one large jumbo config activating everything possible.
    This won't work for chips with low memory, but it will save some CI resources anyway.

  5. lupyuen commented on Oct 17, 2024

    @lupyuen
    MemberAuthor

    @raiden00pl Yep I agree. Or we could test a complex target like board:lvgl?

  6. lupyuen commented on Oct 17, 2024

    @lupyuen
    MemberAuthor

    Here's another comment about macOS and Windows by @yamt: #14377 (comment)

  7. yamt commented on Oct 17, 2024

    @yamt
    Contributor

    sorry, let me ask a dumb question.
    what plan are we using? https://github.com/pricing
    is apache paying for it?

  8. lupyuen commented on Oct 17, 2024

    @lupyuen
    MemberAuthor

    what plan are we using? https://github.com/pricing

    @yamt It's probably a special plan negotiated by ASF and GitHub? It's not mentioned in the ASF Policy for GitHub Actions: https://infra.apache.org/github-actions-policy.html

    I find this "contract" a little strange. Why are all ASF Projects subjected to the same quotas? And why can't we increase the quota if we happen to have additional funding?

    Update: More info here: https://cwiki.apache.org/confluence/display/INFRA/GitHub+self-hosted+runners

    If your project uses GitHub Actions, you share a queue with all other Apache projects using Github Actions, which can quickly lead to frustration for everyone involved. Builds can be stuck in "queued" for 6+ hours.

    One option (if you want to stick with GitHub and don't want to use the Infra-managed Jenkins) is for your project to create its own self-hosted runners, which means your jobs will run on a virtual machine (VM) under your project's control. However this is not something to tackle lightly, as Infra will not manage or secure your VM - that is up to you.

    Update 2: This sounds really complicated. I'd rather use my own Mac Mini to execute the NuttX CI Tests, once a day?

  9. yamt commented on Oct 17, 2024

    @yamt
    Contributor

    what plan are we using? https://github.com/pricing

    @yamt It's probably a special plan negotiated by ASF and GitHub? It's not mentioned in the ASF Policy for GitHub Actions: https://infra.apache.org/github-actions-policy.html

    do you know if the macos/windows premium applies as usual?
    the policy page seems to have no mention about it.

    I find this "contract" a little strange. Why are all ASF Projects subjected to the same quotas? And why can't we increase the quota if we happen to have additional funding?

    yea, i guess projects have very different sizes/demands.
    (i feel nuttx is using too much anyway though :-)

  10. TimJTi commented on Oct 17, 2024

    @TimJTi
    Contributor

    ...I'd rather use my own Mac Mini to execute the NuttX CI Tests, once a day?

    Is there any merit in "farming out" CI tests to those with boards? I think there was a discussion about NuttX owning a suite of boards but not sure where that got to - and would depend on just 1 or 2 people managing it.

    As an aside, is there a guide to self-running CI? As I work on a custom board it would be good for me to do this occasionally but I have noi idea where to start!

  11. lupyuen commented on Oct 17, 2024

    @lupyuen
    MemberAuthor
  12. TimJTi commented on Oct 17, 2024

    @TimJTi
    Contributor

    @TimJTi Here's how I do daily testing on Milk-V Duo S SBC: https://lupyuen.github.io/articles/sg2000a

    And I just RTFM...the "official" guide is here so I'll review both and hopefully get it working - and submit any tweaks/corrections/enhancements I find are needed to the NuttX "How To" documentation

  13. jerpelea commented on Oct 17, 2024

    @jerpelea
    Contributor
  14. 101 remaining items

  15. lupyuen commented on Oct 31, 2024

    @lupyuen
    MemberAuthor

    It's Oct 31 and our CI Servers are still running. We made it yay! 🎉

    We got plenty to do:

    1. We made lots of fixes to the CI Workflow. I'll document everything in an article.

    2. Become more resilient and self-sufficient with Our Own Build Farm (away from GitHub)

    3. Analyse our Build Logs with Our Own Tools (instead of GitHub)

    Thank you everyone for making this happen! 🙏

    Live Update: Full-Time GitHub Runners

    (Live Image) (Live Log)

  16. cederom commented on Oct 31, 2024

    @cederom
    Contributor

    BIG THANK YOU @lupyuen FOR YOUR HELP, TIME, AND PATIENCE!!
    YOU SAVED NUTTX'S CI MAAAN :-)

  17. lupyuen commented on Nov 10, 2024

    @lupyuen
    MemberAuthor

    [Article] Optimising the Continuous Integration for NuttX

    Within Two Weeks: We squashed our GitHub Actions spending from $4,900 (weekly) down to $890. Thank you everyone for helping out, we saved our CI Servers from shutdown! 🎉

    This article explains everything we did in the (Semi-Chaotic) Two Weeks:

    (1) Shut down the macOS and Windows Builds, revive them in a different form

    (2) Merge Jobs are super costly, we moved them to the NuttX Mirror Repo

    (3) We Halved the CI Checks for Complex PRs

    (4) Simple PRs are already quite fast. (Sometimes 12 Mins!)

    (5) Coding the Build Rules for our CI Workflow, monitoring our CI Servers 24 x 7

    (6) We can’t run All CI Checks, but NuttX Devs can help ourselves!

    Check out the article: https://lupyuen.codeberg.page/articles/ci3.html

    ci3-title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions