forked from apache/nuttx
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Running NuttX CI with Self-Hosted Runners #1
Draft
lupyuen
wants to merge
23
commits into
upstream-runner
Choose a base branch
from
master
base: upstream-runner
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Running NuttX CI with Self-Hosted Runners
Read the article: https://github.com/lupyuen/lupyuen.github.io/blob/master/src/ci.md
Let's test NuttX CI with Self-Hosted Runners on macOS Arm64 and Ubuntu x64:
actions-runner
folder. TODO: How to handle/github
?(Right now I have disabled external users from triggering GitHub Actions on my repo)
We modified the GitHub Workflow Files, to use Self-Hosted Runners:
Why are we doing this?
TODO: We might need a quicker way to "fail fast" and prevent other CI Jobs from running? Which will reduce the number of Runners?
TODO: What if we could start earlier the CI Jobs that are impacted by the Modified Code in the PR? So if I modify something for Ox64 BL808 SBC, it should start the CI Job for
ox64:nsh
. If it fails, then don't bother with the rest of the Arm / RISC-V / Simulator jobs.TODO: Suppose we need to throttle our GitHub Runners from 36 Runners down to 25 Runners (and cut costs). What would be the impact on NuttX CI Duration? Are there any tools for modeling the queueing duration?
CI Build for NuttX
Our Self-Hosted Runners: Do they work for NuttX CI Builds?
Here's the result: https://github.com/lupyuen3/runner-nuttx/actions
Fetch Source
works OK on macOS Arm64Most of the Linux Builds won't work on macOS Arm64 because they need Docker on Linux x64
Podman Docker on Linux x64 fails with this error. Might be a problem with Podman.
Retested with Docker Engine, which fails with this error:
We apply this Docker Fix.
And it works yay! (2 hours on a 10-year-old MacBook Pro with Core i7)
Docker Website will throttle our downloading of Docker Images. If it gets too slow, cancel the GitHub Workflow and restart. Throttling will magically disappear.
Build macOS (macos / sim-01 / sim-02)
on macOS Arm64:setup-python
will hang because it's prompting for password. So we comment outsetup-python
.Then it fails while downloading the toolchain
Retry and it fails at objcopy sigh:
TODO: Do we change the toolchain from x64 to Arm64?
Can we guesstimate the time to run a CI Build?
Just browse the GitHub Actions Log for the CI Build. See the Line Numbers? Every NuttX CI Build will have roughly 1,000 lines of log (by sheer coincidence). We can use this to guess the CI Build Duration.
Documentation Build for NuttX
Does it work for Documentation Build?
Documentation
on macOS Arm64: Hangs at setup-python because it prompts for password:And it won't work on macOS because it needs
apt
: workflows/doc.ymlDocumentation
on Linux Arm64: Fails at setup-pythonSo we comment out
setup-python
. Then it fails with pip3 not found:TODO: Switch to pipenv
Documentation
on Linux x64: Fails with rmdir errorTODO: Check the rmdir directory
UTM Emulator for macOS Arm64
So NuttX CI works better with a huge x64 Ubuntu PC. Can we make macOS on Arm64 more useful?
Now testing UTM Emulator for macOS Arm64, to emulate Ubuntu x64 (because my MacBook Pro x64 is running too hot and slow).
Here's our Emulated Ubuntu x64 24.04.1 LTS with 4GB RAM: Build for arm-01, Build for arm-02, Build for arm-03, Build for arm-04
Does it work? Yes! How many hours? 4 hours! (Instead of 33 mins when hosted at GitHub)
TODO: Do we run multiple Virtual Machines in macOS UTM?
Alternatively: Running a Self-Hosted Runner inside a Docker Container (Rancher Desktop) on macOS Arm64
But Then: It becomes a Linux Arm64 Runner, not a Linux x64 Runner. Which won't work with our current NuttX CI Docker Image, which is x64 only.
Unless: We create a Linux Arm64 Docker Image for NuttX CI? Like for Compiling RISC-V Platforms?
Fixes for Ubuntu x64
Fixes for macOS Arm64
Ubuntu x64 Runner In Action
macOS Arm64 with UTM Emulation:
On a powerful Mac Mini (M2 Pro, 32 GB RAM): We can emulate an Intel i7 PC with 32 CPUs and 4 GB RAM (we don't need much RAM)
Ubuntu Disk Space in UTM VM needs to be big enough for NuttX Docker Image:
During
Download Source Artifact
: GitHub seems to be throttling the download (total 700 MB over 25 mins)During
Run Builds
: CPU hits 100%Note: Don't leave System Monitor running, it consumes quite a bit of CPU!
Why emulate 32 CPUs? That's because we want to max out the macOS Arm64 CPU Utilisation. Here's our chance to watch Mac Mini run smokin' hot!
Here's how it runs:
Runner Options:
MacBook Pro x64 with Ubuntu:
Ubuntu CPU on MacBook Pro hits 100% when running the Linux Build for NuttX CI: Build for arm-02