CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
# Identify the Arch for the PR and select the applicable builds
|
|
|
|
name: Arch
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
os:
|
|
|
|
description: "Operating System hosting the build: Linux, macOS or msys2"
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
boards:
|
|
|
|
description: "List of All Builds: [arm-01, risc-v-01, xtensa-01, ...]"
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
outputs:
|
|
|
|
skip_all_builds:
|
|
|
|
description: "Set to 1 if all builds should be skipped"
|
|
|
|
value: ${{ jobs.Select-Builds.outputs.skip_all_builds }}
|
|
|
|
selected_builds:
|
|
|
|
description: "Selected Builds for the PR: [arm-01, risc-v-01, xtensa-01, ...]"
|
|
|
|
value: ${{ jobs.Select-Builds.outputs.selected_builds }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Select-Builds:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
outputs:
|
|
|
|
skip_all_builds: ${{ steps.select-builds.outputs.skip_all_builds }}
|
|
|
|
selected_builds: ${{ steps.select-builds.outputs.selected_builds }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
# Get the Arch for the PR: arm, arm64, risc-v, xtensa, ...
|
|
|
|
- name: Get arch
|
|
|
|
id: get-arch
|
|
|
|
run: |
|
|
|
|
|
|
|
|
# If PR is Not Created or Modified: Build all targets
|
|
|
|
pr=${{github.event.pull_request.number}}
|
|
|
|
if [[ "$pr" == "" ]]; then
|
2024-10-10 09:43:13 +08:00
|
|
|
echo "Not a Created or Modified PR, will build all targets"
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
# Ignore the Label "Area: Documentation", because it won't affect the Build Targets
|
|
|
|
query='.labels | map(select(.name != "Area: Documentation")) | '
|
|
|
|
select_name='.[].name'
|
|
|
|
select_length='length'
|
|
|
|
|
2024-10-10 09:43:13 +08:00
|
|
|
# Get the Labels for the PR: "Arch: risc-v \n Board: risc-v \n Size: XS"
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
# If GitHub CLI Fails: Build all targets
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
labels=$(gh pr view $pr --repo $GITHUB_REPOSITORY --json labels --jq "$query$select_name" || echo "")
|
|
|
|
numlabels=$(gh pr view $pr --repo $GITHUB_REPOSITORY --json labels --jq "$query$select_length" || echo "")
|
|
|
|
echo "labels=$labels"
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
echo "numlabels=$numlabels" | tee -a $GITHUB_OUTPUT
|
|
|
|
|
2024-10-10 09:43:13 +08:00
|
|
|
# Identify the Size, Arch and Board Labels
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
if [[ "$labels" == *"Size: "* ]]; then
|
|
|
|
echo 'labels_contain_size=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
fi
|
2024-10-10 09:43:13 +08:00
|
|
|
if [[ "$labels" == *"Arch: "* ]]; then
|
|
|
|
echo 'labels_contain_arch=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
fi
|
|
|
|
if [[ "$labels" == *"Board: "* ]]; then
|
|
|
|
echo 'labels_contain_board=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get the Arch Label
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
if [[ "$labels" == *"Arch: arm64"* ]]; then
|
|
|
|
echo 'arch_contains_arm64=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Arch: arm"* ]]; then
|
|
|
|
echo 'arch_contains_arm=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Arch: risc-v"* ]]; then
|
|
|
|
echo 'arch_contains_riscv=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Arch: simulator"* ]]; then
|
|
|
|
echo 'arch_contains_sim=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Arch: x86_64"* ]]; then
|
|
|
|
echo 'arch_contains_x86_64=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Arch: xtensa"* ]]; then
|
|
|
|
echo 'arch_contains_xtensa=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
fi
|
2024-10-10 09:43:13 +08:00
|
|
|
|
|
|
|
# Get the Board Label
|
|
|
|
if [[ "$labels" == *"Board: arm64"* ]]; then
|
|
|
|
echo 'board_contains_arm64=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Board: arm"* ]]; then
|
|
|
|
echo 'board_contains_arm=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Board: risc-v"* ]]; then
|
|
|
|
echo 'board_contains_riscv=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Board: simulator"* ]]; then
|
|
|
|
echo 'board_contains_sim=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Board: x86_64"* ]]; then
|
|
|
|
echo 'board_contains_x86_64=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
elif [[ "$labels" == *"Board: xtensa"* ]]; then
|
|
|
|
echo 'board_contains_xtensa=1' | tee -a $GITHUB_OUTPUT
|
|
|
|
fi
|
|
|
|
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
# Select the Builds for the PR: arm-01, risc-v-01, xtensa-01, ...
|
|
|
|
- name: Select builds
|
|
|
|
id: select-builds
|
|
|
|
run: |
|
|
|
|
|
CI: Enable builds for msys2, msvc, arm-08, arm-10, arm-13 for Complex PRs
This PR enables the CI Builds for msys2, msvc, arm-08, arm-10, arm-13 for Complex PRs. We disable the CI Builds for arm-01, arm-09, arm-11.
This will help to fix the recent breakage of builds: https://github.com/apache/nuttx/issues/14598
2024-11-02 08:34:55 +08:00
|
|
|
# Skip all macOS Builds
|
|
|
|
if [[ "${{ inputs.os }}" == "macOS" ]]; then
|
|
|
|
echo "Skipping all macOS Builds"
|
2024-10-17 14:33:44 +08:00
|
|
|
echo "skip_all_builds=1" | tee -a $GITHUB_OUTPUT
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
# Fetch the outputs from the previous step
|
2024-10-10 09:43:13 +08:00
|
|
|
numlabels=${{ steps.get-arch.outputs.numlabels }}
|
|
|
|
labels_contain_size=${{ steps.get-arch.outputs.labels_contain_size }}
|
|
|
|
labels_contain_arch=${{ steps.get-arch.outputs.labels_contain_arch }}
|
|
|
|
labels_contain_board=${{ steps.get-arch.outputs.labels_contain_board }}
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
arch_contains_arm=${{ steps.get-arch.outputs.arch_contains_arm }}
|
|
|
|
arch_contains_arm64=${{ steps.get-arch.outputs.arch_contains_arm64 }}
|
|
|
|
arch_contains_riscv=${{ steps.get-arch.outputs.arch_contains_riscv }}
|
|
|
|
arch_contains_sim=${{ steps.get-arch.outputs.arch_contains_sim }}
|
|
|
|
arch_contains_x86_64=${{ steps.get-arch.outputs.arch_contains_x86_64 }}
|
|
|
|
arch_contains_xtensa=${{ steps.get-arch.outputs.arch_contains_xtensa }}
|
2024-10-10 09:43:13 +08:00
|
|
|
board_contains_arm=${{ steps.get-arch.outputs.board_contains_arm }}
|
|
|
|
board_contains_arm64=${{ steps.get-arch.outputs.board_contains_arm64 }}
|
|
|
|
board_contains_riscv=${{ steps.get-arch.outputs.board_contains_riscv }}
|
|
|
|
board_contains_sim=${{ steps.get-arch.outputs.board_contains_sim }}
|
|
|
|
board_contains_x86_64=${{ steps.get-arch.outputs.board_contains_x86_64 }}
|
|
|
|
board_contains_xtensa=${{ steps.get-arch.outputs.board_contains_xtensa }}
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
|
|
|
|
# inputs.boards is a JSON Array: ["arm-01", "risc-v-01", "xtensa-01", ...]
|
|
|
|
# We compact and remove the newlines
|
|
|
|
boards=$( echo '${{ inputs.boards }}' | jq --compact-output ".")
|
|
|
|
numboards=$( echo "$boards" | jq "length" )
|
|
|
|
|
2024-10-10 09:43:13 +08:00
|
|
|
# We consider only Simple PRs with:
|
|
|
|
# Arch + Size Labels Only
|
|
|
|
# Board + Size Labels Only
|
|
|
|
# Arch + Board + Size Labels Only
|
|
|
|
if [[ "$labels_contain_size" != "1" ]]; then
|
|
|
|
echo "Size Label Missing, will build all targets"
|
|
|
|
quit=1
|
|
|
|
elif [[ "$numlabels" == "2" && "$labels_contain_arch" == "1" ]]; then
|
|
|
|
echo "Arch + Size Labels Only"
|
|
|
|
elif [[ "$numlabels" == "2" && "$labels_contain_board" == "1" ]]; then
|
|
|
|
echo "Board + Size Labels Only"
|
|
|
|
elif [[ "$numlabels" == "3" && "$labels_contain_arch" == "1" && "$labels_contain_board" == "1" ]]; then
|
|
|
|
# Arch and Board must be the same
|
|
|
|
if [[
|
|
|
|
"$arch_contains_arm" != "$board_contains_arm" ||
|
|
|
|
"$arch_contains_arm64" != "$board_contains_arm64" ||
|
|
|
|
"$arch_contains_riscv" != "$board_contains_riscv" ||
|
|
|
|
"$arch_contains_sim" != "$board_contains_sim" ||
|
|
|
|
"$arch_contains_x86_64" != "$board_contains_x86_64" ||
|
|
|
|
"$arch_contains_xtensa" != "$board_contains_xtensa"
|
|
|
|
]]; then
|
|
|
|
echo "Arch and Board are not the same, will build all targets"
|
|
|
|
quit=1
|
|
|
|
else
|
|
|
|
echo "Arch + Board + Size Labels Only"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Not a Simple PR, will build all targets"
|
|
|
|
quit=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If Not a Simple PR: Build all targets
|
|
|
|
if [[ "$quit" == "1" ]]; then
|
2024-10-18 18:53:57 +08:00
|
|
|
# If PR was Created or Modified: Exclude some boards
|
2024-10-17 23:37:41 +08:00
|
|
|
pr=${{github.event.pull_request.number}}
|
|
|
|
if [[ "$pr" != "" ]]; then
|
CI: Enable builds for msys2, msvc, arm-08, arm-10, arm-13 for Complex PRs
This PR enables the CI Builds for msys2, msvc, arm-08, arm-10, arm-13 for Complex PRs. We disable the CI Builds for arm-01, arm-09, arm-11.
This will help to fix the recent breakage of builds: https://github.com/apache/nuttx/issues/14598
2024-11-02 08:34:55 +08:00
|
|
|
echo "Excluding arm-0[1249], arm-1[124-9], risc-v-04..06, sim-03, xtensa-02"
|
2024-10-18 18:53:57 +08:00
|
|
|
boards=$(
|
2024-10-17 23:37:41 +08:00
|
|
|
echo '${{ inputs.boards }}' |
|
2024-10-18 18:53:57 +08:00
|
|
|
jq --compact-output \
|
|
|
|
'map(
|
|
|
|
select(
|
CI: Enable builds for msys2, msvc, arm-08, arm-10, arm-13 for Complex PRs
This PR enables the CI Builds for msys2, msvc, arm-08, arm-10, arm-13 for Complex PRs. We disable the CI Builds for arm-01, arm-09, arm-11.
This will help to fix the recent breakage of builds: https://github.com/apache/nuttx/issues/14598
2024-11-02 08:34:55 +08:00
|
|
|
test("arm-0[1249]") == false and test("arm-1[124-9]") == false and
|
2024-10-18 18:53:57 +08:00
|
|
|
test("risc-v-0[4-9]") == false and
|
2024-10-24 08:56:20 +08:00
|
|
|
test("sim-0[3-9]") == false and
|
2024-10-18 18:53:57 +08:00
|
|
|
test("xtensa-0[2-9]") == false
|
|
|
|
)
|
|
|
|
)'
|
2024-10-17 23:37:41 +08:00
|
|
|
)
|
|
|
|
fi
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
echo "selected_builds=$boards" | tee -a $GITHUB_OUTPUT
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
# For every board
|
|
|
|
for (( i=0; i<numboards; i++ ))
|
|
|
|
do
|
|
|
|
# Fetch the board
|
|
|
|
board=$( echo "$boards" | jq ".[$i]" )
|
|
|
|
skip_build=0
|
|
|
|
|
2024-10-10 09:43:13 +08:00
|
|
|
# For "Arch / Board: arm": Build arm-01, arm-02, ...
|
|
|
|
if [[ "$arch_contains_arm" == "1" || "$board_contains_arm" == "1" ]]; then
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
if [[ "$board" != *"arm-"* ]]; then
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
skip_build=1
|
|
|
|
fi
|
|
|
|
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
# For "Arch / Board: arm64": Build arm64-01
|
2024-10-10 09:43:13 +08:00
|
|
|
elif [[ "$arch_contains_arm64" == "1" || "$board_contains_arm64" == "1" ]]; then
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
if [[ "$board" != *"arm64-"* ]]; then
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
skip_build=1
|
|
|
|
fi
|
|
|
|
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
# For "Arch / Board: risc-v": Build risc-v-01, risc-v-02, ...
|
2024-10-10 09:43:13 +08:00
|
|
|
elif [[ "$arch_contains_riscv" == "1" || "$board_contains_riscv" == "1" ]]; then
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
if [[ "$board" != *"risc-v-"* ]]; then
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
skip_build=1
|
|
|
|
fi
|
|
|
|
|
2024-10-10 09:43:13 +08:00
|
|
|
# For "Arch / Board: simulator": Build sim-01, sim-02
|
|
|
|
elif [[ "$arch_contains_sim" == "1" || "$board_contains_sim" == "1" ]]; then
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
if [[ "$board" != *"sim-"* ]]; then
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
skip_build=1
|
|
|
|
fi
|
|
|
|
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
# For "Arch / Board: x86_64": Build x86_64-01
|
2024-10-10 09:43:13 +08:00
|
|
|
elif [[ "$arch_contains_x86_64" == "1" || "$board_contains_x86_64" == "1" ]]; then
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
if [[ "$board" != *"x86_64-"* ]]; then
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
skip_build=1
|
|
|
|
fi
|
|
|
|
|
2024-10-10 09:43:13 +08:00
|
|
|
# For "Arch / Board: xtensa": Build xtensa-01, xtensa-02
|
|
|
|
elif [[ "$arch_contains_xtensa" == "1" || "$board_contains_xtensa" == "1" ]]; then
|
CI: Split the Build Jobs for Arm64 and x86_64
This PR creates the new CI Build Jobs `arm64-01` and `x86_64-01`. The new jobs will split and offload the Arm64 and x86_64 Build Targets from `other`. This will reduce our usage of GitHub Runners, to comply with the ASF Policy for GitHub Actions. (Recently we see more PRs for Arm64 and x86_64)
Before the Split: Simple PRs (One Arch and/or One Board) for Arm64 and x86_64 require almost 1 hour for CI Build
- `other` (57 mins): AVR, SPARC, x86, PinePhone, QEMU Arm64, QEMU x86_64
After the Split: Simple PRs for Arm64 and x86_64 will complete under 30 mins
- `other` (24 mins): AVR, SPARC, x86
- `arm64-01` (29 mins): PinePhone, QEMU Arm64
- `x86_64-01` (9 mins): QEMU x86_64
To skip more unnecessary builds: Our Build Rules `arch.yml` shall ignore the label "Area: Documentation", so that a Simple PR + Docs is still a Simple PR. Previously we experienced longer CI Build Times, just because we added docs to our Simple PR. (Now our PR shall be built exactly like a Simple PR)
The updated CI code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-15 11:05:47 +08:00
|
|
|
if [[ "$board" != *"xtensa-"* ]]; then
|
CI: Refactor the Build Rules based on Arch Labels
This PR continues to enhance the CI Workflow, to skip the unnecessary NuttX Builds. The changes in this PR will not take effect until the next PR, which will switch `build.yml` to use the rules in this PR.
In this PR, we refactor the CI Build Rules into a separate Reusable Workflow `arch.yml`. The original rules were migrated to `arch.yml`:
- We target only the Simple PRs: One Arch Label + One Size Label (e.g. "Arch: risc-v, Size: XS")
- For "Arch: risc-v": Build `risc-v-01`, `risc-v-02`
- For "Arch: xtensa": Build `xtensa-01`, `xtensa-02`
- The above rules apply when the PR is Created or Modified
- When the PR is Merged: All targets shall be built
New and Updated Rules:
- For "Arch: arm": Build `arm-01`, `arm-02`, ...
- For "Arch: arm64": Build `other`
- For "Arch: simulator": Build `sim-01`, `sim-02`
- For "Arch: x86_64": Build `other`
- For Simple PRs (One Arch Label + One Size Label): Skip the macOS and Windows builds (`macos`, `macos/sim-*`, `msys2`) since these builds are costly and slow
- Except for "Arch: Simulator", which will enable the macOS Builds for `sim-01` and `sim-02`
- If GitHub CLI Fails: Build all targets
The code is explained here: https://github.com/apache/nuttx/issues/13775
2024-10-06 11:22:00 +08:00
|
|
|
skip_build=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# For Other Arch: Allow the build
|
|
|
|
else
|
|
|
|
echo Build by default: $board
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Add the board to the selected builds
|
|
|
|
if [[ "$skip_build" == "0" ]]; then
|
|
|
|
echo Add $board to selected_builds
|
|
|
|
if [[ "$selected_builds" == "" ]]; then
|
|
|
|
selected_builds=$board
|
|
|
|
else
|
|
|
|
selected_builds=$selected_builds,$board
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Return the selected builds as JSON Array
|
|
|
|
# If Selected Builds is empty: Skip all builds
|
|
|
|
echo "selected_builds=[$selected_builds]" | tee -a $GITHUB_OUTPUT
|
|
|
|
if [[ "$selected_builds" == "" ]]; then
|
|
|
|
echo "skip_all_builds=1" | tee -a $GITHUB_OUTPUT
|
|
|
|
fi
|