Skip to content

Commit 81be887

Browse files
committed
ci(build-depends.repos): separate repos for humble and nightly
Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
1 parent b4d9155 commit 81be887

10 files changed

+226
-29
lines changed

Diff for: .github/actions/combine-repos-action/README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# combine-repos-action
2+
3+
## Description
4+
5+
**Combine Repos Action** is a GitHub Action designed to merge two `.repos` files—a base file and an overlay file—into a single file. The overlay file takes precedence over the base file when duplicate repository entries exist. This is especially useful for projects that need to dynamically combine configuration files for dependency management or CI workflows.
6+
7+
## Usage
8+
9+
Below is an example of how to include it in your workflow:
10+
11+
```yaml
12+
jobs:
13+
combine:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Combine Repos Files
20+
uses: ./.github/actions/combine-repos-action
21+
with:
22+
base_file: build_depends_humble.repos
23+
overlay_file: build_depends_nightly.repos
24+
output_file: build_depends.repos
25+
```
26+
27+
In this example:
28+
- The action reads the `build_depends_humble.repos` file and the `build_depends_nightly.repos` file.
29+
- It merges them with overlay file taking precedence.
30+
- The resulting file is saved as `build_depends.repos` (or a custom filename if specified).
31+
32+
## Inputs
33+
34+
| Input | Description | Required | Default |
35+
| ------------ | ---------------------------------------- | -------- | --------------- |
36+
| `base_file` | Path to the base `.repos` file | Yes | - |
37+
| `overlay_file` | Path to the overlay `.repos` file | Yes | - |
38+
| `output_file` | Path for the combined output file | No | `combined.repos` |
39+
40+
## Outputs
41+
42+
This action creates or updates the file specified by the `output_file` input with the combined contents of the two `.repos` files. The final file's content is also echoed to the workflow logs for easy verification.

Diff for: .github/actions/combine-repos-action/action.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Combine Repos Action
2+
description: Merge base and overlay .repos files, with overlay entries taking precedence.
3+
inputs:
4+
base_file:
5+
description: Path to the base .repos file
6+
required: true
7+
overlay_file:
8+
description: Path to the overlay .repos file
9+
required: true
10+
output_file:
11+
description: Path for the combined output file
12+
required: false
13+
default: combined.repos
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Install python3-pip
19+
run: |
20+
sudo apt-get -yqq update
21+
sudo apt-get -yqq install python3-pip python-is-python3
22+
shell: bash
23+
24+
- name: Display Python version
25+
run: |
26+
python --version
27+
which pip
28+
pip --version
29+
shell: bash
30+
31+
- name: Install PyYAML dependency
32+
run: pip install pyyaml
33+
shell: bash
34+
35+
- name: Combine repos files
36+
run: |
37+
python "${GITHUB_ACTION_PATH}/combine-repos.py" \
38+
--base "${{ inputs.base_file }}" \
39+
--overlay "${{ inputs.overlay_file }}" \
40+
--output "${{ inputs.output_file }}"
41+
shell: bash
42+
43+
- name: Display combined repos file
44+
run: |
45+
echo "=== Combined .repos File Content ==="
46+
cat "${{ inputs.output_file }}"
47+
echo "===================================="
48+
shell: bash
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python3
2+
import argparse
3+
import sys
4+
5+
import yaml
6+
7+
8+
def main():
9+
parser = argparse.ArgumentParser(
10+
description="Merge base and overlay .repos files with overlay taking precedence."
11+
)
12+
parser.add_argument("--base", required=True, help="Path to the base .repos file")
13+
parser.add_argument("--overlay", required=True, help="Path to the overlay .repos file")
14+
parser.add_argument(
15+
"--output",
16+
default="combined.repos",
17+
help="Path for the combined output file (default: combined.repos)",
18+
)
19+
args = parser.parse_args()
20+
21+
try:
22+
with open(args.base, "r") as bf:
23+
base_data = yaml.safe_load(bf)
24+
except Exception as e:
25+
sys.exit(f"Error reading base file '{args.base}': {e}")
26+
27+
try:
28+
with open(args.overlay, "r") as of:
29+
overlay_data = yaml.safe_load(of)
30+
except Exception as e:
31+
sys.exit(f"Error reading overlay file '{args.overlay}': {e}")
32+
33+
if "repositories" not in base_data:
34+
sys.exit(f"Base file '{args.base}' is missing the 'repositories' key")
35+
if overlay_data and "repositories" not in overlay_data:
36+
sys.exit(f"Overlay file '{args.overlay}' is missing the 'repositories' key")
37+
38+
# Merge: overlay entries override base entries
39+
merged_data = base_data.copy()
40+
merged_data["repositories"].update(overlay_data.get("repositories", {}))
41+
42+
try:
43+
with open(args.output, "w") as cf:
44+
yaml.dump(merged_data, cf, default_flow_style=False)
45+
except Exception as e:
46+
sys.exit(f"Error writing to output file '{args.output}': {e}")
47+
48+
print(f"Successfully merged into {args.output}")
49+
50+
51+
if __name__ == "__main__":
52+
main()

Diff for: .github/workflows/build-and-test-daily-arm64.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
include:
2525
- rosdistro: humble
2626
container: ghcr.io/autowarefoundation/autoware:universe-devel
27-
build-depends-repos: build_depends.repos
2827
steps:
2928
- name: Check out repository
3029
uses: actions/checkout@v4
@@ -54,13 +53,20 @@ jobs:
5453
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
5554
shell: bash
5655

56+
- name: Prepare build_depends.repos file
57+
uses: ./.github/actions/combine-repos-action
58+
with:
59+
base_file: build_depends_humble.repos
60+
overlay_file: build_depends_nightly.repos
61+
output_file: build_depends.repos
62+
5763
- name: Build
5864
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
5965
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
6066
with:
6167
rosdistro: ${{ matrix.rosdistro }}
6268
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
63-
build-depends-repos: ${{ matrix.build-depends-repos }}
69+
build-depends-repos: build_depends.repos
6470
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
6571
build-pre-command: taskset --cpu-list 0-6
6672

@@ -71,7 +77,7 @@ jobs:
7177
with:
7278
rosdistro: ${{ matrix.rosdistro }}
7379
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
74-
build-depends-repos: ${{ matrix.build-depends-repos }}
80+
build-depends-repos: build_depends.repos
7581

7682
- name: Upload coverage to CodeCov
7783
if: ${{ steps.test.outputs.coverage-report-files != '' }}

Diff for: .github/workflows/build-and-test-daily.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
include:
2525
- rosdistro: humble
2626
container: ghcr.io/autowarefoundation/autoware:universe-devel
27-
build-depends-repos: build_depends.repos
2827
steps:
2928
- name: Check out repository
3029
uses: actions/checkout@v4
@@ -81,13 +80,20 @@ jobs:
8180
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
8281
shell: bash
8382

83+
- name: Prepare build_depends.repos file
84+
uses: ./.github/actions/combine-repos-action
85+
with:
86+
base_file: build_depends_humble.repos
87+
overlay_file: build_depends_nightly.repos
88+
output_file: build_depends.repos
89+
8490
- name: Build
8591
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
8692
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
8793
with:
8894
rosdistro: ${{ matrix.rosdistro }}
8995
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
90-
build-depends-repos: ${{ matrix.build-depends-repos }}
96+
build-depends-repos: build_depends.repos
9197
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
9298

9399
- name: Show ccache stats after build
@@ -101,7 +107,7 @@ jobs:
101107
with:
102108
rosdistro: ${{ matrix.rosdistro }}
103109
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
104-
build-depends-repos: ${{ matrix.build-depends-repos }}
110+
build-depends-repos: build_depends.repos
105111

106112
- name: Upload coverage to CodeCov
107113
if: ${{ steps.test.outputs.coverage-report-files != '' }}

Diff for: .github/workflows/build-and-test-differential-arm64.yaml

+15-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
include:
3535
- rosdistro: humble
3636
container: ghcr.io/autowarefoundation/autoware:universe-devel
37-
build-depends-repos: build_depends.repos
3837
steps:
3938
- name: Set PR fetch depth
4039
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"
@@ -68,13 +67,26 @@ jobs:
6867
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
6968
shell: bash
7069

70+
- name: Prepare build_depends.repos file (main branch)
71+
if: ${{ github.event.pull_request.base.ref == 'main' }}
72+
uses: ./.github/actions/combine-repos-action
73+
with:
74+
base_file: build_depends_humble.repos
75+
overlay_file: build_depends_nightly.repos
76+
output_file: build_depends.repos
77+
78+
- name: Prepare build_depends.repos file (humble branch)
79+
if: ${{ github.event.pull_request.base.ref == 'humble' }}
80+
run: cp build_depends_humble.repos build_depends.repos
81+
shell: bash
82+
7183
- name: Build
7284
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
7385
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
7486
with:
7587
rosdistro: ${{ matrix.rosdistro }}
7688
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
77-
build-depends-repos: ${{ matrix.build-depends-repos }}
89+
build-depends-repos: build_depends.repos
7890
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
7991
build-pre-command: taskset --cpu-list 0-5
8092

@@ -85,7 +97,7 @@ jobs:
8597
with:
8698
rosdistro: ${{ matrix.rosdistro }}
8799
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
88-
build-depends-repos: ${{ matrix.build-depends-repos }}
100+
build-depends-repos: build_depends.repos
89101

90102
- name: Upload coverage to CodeCov
91103
if: ${{ steps.test.outputs.coverage-report-files != '' }}

Diff for: .github/workflows/build-and-test-differential.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ jobs:
8282
ccache --zero-stats
8383
shell: bash
8484

85+
- name: Prepare build_depends.repos file (main branch)
86+
if: ${{ github.event.pull_request.base.ref == 'main' }}
87+
uses: ./.github/actions/combine-repos-action
88+
with:
89+
base_file: build_depends_humble.repos
90+
overlay_file: build_depends_nightly.repos
91+
output_file: build_depends.repos
92+
93+
- name: Prepare build_depends.repos file (humble branch)
94+
if: ${{ github.event.pull_request.base.ref == 'humble' }}
95+
run: cp build_depends_humble.repos build_depends.repos
96+
shell: bash
97+
8598
- name: Export CUDA state as a variable for adding to cache key
8699
run: |
87100
build_type_cuda_state=nocuda
@@ -91,7 +104,6 @@ jobs:
91104
echo "BUILD_TYPE_CUDA_STATE=$build_type_cuda_state" >> "${GITHUB_ENV}"
92105
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
93106
shell: bash
94-
95107
- name: Build
96108
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
97109
uses: autowarefoundation/autoware-github-actions/colcon-build@v1

Diff for: .github/workflows/build-and-test.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
include:
2929
- rosdistro: humble
3030
container: ghcr.io/autowarefoundation/autoware:universe-devel
31-
build-depends-repos: build_depends.repos
3231
steps:
3332
- name: Check out repository
3433
uses: actions/checkout@v4
@@ -85,13 +84,20 @@ jobs:
8584
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
8685
shell: bash
8786

87+
- name: Prepare build_depends.repos file
88+
uses: ./.github/actions/combine-repos-action
89+
with:
90+
base_file: build_depends_humble.repos
91+
overlay_file: build_depends_nightly.repos
92+
output_file: build_depends.repos
93+
8894
- name: Build
8995
if: ${{ steps.get-self-packages.outputs.self-packages != '' }}
9096
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
9197
with:
9298
rosdistro: ${{ matrix.rosdistro }}
9399
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
94-
build-depends-repos: ${{ matrix.build-depends-repos }}
100+
build-depends-repos: build_depends.repos
95101
cache-key-element: ${{ env.BUILD_TYPE_CUDA_STATE }}
96102
build-pre-command: taskset --cpu-list 0-5
97103

@@ -115,7 +121,7 @@ jobs:
115121
with:
116122
rosdistro: ${{ matrix.rosdistro }}
117123
target-packages: ${{ steps.get-self-packages.outputs.self-packages }}
118-
build-depends-repos: ${{ matrix.build-depends-repos }}
124+
build-depends-repos: build_depends.repos
119125

120126
- name: Upload coverage to CodeCov
121127
if: ${{ steps.test.outputs.coverage-report-files != '' }}

Diff for: build_depends.repos renamed to build_depends_humble.repos

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
repositories:
22
# core
3-
# TODO(youtalk): Remove autoware_common when https://github.com/autowarefoundation/autoware/issues/4911 is closed
4-
core/autoware_common:
5-
type: git
6-
url: https://github.com/autowarefoundation/autoware_common.git
7-
version: remove-autoware-cmake-utils
83
core/autoware_cmake:
94
type: git
105
url: https://github.com/autowarefoundation/autoware_cmake.git
@@ -16,11 +11,11 @@ repositories:
1611
core/autoware_lanelet2_extension:
1712
type: git
1813
url: https://github.com/autowarefoundation/autoware_lanelet2_extension.git
19-
version: 0.6.1
14+
version: 0.6.2
2015
core/autoware.core:
2116
type: git
2217
url: https://github.com/autowarefoundation/autoware.core.git
23-
version: main
18+
version: 0.2.0
2419
core/autoware_msgs:
2520
type: git
2621
url: https://github.com/autowarefoundation/autoware_msgs.git
@@ -42,19 +37,12 @@ repositories:
4237
type: git
4338
url: https://github.com/tier4/muSSP.git
4439
version: tier4/main
45-
universe/external/ndt_omp:
46-
type: git
47-
url: https://github.com/tier4/ndt_omp.git
48-
version: tier4/main
40+
# Fix the version not to merge https://github.com/MORAI-Autonomous/MORAI-ROS2_morai_msgs/pull/9
4941
universe/external/morai_msgs:
5042
type: git
5143
url: https://github.com/MORAI-Autonomous/MORAI-ROS2_morai_msgs.git
52-
version: main
44+
version: e2e75fc1603a9798773e467a679edf68b448e705
5345
universe/external/glog: # TODO: to use isGoogleInitialized() API in v0.6.0. Remove when the rosdep glog version is updated to v0.6.0 (already updated in Ubuntu 24.04)
5446
type: git
5547
url: https://github.com/tier4/glog.git
5648
version: v0.6.0_t4-ros
57-
universe/external/ament_cmake: # TODO(mitsudome-r): remove when https://github.com/ament/ament_cmake/pull/448 is merged
58-
type: git
59-
url: https://github.com/autowarefoundation/ament_cmake.git
60-
version: feat/faster_ament_libraries_deduplicate

0 commit comments

Comments
 (0)