Skip to content

Commit 8f83e5b

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 8f83e5b

File tree

6 files changed

+163
-16
lines changed

6 files changed

+163
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# json-schema-check
2+
3+
## Description
4+
5+
This action checks if the ROS 2 parameter files (`config/*.param.yaml`) of packages comply with the format of their template JSON Schema file (`schema/*.schema.json`).
6+
7+
## Usage
8+
9+
```yaml
10+
jobs:
11+
json-schema-check:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Run json-schema-check
20+
uses: autowarefoundation/autoware-github-actions/json-schema-check@v1
21+
```
22+
23+
## Inputs
24+
25+
None.
26+
27+
## Outputs
28+
29+
None.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: 3.x
22+
23+
- name: Install PyYAML dependency
24+
run: pip install pyyaml
25+
shell: bash
26+
27+
- name: Combine repos files
28+
run: |
29+
python "${{ github.action_path }}/scripts/combine-repos.py" \
30+
--base "${{ inputs.base_file }}" \
31+
--overlay "${{ inputs.overlay_file }}" \
32+
--output "${{ inputs.output_file }}"
33+
shell: bash
34+
35+
- name: Display combined repos file
36+
run: |
37+
echo "=== Combined .repos File Content ==="
38+
cat "${{ inputs.output_file }}"
39+
echo "===================================="
40+
shell: bash
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()

.github/workflows/build-and-test-differential.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@ jobs:
9292
echo "::notice::BUILD_TYPE_CUDA_STATE=$build_type_cuda_state"
9393
shell: bash
9494

95+
# Prepare build dependency file based on the PR base branch
96+
- name: Prepare build-depends repos file (main branch)
97+
if: ${{ github.event.pull_request.base.ref == 'main' }}
98+
uses: ./.github/actions/combine-repos-action
99+
with:
100+
base_file: build_depends_humble.repos
101+
overlay_file: build_depends_nightly.repos
102+
output_file: build_depends.repos
103+
104+
- name: Prepare build-depends repos file (humble branch)
105+
if: ${{ github.event.pull_request.base.ref == 'humble' }}
106+
run: cp build_depends_humble.repos build_depends.repos
107+
95108
- name: Build
96109
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
97110
uses: autowarefoundation/autoware-github-actions/colcon-build@v1

build_depends.repos 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

build_depends_nightly.repos

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Expected usage: first import build_depends_$ROS_DISTRO.repos, then import this.
2+
3+
repositories:
4+
# core
5+
core/autoware_utils:
6+
type: git
7+
url: https://github.com/autowarefoundation/autoware_utils.git
8+
version: main
9+
core/autoware.core:
10+
type: git
11+
url: https://github.com/autowarefoundation/autoware.core.git
12+
version: main
13+
core/autoware_adapi_msgs:
14+
type: git
15+
url: https://github.com/autowarefoundation/autoware_adapi_msgs.git
16+
version: main
17+
core/autoware_internal_msgs:
18+
type: git
19+
url: https://github.com/autowarefoundation/autoware_internal_msgs.git
20+
version: main
21+
# universe
22+
universe/external/tier4_autoware_msgs:
23+
type: git
24+
url: https://github.com/tier4/tier4_autoware_msgs.git
25+
version: tier4/universe

0 commit comments

Comments
 (0)