-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[HELP] Running github actions locally with act #14601
Comments
@lupyuen is our ci guru, could you answer this problem? |
@stbenn Thank you so much for asking! Yep it's super important to test our PRs before submitting. But our CI Workflow is going through plenty of changes (due to cost cutting), lemme know if anything below isn't quite correct thanks :-) GitHub ACT is probably too complicated? I recommend 2 ways of testing our PRs:
(1) might be slower, depending on your PC. With (2) we don't need to worry about Wasting GitHub Runners, so long as the CI Workflow runs entirely in your repo, before submitting to NuttX Repo. (I'll explain) Option 1: Run the CI Builds with DockerSuppose our PR is at ## Build a NuttX Target Group with Docker
## Parameter is the Target Group, like "arm-01"
job=arm-01
## TODO: Install Docker Engine
## https://docs.docker.com/engine/install/ubuntu/
## TODO: For WSL, we may need to install Docker on Native Windows
## https://github.com/apache/nuttx/issues/14601#issuecomment-2453595402
## Download the Docker Image for NuttX
sudo docker pull \
ghcr.io/apache/nuttx/apache-nuttx-ci-linux:latest
## Inside the Docker Container:
## Build the Target Group
sudo docker run -it \
ghcr.io/apache/nuttx/apache-nuttx-ci-linux:latest \
/bin/bash -c "
cd ;
pwd ;
git clone https://github.com/USER/nuttx --branch BRANCH ;
git clone https://github.com/apache/nuttx-apps apps ;
pushd nuttx ; echo NuttX Source: https://github.com/apache/nuttx/tree/\$(git rev-parse HEAD) ; popd ;
pushd apps ; echo NuttX Apps: https://github.com/apache/nuttx-apps/tree/\$(git rev-parse HEAD) ; popd ;
cd nuttx/tools/ci ;
(./cibuild.sh -c -A -N -R testlist/$job.dat || echo '***** BUILD FAILED') ;
"
## Free up the Docker disk space
sudo docker system prune --force It the CI Build fails, we will see "BUILD FAILED". Remember I said it's slow? That's because we need to repeat the above for ## Build All Target Groups
## TODO: Add risc-v, xtensa, arm64, other, etc
for job in \
arm-01 arm-02 arm-03 arm-04 \
arm-05 arm-06 arm-07 arm-08 \
arm-09 arm-10 arm-11 arm-12 \
arm-13 arm-14
do
## Build the Target Group
run_job $job
## Watch for for "BUILD FAILED"
sleep 10
done Alternative we could build a Single Target (instead of an Entire Target Group)... ## Change the above from:
## cd nuttx/tools/ci ;
## (./cibuild.sh -c -A -N -R testlist/$job.dat || echo '***** BUILD FAILED') ;
## To:
cd nuttx ;
tools/configure.sh ox64:nsh ;
make ; But our Docker Build won't run the macOS and Windows Jobs. Quicker Way is probably to use GitHub Actions... Option 2: Run the CI Builds with GitHub Actions(See Also: How to Force-Build a Branch) Suppose our PR is at
|
@lupyuen maybe this explanation should be included in our Contributing documentation, like a recommended step before creating the PR. |
@lupyuen I will try the docker version this weekend on a fresh install and take notes if theres any special steps I needed for it to work. In case others want to do this in the future as well |
@lupyuen The running locally with docker was exactly what I was looking for, thank you! :) I am not sure if it is strictly necessary for this, but to get docker working properly for act on WSL2, I needed to do these first:
|
@stbenn Thank you so much! I'll update the instructions :-) |
Yep that's because GCC Compiler helpfully colours the messages with ANSI Escape Codes :-) Try this to remove the Special Characters: ## Strip the control chars
function clean_log {
local tmp_file=/tmp/release-tmp.log
cat $log_file \
| tr -d '\r' \
| tr -d '\r' \
| sed 's/\x08/ /g' \
| sed 's/\x1B(B//g' \
| sed 's/\x1B\[K//g' \
| sed 's/\x1B[<=>]//g' \
| sed 's/\x1B\[[0-9:;<=>?]*[!]*[A-Za-z]//g' \
| sed 's/\x1B[@A-Z\\\]^_]\|\x1B\[[0-9:;<=>?]*[-!"#$%&'"'"'()*+,.\/]*[][\\@A-Z^_`a-z{|}~]//g' \
>$tmp_file
mv $tmp_file $log_file
echo ----- "Done! $log_file"
} https://github.com/lupyuen/nuttx-release/blob/main/run-ci.sh#L30-L47 |
Description
I am looking for ways to better verify my work before doing a pull request, to prevent unsuccessful use of the runners. I came across act, which has an extension for the github cli that claims to run workflows locally.
Has anyone had tried or had success with this before? I have it recognizing the workflows but am having failures from access tokens, password requirements, etc.
Trying to run it on Ubuntu-24.04 in WSL2
Verification
The text was updated successfully, but these errors were encountered: