Skip to content

Commit af10dd5

Browse files
authored
feat: replace bash integration test script with Python version (#77)
- Reorganized directory structure: moved tools/ → scripts/known_good/ - Created proper package structure with __init__.py files - Extracted build configuration to external JSON file (build_config.json) - Introduced dataclass models for better type safety: * BuildModuleConfig for build configuration * Module for repository module metadata * KnownGood for known_good.json structure - Separated concerns into dedicated model files: * scripts/models/build_config.py * scripts/known_good/models/module.py * scripts/known_good/models/known_good.py - Refactored all scripts to use KnownGood dataclass: * integration_test.py * override_known_good_repo.py * update_module_latest.py * update_module_from_known_good.py * known_good_to_workspace_metadata.py - Removed duplicate functions (load_modules, load_known_good, write_known_good) - Moved timestamp update logic into KnownGood.write() method - Improved exception handling to catch SystemExit from validation errors - Removed unused get_module_info.py - Eliminated sys.path.insert usage through proper package imports All functionality preserved while improving code quality and type correctness.
1 parent a443083 commit af10dd5

21 files changed

Lines changed: 590 additions & 599 deletions

.devcontainer/prepare_workspace.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ export GITA_PROJECT_HOME
1919

2020
# Generate workspace metadata files from known_good.json:
2121
# - .gita-workspace.csv
22-
python3 tools/known_good_to_workspace_metadata.py --known-good known_good.json --gita-workspace .gita-workspace.csv
22+
python3 scripts/known_good/known_good_to_workspace_metadata.py --known-good known_good.json --gita-workspace .gita-workspace.csv

.github/workflows/reusable_integration-build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
# What it does:
88
# - Checks out the reference integration repository
99
# - Updates score_modules.MODULE.bazel from the provided known_good.json
10-
# - Builds all referenced modules (via scripts/integration_test.sh and Bazel)
10+
# - Builds all referenced modules (via scripts/integration_test.py and Bazel)
1111
# - Runs integration tests
1212
# - Uploads logs from _logs/ as artifact: bazel-build-logs-${{ inputs.config }}
1313
#
1414
# Inputs:
1515
# - known_good (string, required): JSON content used to pin module SHAs.
16-
# - config (string, optional, default: bl-x86_64-linux): Bazel config passed as
17-
# CONFIG to scripts/integration_test.sh.
16+
# - config (string, optional, default: bl-x86_64-linux): Bazel config passed to
17+
# scripts/integration_test.py.
1818
# - repo_runner_labels (string, optional): Runner label(s). Accepts either a
1919
# single label string (e.g., ubuntu-latest) or a JSON string representing a
2020
# label or an array of labels (e.g., "\"ubuntu-latest\"" or
2121
# "[\"self-hosted\",\"linux\",\"x64\"]").
2222
# - target_branch (string, optional, default: main): Ref/branch to checkout.
2323
#
2424
# Repository Variables:
25-
# - reference_integration_repo (optional): Repository to checkout (owner/repo).
25+
# - REFERENCE_INTEGRATION_REPO (optional): Repository to checkout (owner/repo).
2626
# Default: eclipse-score/reference_integration
2727
#
2828
# Secrets:
@@ -77,7 +77,7 @@ on:
7777
default: 'main'
7878

7979
env:
80-
REFERENCE_INTEGRATION_REPO: ${{ vars.reference_integration_repo != '' && vars.reference_integration_repo || 'eclipse-score/reference_integration' }}
80+
REFERENCE_INTEGRATION_REPO: ${{ vars.REFERENCE_INTEGRATION_REPO != '' && vars.REFERENCE_INTEGRATION_REPO || 'eclipse-score/reference_integration' }}
8181

8282
jobs:
8383
integration-test:
@@ -127,14 +127,14 @@ jobs:
127127
echo "::endgroup::"
128128
129129
echo "::group::update score_modules.MODULE.bazel"
130-
python3 tools/update_module_from_known_good.py --known known_good.updated.json
130+
python3 scripts/known_good/update_module_from_known_good.py --known known_good.updated.json
131131
cat score_modules.MODULE.bazel
132132
echo "::endgroup::"
133133
env:
134134
GITHUB_TOKEN: ${{ secrets.REPO_READ_TOKEN != '' && secrets.REPO_READ_TOKEN || github.token }}
135135
- name: Bazel build targets
136136
run: |
137-
CONFIG="${{ inputs.config }}" scripts/integration_test.sh --known-good known_good.updated.json
137+
python3 scripts/integration_test.py --known-good known_good.updated.json --config "${{ inputs.config }}"
138138
env:
139139
GITHUB_TOKEN: ${{ secrets.REPO_READ_TOKEN != '' && secrets.REPO_READ_TOKEN || github.token }}
140140
- name: Show disk space after build

.github/workflows/reusable_smoke-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ jobs:
9595
run: |
9696
if [ "${{ github.repository }}" != "${{ env.REFERENCE_INTEGRATION_REPO }}" ]; then
9797
echo "Overriding ${{ inputs.module_name }} with current PR"
98-
python3 tools/override_known_good_repo.py \
98+
python3 scripts/known_good/override_known_good_repo.py \
9999
--known known_good.json \
100100
--output known_good.updated.json \
101101
--module-override ${{ inputs.module_name }}@${{ github.event.repository.clone_url }}@${{ github.sha }}
102102
else
103103
echo "Testing reference integration repository itself - updating to latest commits"
104104
echo "::group::get latest commits from module branches"
105-
python3 tools/update_module_latest.py --output known_good.updated.json
105+
python3 scripts/known_good/update_module_latest.py --output known_good.updated.json
106106
cat known_good.updated.json
107107
echo "::endgroup::"
108108
fi

.vscode/tasks.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "shell",
77
"command": "python3",
88
"args": [
9-
"tools/known_good_to_workspace_metadata.py"
9+
"scripts/known_good/known_good_to_workspace_metadata.py"
1010
],
1111
"problemMatcher": []
1212
},
@@ -15,7 +15,7 @@
1515
"type": "shell",
1616
"command": "python3",
1717
"args": [
18-
"tools/update_module_from_known_good.py",
18+
"scripts/known_good/update_module_from_known_good.py",
1919
"--override-type",
2020
"local_path"
2121
],
@@ -26,7 +26,7 @@
2626
"type": "shell",
2727
"command": "python3",
2828
"args": [
29-
"tools/update_module_from_known_good.py",
29+
"scripts/known_good/update_module_from_known_good.py",
3030
"--override-type",
3131
"git"
3232
]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,4 @@ local_path_override(module_name = "score_tooling", path = "../tooling")
202202
Use `scripts/generate_rust_analyzer_support.sh` to generate rust_analyzer settings that will let VS Code work.
203203

204204
## 🗂 Notes
205-
Keep this file updated as integration issues are resolved. Prefer converting ad-hoc shell steps into Bazel rules or documented scripts under `tools/` for repeatability.
205+
Keep this file updated as integration issues are resolved. Prefer converting ad-hoc shell steps into Bazel rules or documented scripts under `scripts/` for repeatability.

build_config.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"modules": {
3+
"score_baselibs": {
4+
"build_targets": "@score_baselibs//score/..."
5+
},
6+
"score_communication": {
7+
"build_targets": "@score_communication//score/mw/com:com"
8+
},
9+
"score_persistency": {
10+
"build_targets": "@score_persistency//src/cpp/src/... @score_persistency//src/rust/..."
11+
},
12+
"score_kyron": {
13+
"build_targets": "@score_kyron//src/..."
14+
},
15+
"score_orchestrator": {
16+
"build_targets": "@score_orchestrator//src/..."
17+
},
18+
"score_test_scenarios": {
19+
"build_targets": "@score_test_scenarios//test_scenarios_rust:test_scenarios_rust @score_test_scenarios//test_scenarios_cpp:test_scenarios_cpp"
20+
},
21+
"score_feo": {
22+
"build_targets": "-- @score_feo//... -@score_feo//:docs -@score_feo//:ide_support -@score_feo//:needs_json"
23+
},
24+
"score_logging": {
25+
"build_targets": "@score_logging//score/... --@score_baselibs//score/memory/shared/flags:use_typedshmd=False --@score_baselibs//score/json:base_library=nlohmann --@score_logging//score/datarouter/build_configuration_flags:persistent_logging=False --@score_logging//score/datarouter/build_configuration_flags:persistent_config_feature_enabled=False --@score_logging//score/datarouter/build_configuration_flags:enable_nonverbose_dlt=False --@score_logging//score/datarouter/build_configuration_flags:enable_dynamic_configuration_in_datarouter=False --@score_logging//score/datarouter/build_configuration_flags:dlt_file_transfer_feature=False --@score_logging//score/datarouter/build_configuration_flags:use_local_vlan=True"
26+
}
27+
}
28+
}

scripts/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Scripts package

0 commit comments

Comments
 (0)