Skip to content

Commit 9ca0c07

Browse files
authored
update modules to latest mains (#31)
1 parent d3808b4 commit 9ca0c07

File tree

9 files changed

+690
-16
lines changed

9 files changed

+690
-16
lines changed

.github/workflows/test_integration.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
# Workflow configuration for S-CORE CI - Bazel Build & Test baselibs
1515
# This workflow runs Bazel build and test when triggered by specific pull request events.
1616

17-
name: Bazel Build some repositories
17+
name: build latest mains
1818
on:
1919
workflow_dispatch:
20-
push:
2120
pull_request:
21+
schedule:
22+
- cron: '30 2 * * *' # Every night at 02:30 UTC on main branch
2223
jobs:
2324
integration_test:
2425
runs-on: ubuntu-latest
@@ -51,9 +52,21 @@ jobs:
5152
disk-cache: ${{ github.workflow }}
5253
# Share repository cache between workflows.
5354
repository-cache: true
55+
- name: Update known good commits
56+
run: |
57+
echo "::group::get latest commits from module branches"
58+
python3 tools/update_module_latest.py --output known_good.updated.json
59+
cat known_good.updated.json
60+
echo "::endgroup::"
61+
echo "::group::update score_modules.MODULE.bazel"
62+
python3 tools/update_module_from_known_good.py --known known_good.updated.json
63+
cat score_modules.MODULE.bazel
64+
echo "::endgroup::"
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5467
- name: Bazel build targets
5568
run: |
56-
./integration_test.sh
69+
./integration_test.sh --known-good known_good.updated.json
5770
- name: Show disk space after build
5871
if: always()
5972
run: |

MODULE.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ use_repo(pip, "pip_score_venv_test")
4747

4848
# communication module dependencies
4949
# archive_override are not forwarded by bazel_dep, so we need to redefine it here
50+
bazel_dep(name = "rules_boost", repo_name = "com_github_nelhage_rules_boost")
5051
archive_override(
5152
module_name = "rules_boost",
5253
strip_prefix = "rules_boost-master",
5354
urls = ["https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz"],
5455
)
5556

5657
# git_override are not forwarded by bazel_dep, so we need to redefine it here
58+
bazel_dep(name = "trlc")
5759
git_override(
5860
module_name = "trlc",
5961
remote = "https://github.com/bmw-software-engineering/trlc.git",

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ bazel build --config bl-x86_64-linux @score_baselibs//score/... --verbose_failur
2727

2828
### Communication
2929
```bash
30-
bazel build --config bl-x86_64-linux @score_communication//score/mw/com:com --verbose_failures
30+
bazel build --config bl-x86_64-linux @communication//score/mw/com:com --verbose_failures
3131
```
3232

3333
### Persistency

integration_test.sh

Lines changed: 100 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,79 @@
11
#!/usr/bin/env bash
2-
set -euox pipefail
2+
set -euo pipefail
33

44
# Integration build script.
55
# Captures warning counts for regression tracking.
6+
#
7+
# Usage: ./integration_test.sh [--known-good <path>]
8+
# --known-good: Optional path to known_good.json file
69

710
CONFIG=${CONFIG:-bl-x86_64-linux}
811
LOG_DIR=${LOG_DIR:-_logs/logs}
912
SUMMARY_FILE=${SUMMARY_FILE:-_logs/build_summary.md}
10-
mkdir -p "${LOG_DIR}" || true
13+
KNOWN_GOOD_FILE=""
1114

15+
# maybe move this to known_good.json or a config file later
1216
declare -A BUILD_TARGET_GROUPS=(
13-
[baselibs]="@score_baselibs//score/..."
17+
[score_baselibs]="@score_baselibs//score/..."
1418
[score_communication]="@score_communication//score/mw/com:com"
15-
[persistency]="@score_persistency//src/cpp/src/... @score_persistency//src/rust/..."
19+
[score_persistency]="@score_persistency//src/cpp/src/... @score_persistency//src/rust/..."
1620
#[score_logging]="@score_logging//src/..."
1721
[score_orchestrator]="@score_orchestrator//src/..."
1822
[score_test_scenarios]="@score_test_scenarios//..."
1923
[score_feo]="@score_feo//..."
2024
)
2125

26+
# Parse command line arguments
27+
while [[ $# -gt 0 ]]; do
28+
case $1 in
29+
--known-good)
30+
KNOWN_GOOD_FILE="$2"
31+
shift 2
32+
;;
33+
*)
34+
echo "Unknown option: $1"
35+
echo "Usage: $0 [--known-good <path>]"
36+
exit 1
37+
;;
38+
esac
39+
done
40+
41+
mkdir -p "${LOG_DIR}" || true
42+
43+
# Function to extract commit hash from known_good.json
44+
get_commit_hash() {
45+
local module_name=$1
46+
local known_good_file=$2
47+
48+
if [[ -z "${known_good_file}" ]] || [[ ! -f "${known_good_file}" ]]; then
49+
echo "N/A"
50+
return
51+
fi
52+
53+
# Get the script directory
54+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55+
56+
# Use the Python script to extract module info
57+
python3 "${script_dir}/tools/get_module_info.py" "${known_good_file}" "${module_name}" "hash" 2>/dev/null || echo "N/A"
58+
}
59+
60+
# Function to extract repo URL from known_good.json
61+
get_module_repo() {
62+
local module_name=$1
63+
local known_good_file=$2
64+
65+
if [[ -z "${known_good_file}" ]] || [[ ! -f "${known_good_file}" ]]; then
66+
echo "N/A"
67+
return
68+
fi
69+
70+
# Get the script directory
71+
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
72+
73+
# Use the Python script to extract module repo
74+
python3 "${script_dir}/tools/get_module_info.py" "${known_good_file}" "${module_name}" "repo" 2>/dev/null || echo "N/A"
75+
}
76+
2277
warn_count() {
2378
# Grep typical compiler and Bazel warnings; adjust patterns as needed.
2479
local file=$1
@@ -35,29 +90,41 @@ timestamp() { date '+%Y-%m-%d %H:%M:%S'; }
3590

3691
echo "=== Integration Build Started $(timestamp) ===" | tee "${SUMMARY_FILE}"
3792
echo "Config: ${CONFIG}" | tee -a "${SUMMARY_FILE}"
93+
if [[ -n "${KNOWN_GOOD_FILE}" ]]; then
94+
echo "Known Good File: ${KNOWN_GOOD_FILE}" | tee -a "${SUMMARY_FILE}"
95+
fi
3896
echo "" >> "${SUMMARY_FILE}"
3997
echo "## Build Groups Summary" >> "${SUMMARY_FILE}"
4098
echo "" >> "${SUMMARY_FILE}"
4199
# Markdown table header
42100
{
43-
echo "| Group | Status | Duration (s) | Warnings | Deprecated refs |";
44-
echo "|-------|--------|--------------|----------|-----------------|";
101+
echo "| Group | Status | Duration (s) | Warnings | Deprecated refs | Commit/Version |";
102+
echo "|-------|--------|--------------|----------|-----------------|----------------|";
45103
} >> "${SUMMARY_FILE}"
46104

47105
overall_warn_total=0
48106
overall_depr_total=0
49107

108+
# Track if any build group failed
109+
any_failed=0
110+
50111
for group in "${!BUILD_TARGET_GROUPS[@]}"; do
51112
targets="${BUILD_TARGET_GROUPS[$group]}"
52113
log_file="${LOG_DIR}/${group}.log"
114+
53115
# Log build group banner only to stdout/stderr (not into summary table file)
54116
echo "--- Building group: ${group} ---"
117+
start_ts=$(date +%s)
118+
echo "bazel build --config "${CONFIG}" ${targets} --verbose_failures"
55119
# GitHub Actions log grouping start
56120
echo "::group::Bazel build (${group})"
57-
start_ts=$(date +%s)
58121
set +e
59122
bazel build --config "${CONFIG}" ${targets} --verbose_failures 2>&1 | tee "$log_file"
60123
build_status=${PIPESTATUS[0]}
124+
# Track if any build group failed
125+
if [[ ${build_status} -ne 0 ]]; then
126+
any_failed=1
127+
fi
61128
set -e
62129
echo "::endgroup::" # End Bazel build group
63130
end_ts=$(date +%s)
@@ -72,16 +139,37 @@ for group in "${!BUILD_TARGET_GROUPS[@]}"; do
72139
else
73140
status_symbol="❌(${build_status})"
74141
fi
75-
echo "| ${group} | ${status_symbol} | ${duration} | ${w_count} | ${d_count} |" | tee -a "${SUMMARY_FILE}"
142+
143+
# Get commit hash/version for this group (group name is the module name)
144+
commit_hash=$(get_commit_hash "${group}" "${KNOWN_GOOD_FILE}")
145+
repo=$(get_module_repo "${group}" "${KNOWN_GOOD_FILE}")
146+
147+
# Truncate commit hash for display (first 8 chars)
148+
if [[ "${commit_hash}" != "N/A" ]] && [[ ${#commit_hash} -gt 8 ]]; then
149+
commit_hash_display="${commit_hash:0:8}"
150+
else
151+
commit_hash_display="${commit_hash}"
152+
fi
153+
154+
# Only add link if KNOWN_GOOD_FILE is set
155+
if [[ -n "${KNOWN_GOOD_FILE}" ]]; then
156+
commit_version_cell="[${commit_hash_display}](${repo}/tree/${commit_hash})"
157+
else
158+
commit_version_cell="${commit_hash_display}"
159+
fi
160+
161+
echo "| ${group} | ${status_symbol} | ${duration} | ${w_count} | ${d_count} | ${commit_version_cell} |" | tee -a "${SUMMARY_FILE}"
76162
done
77163

78164
# Append aggregate totals row to summary table
79-
echo "| TOTAL | | | ${overall_warn_total} | ${overall_depr_total} |" >> "${SUMMARY_FILE}"
80-
81-
# Display the full build summary explicitly at the end
165+
echo "| TOTAL | | | ${overall_warn_total} | ${overall_depr_total} | |" >> "${SUMMARY_FILE}"
82166
echo '::group::Build Summary'
83167
echo '=== Build Summary (echo) ==='
84168
cat "${SUMMARY_FILE}" || echo "(Could not read summary file ${SUMMARY_FILE})"
85169
echo '::endgroup::'
86170

87-
exit 0
171+
# Report to GitHub Actions if any build group failed
172+
if [[ ${any_failed} -eq 1 ]]; then
173+
echo "::error::One or more build groups failed. See summary above."
174+
exit 1
175+
fi

known_good.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"timestamp": "2025-08-13T12:55:10Z",
3+
"modules": {
4+
"score_baselibs": {
5+
"version": "0.1.3",
6+
"repo": "https://github.com/eclipse-score/baselibs.git",
7+
"branch": "s_core_release_v0_5_0"
8+
},
9+
"score_communication": {
10+
"version": "0.1.1",
11+
"repo": "https://github.com/eclipse-score/communication.git",
12+
"branch": "s_core_release_v0_5_0"
13+
},
14+
"score_persistency": {
15+
"version": "0.2.1",
16+
"repo": "https://github.com/eclipse-score/persistency.git"
17+
},
18+
"score_orchestrator": {
19+
"version": "0.0.3",
20+
"repo": "https://github.com/eclipse-score/orchestrator.git"
21+
},
22+
"score_tooling": {
23+
"version": "1.0.2",
24+
"repo": "https://github.com/eclipse-score/tooling.git"
25+
},
26+
"score_platform": {
27+
"hash": "a9cf44be1342f3c62111de2249eb3132f5ab88da",
28+
"repo": "https://github.com/eclipse-score/score.git"
29+
},
30+
"score_bazel_platforms": {
31+
"version": "0.0.2",
32+
"repo": "https://github.com/eclipse-score/bazel_platforms.git"
33+
},
34+
"score_test_scenarios": {
35+
"version": "0.3.0",
36+
"repo": "https://github.com/eclipse-score/testing_tools.git"
37+
},
38+
"score_docs_as_code": {
39+
"version": "2.0.1",
40+
"repo": "https://github.com/eclipse-score/docs-as-code.git"
41+
},
42+
"score_process": {
43+
"version": "1.3.1",
44+
"repo": "https://github.com/eclipse-score/process_description.git"
45+
},
46+
"score_feo": {
47+
"version": "1.0.2",
48+
"repo": "https://github.com/eclipse-score/feo.git",
49+
"branch": "candidate_v0.5"
50+
}
51+
},
52+
"manifest_sha256": "4c9b7f...",
53+
"suite": "full",
54+
"duration_s": 742
55+
}

tools/get_module_info.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env python3
2+
"""Extract module information from known_good.json."""
3+
4+
import json
5+
import sys
6+
from typing import Dict, Any
7+
8+
9+
def load_module_data(known_good_file: str, module_name: str) -> Dict[str, Any]:
10+
"""
11+
Load module data from known_good.json.
12+
13+
Args:
14+
known_good_file: Path to the known_good.json file
15+
module_name: Name of the module to look up
16+
17+
Returns:
18+
Dictionary with module data, or empty dict if not found
19+
"""
20+
try:
21+
with open(known_good_file, 'r') as f:
22+
data = json.load(f)
23+
modules = data.get('modules', {})
24+
return modules.get(module_name, {})
25+
except Exception:
26+
return {}
27+
28+
29+
def get_module_field(module_data: Dict[str, Any], field: str = 'hash') -> str:
30+
"""
31+
Extract a specific field from module data.
32+
33+
Args:
34+
module_data: Dictionary with module information
35+
field: Field to extract ('hash', 'version', 'repo', or 'all')
36+
37+
Returns:
38+
Requested field value, or 'N/A' if not found
39+
For 'hash': truncated to 8 chars if longer
40+
For 'all': returns hash/version (prefers hash, falls back to version)
41+
"""
42+
if not module_data:
43+
return 'N/A'
44+
45+
if field == 'repo':
46+
repo = module_data.get('repo', 'N/A')
47+
# Remove .git suffix if present
48+
if repo.endswith('.git'):
49+
repo = repo[:-4]
50+
return repo
51+
elif field == 'version':
52+
return module_data.get('version', 'N/A')
53+
elif field == 'hash':
54+
hash_val = module_data.get('hash', 'N/A')
55+
return hash_val
56+
else: # field == 'all' or default
57+
hash_val = module_data.get('hash', module_data.get('version', 'N/A'))
58+
return hash_val
59+
60+
61+
if __name__ == '__main__':
62+
if len(sys.argv) < 3 or len(sys.argv) > 4:
63+
print('Usage: get_module_info.py <known_good.json> <module_name> [field]')
64+
print(' field: hash (default), version, repo, or all')
65+
print('N/A')
66+
sys.exit(1)
67+
68+
known_good_file = sys.argv[1]
69+
module_name = sys.argv[2]
70+
field = sys.argv[3] if len(sys.argv) == 4 else 'all'
71+
72+
module_data = load_module_data(known_good_file, module_name)
73+
result = get_module_field(module_data, field)
74+
print(result)

tools/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PyGithub>=2.1.1

0 commit comments

Comments
 (0)