Skip to content

Commit 7a4b2e1

Browse files
committed
Only run workflow on develop branch for arm64 arch (#1132)
This PR ensures ARM64 build jobs only run on the `develop` branch and extends branch checks to pull request contexts. - Added a `matrix-prep` job that outputs an ARM64 matrix only when targeting `develop`. - Updated the build job to depend on `matrix-prep` and dynamically include ARM64 config. - Enhanced ROS distro detection to consider both `github.ref` and `github.base_ref` for branch-based flags. Fix: #1131
1 parent 79ac1b0 commit 7a4b2e1

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

.github/workflows/identify-ros-distro.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ on:
1010
description: "The ROS compatible Linux version"
1111
value: ${{ jobs.identify-ros-distro.outputs.linuxos }}
1212
env:
13-
ROLLING_VAR: ${{ contains(github.ref, 'develop') }}
14-
KILTED_VAR: ${{ contains(github.ref, 'kilted') }}
15-
JAZZY_VAR: ${{ contains(github.ref, 'jazzy') }}
16-
IRON_VAR: ${{ contains(github.ref, 'iron') }}
17-
HUMBLE_VAR: ${{ contains(github.ref, 'humble') }}
13+
ROLLING_VAR: ${{ contains(github.ref, 'develop') || contains(github.base_ref, 'develop') }}
14+
KILTED_VAR: ${{ contains(github.ref, 'kilted') || contains(github.base_ref, 'kilted') }}
15+
JAZZY_VAR: ${{ contains(github.ref, 'jazzy') || contains(github.base_ref, 'jazzy') }}
16+
IRON_VAR: ${{ contains(github.ref, 'iron') || contains(github.base_ref, 'iron') }}
17+
HUMBLE_VAR: ${{ contains(github.ref, 'humble') || contains(github.base_ref, 'humble') }}
1818

1919
jobs:
2020
identify-ros-distro:

.github/workflows/linux-build-and-test.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: rclnodejs - Linux Build and Test
32

43
on:
@@ -24,8 +23,21 @@ jobs:
2423
identify-ros-distro:
2524
uses: ./.github/workflows/identify-ros-distro.yml
2625

26+
matrix-prep:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
arm64-matrix: ${{ steps.set-matrix.outputs.arm64-matrix }}
30+
steps:
31+
- id: set-matrix
32+
run: |
33+
if ${{ contains(github.base_ref, 'develop') || contains(github.ref, 'develop') }}; then
34+
echo "arm64-matrix=[{\"architecture\":\"arm64\",\"node-version\":\"22.X\",\"ubuntu-version\":\"24.04-arm\"}]" >> $GITHUB_OUTPUT
35+
else
36+
echo "arm64-matrix=[]" >> $GITHUB_OUTPUT
37+
fi
38+
2739
build:
28-
needs: identify-ros-distro
40+
needs: [identify-ros-distro, matrix-prep]
2941
runs-on: ubuntu-${{ matrix.ubuntu-version }}
3042
container:
3143
image: ${{ needs.identify-ros-distro.outputs.linuxos }}
@@ -35,12 +47,8 @@ jobs:
3547
node-version: [20.X, 22.X, 24.X]
3648
architecture: [x64]
3749
ubuntu-version: [latest]
38-
# Add arm64 support for rolling.
39-
include:
40-
- architecture: arm64
41-
node-version: 22.X
42-
ubuntu-version: 24.04-arm
43-
exclude: ${{ !contains(github.ref, 'develop') }}
50+
# Include arm64 configuration from matrix-prep job
51+
include: ${{ fromJSON(needs.matrix-prep.outputs.arm64-matrix) }}
4452
steps:
4553
- name: Setup Node.js ${{ matrix.node-version }} on ${{ matrix.architecture }}
4654
uses: actions/setup-node@v4
@@ -84,4 +92,4 @@ jobs:
8492
uses: coverallsapp/github-action@v2
8593
with:
8694
github-token: ${{ secrets.GITHUB_TOKEN }}
87-
parallel-finished: true
95+
parallel-finished: true

0 commit comments

Comments
 (0)