Skip to content
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

[Guide] How to Verify a PR Merge #14407

Closed
lupyuen opened this issue Oct 19, 2024 · 1 comment
Closed

[Guide] How to Verify a PR Merge #14407

lupyuen opened this issue Oct 19, 2024 · 1 comment

Comments

@lupyuen
Copy link
Member

lupyuen commented Oct 19, 2024

(See Also: How to run CI Checks on a PR before Submission)

When NuttX merges our PR, the Merge Job won't run until 00:00 UTC and 12:00 UTC. How can we be really sure that our PR was merged correctly?

Let's create a GitHub Org (at no cost), fork the NuttX Repo and trigger the CI Workflow. (Which won't charge any extra GitHub Runner Minutes to NuttX Project!)

  1. Head to our GitHub Dashboard. Create a New Organisation. Give it any name (probably your GitHub ID appended with 2)

    Screenshot 2024-10-19 at 8 11 22 AM

    Screenshot 2024-10-19 at 8 13 07 AM

    Screenshot 2024-10-19 at 8 14 03 AM

  2. Browse to NuttX Repo. Click Fork and select our GitHub Org.

    Screenshot 2024-10-19 at 8 16 35 AM

    Screenshot 2024-10-19 at 8 17 42 AM

  3. We enable GitHub Actions (which won't be charged to NuttX Project)

    Screenshot 2024-10-19 at 8 18 25 AM

    Screenshot 2024-10-19 at 8 19 05 AM

  4. master branch will no longer auto-build when we sync with upstream. To fix this: We rename master branch to releases/master...

    Browse to our NuttX Repo, click Settings > Default Branch > Rename Branch > releases/master

    Screenshot 2024-11-04 at 5 36 15 AM

  5. To trigger the CI Workflow, we Create a File

    Screenshot 2024-10-19 at 8 19 52 AM

    Screenshot 2024-10-19 at 8 21 06 AM

    Screenshot 2024-10-19 at 8 22 06 AM

    (Note: master branch in the screenshots should be releases/master instead)

    (Actually the Commit History will look messy if we do the above, and Discard Commit won't appear. I prefer to keep the master branch, and run this script to enable builds)

  6. Head back to GitHub Actions to Check the CI Workflow

    Screenshot 2024-10-19 at 8 23 04 AM

    Screenshot 2024-10-19 at 8 25 15 AM

    (Note: master branch in the screenshots should be releases/master instead)

  7. When We Merge Another PR: Click Sync Fork > Discard Commits. CI Workflow will auto-start (no need to create a file to trigger it)

    Screenshot 2024-10-19 at 8 53 25 AM

    (Note: master branch in the screenshot should be releases/master instead)

    If "Discord Commits" doesn't appear: Click "Update Branch". (See the "Messy Commit History" comment above)

    For The Next Update: Click Sync Fork > Update Branch

  8. To Run macOS and Windows Jobs: Edit .github/workflows/build.yml. Modify the 4 references to arch.yml, point them to our GitHub Org at releases/master branch:

    Linux-Arch:
      uses: YOUR_ORG/nuttx/.github/workflows/arch.yml@releases/master
    
    macOS-Arch:
      uses: YOUR_ORG/nuttx/.github/workflows/arch.yml@releases/master
    
    msys2-Arch:
      uses: YOUR_ORG/nuttx/.github/workflows/arch.yml@releases/master
    
    msvc-Arch:
      uses: YOUR_ORG/nuttx/.github/workflows/arch.yml@releases/master

    Then edit .github/workflows/arch.yml. Delete this section:

    # Skip all macOS Builds
    if [[ "${{ inputs.os }}" == "macOS" ]]; then
      echo "Skipping all macOS Builds"
      echo "skip_all_builds=1" | tee -a $GITHUB_OUTPUT
      exit
    fi

    (Or use a script like this)

  9. Optional: Disable fail-fast so that it runs all builds, regardless of error. Remove max-parallel so that it will use unlimited concurrent runners. Edit .github/workflows/build.yml, change...

    Linux: ...
      strategy:
        max-parallel: 12
    
    macOS: ...
      strategy:
        max-parallel: 2

    To...

    Linux: ...
      strategy:
        fail-fast: false
    
    macOS: ...
      strategy:
        fail-fast: false

    (Like this)

  10. What about nuttx-apps? Just fork nuttx repo (not nuttx-apps) and trigger the CI Workflow, the exact same way as above. The CI Workflow will checkout and compile apache/nuttx-apps, which contains the NuttX Apps that we have merged.

    - name: Checkout apps repo
    uses: actions/checkout@v4
    with:
    repository: apache/nuttx-apps
    ref: ${{ steps.gittargets.outputs.apps_ref }}
    path: sources/apps
    fetch-depth: 1

    (That's why we don't need a Scheduled Merge Job for nuttx-apps. Everything is already inside the Scheduled Merge Job for nuttx)

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

No branches or pull requests

1 participant