Skip to content

Commit e22c2e1

Browse files
committed
[repo config] update CI config
1 parent 9341c48 commit e22c2e1

2 files changed

Lines changed: 186 additions & 18 deletions

File tree

.github/copilot-instructions.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<!--
2+
Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
7+
# Score Tooling — Agent Instructions
8+
9+
**Score Tooling** is a unified Bazel module (`score_tooling`) providing development tools for building, testing, and maintaining code quality. All public macros are re-exported from [defs.bzl](../defs.bzl).
10+
11+
## Modules
12+
13+
| Module | Language | Purpose | Docs |
14+
|--------|----------|---------|------|
15+
| `python_basics` | Starlark/Python | `score_py_pytest` + `score_virtualenv` macros | [README](../python_basics/README.md) |
16+
| `cr_checker` | Python | Copyright header checker/fixer | [README](../cr_checker/README.md) |
17+
| `dash` | Tool | DASH license compliance | [README](../dash/README.md) |
18+
| `format_checker` | Starlark | `use_format_targets()``:format.fix` / `:format.check` | [README](../format_checker/README.md) |
19+
| `cli_helper` | Starlark | CLI helper Bazel rule | [README](../cli_helper/README.md) |
20+
| `starpls` | Config | Starlark language server | [README](../starpls/README.md) |
21+
| `coverage` | Shell+Bazel | Combined Rust+Python coverage → HTML | [README](../coverage/README.md) |
22+
| `lobster_bazel` | Python | Extracts traceability tags for LOBSTER | [README](../lobster_bazel/README.md) |
23+
| `manual_analysis` | Python+Starlark | Interactive manual verification workflow | [README](../manual_analysis/README.md) |
24+
| `plantuml` | Rust | PlantUML FTA-metamodel parser | [README](../plantuml/parser/README.md) |
25+
| `validation` | Rust+Python | Bazel-graph vs. PlantUML validation + AI checker | [README](../validation/ai_checker/README.md) |
26+
| `tools` | Config | Multitool lockfile: ruff, shellcheck, actionlint, yamlfmt | [README](../tools/README.md) |
27+
28+
## Build & Test Commands
29+
30+
```bash
31+
bazel test //... # all tests
32+
bazel test //:format.check # check formatting (ruff, buildifier, rustfmt, yamlfmt)
33+
bazel run //:format.fix # auto-fix formatting
34+
bazel run //:copyright.check # check copyright headers
35+
36+
# Rust-specific
37+
bazel build //plantuml/... --config=clippy
38+
bazel build //validation/... --config=clippy
39+
40+
# Coverage
41+
bazel run //coverage:combined_report
42+
43+
# IDE virtualenv
44+
bazel run //:ide_support # creates .venv
45+
46+
# AI checker (runs at test time; inherits Copilot credentials from your shell)
47+
bazel test //path/to:my_ai_check
48+
```
49+
50+
**Integration tests** have their own `MODULE.bazel` — run from their subdirectory:
51+
52+
```bash
53+
cd python_basics/integration_tests && bazel test //...
54+
cd starpls/integration_tests && bazel test //...
55+
```
56+
57+
## Critical Conventions
58+
59+
### Copyright header — mandatory on every file
60+
Every `.py`, `.bzl`, `.rs`, `.sh`, `.cpp` file must begin with:
61+
```
62+
# Copyright (c) <year> Contributors to the Eclipse Foundation
63+
#
64+
# SPDX-License-Identifier: Apache-2.0
65+
```
66+
The `:copyright.check` target enforces this and will fail CI if missing.
67+
68+
### Python
69+
- Version: **3.12** (pinned in `MODULE.bazel` + `python_basics/pyproject.toml`)
70+
- Linter: **ruff** (`E, F, I, B, C90, UP, SIM, RET` rules)
71+
- Type checker: **basedpyright** (`standard` mode)
72+
- All Python tests must use `score_py_pytest`, not raw `py_test`
73+
- `--incompatible_default_to_explicit_init_py` is active — no automatic `__init__.py`
74+
75+
### Bazel/Starlark
76+
- Formatting: **buildifier**
77+
- Bzlmod (`MODULE.bazel`) is primary; `deps.bzl` is legacy compat only
78+
- Root `BUILD` registers `:copyright.check`, `:format.check`, `:format.fix` targets
79+
80+
### Rust
81+
- Edition 2021; rustfmt + clippy via `--config=clippy`
82+
83+
## Dependency / Requirements Management
84+
85+
Each sub-package has its own pip hub with `requirements.in``requirements.txt`:
86+
87+
| Hub | Lock file |
88+
|-----|-----------|
89+
| `pip_tooling` | `python_basics/requirements.txt` |
90+
| `pip_lobster_bazel` | `lobster_bazel/requirements.txt` |
91+
| `manual_analysis_deps` | `manual_analysis/requirements.txt` |
92+
| `pip_validation_ai_checker` | `validation/ai_checker/requirements.txt` |
93+
94+
After editing `requirements.in`, regenerate with:
95+
```bash
96+
bazel run //<pkg>:requirements.update
97+
```
98+
Both `requirements.in` and `requirements.txt` are committed to VCS.
99+
100+
## Common Pitfalls
101+
102+
- **AI checker tests need `tags = ["manual"]`** — otherwise `bazel test //...` attempts to run them without Copilot credentials.
103+
- **`lobster_bazel` traceability tags** must be at the start of a line (not inline).
104+
- **Format check fails silently** if buildifier or ruff versions are out of sync with the multitool lockfile in `tools/`.
105+
- **`manual_analysis` lock files are committed** — always run `{target}.update` after changing analysis YAML, then commit the updated lock.

.github/workflows/tests.yml

Lines changed: 81 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,40 @@ name: Run Python Basics Integration and Unit Tests
1414
on:
1515
pull_request:
1616
types: [opened, reopened, synchronize]
17+
concurrency:
18+
group: tests-${{ github.event.pull_request.number || github.run_id }}
19+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
20+
env:
21+
ANDROID_HOME: ""
22+
ANDROID_SDK_ROOT: ""
23+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1724
jobs:
18-
code:
19-
runs-on: ubuntu-latest
25+
root_workspace_tests:
26+
runs-on: ubuntu-24.04
27+
permissions:
28+
contents: read
29+
actions: write
2030
steps:
2131
- name: Checkout repository
2232
uses: actions/checkout@v7.0.0
33+
- name: Free Disk Space (Ubuntu)
34+
uses: eclipse-score/more-disk-space@v1
35+
with:
36+
level: 4
37+
- uses: castler/setup-bazel@cache-optimized
38+
with:
39+
bazelisk-cache: true
40+
disk-cache: root_workspace_tests
41+
repository-cache: true
42+
cache-optimized: true
43+
cache-save: ${{ github.ref == 'refs/heads/main' }}
2344
- name: Install Missing Dependencies
2445
run: |
2546
sudo apt-get update
2647
sudo apt-get install -y libcairo2-dev
27-
- name: Run python_basics integration tests
28-
run: |
29-
cd python_basics/integration_tests
30-
bazel test //...
31-
- name: Run starpls integration tests
32-
run: |
33-
cd starpls/integration_tests
34-
bazel test //...
35-
- name: Run cr_checker unit tests
36-
run: |
37-
cd cr_checker/tests
38-
bazel test //...
3948
- name: Run coverage module tests
4049
run: |
4150
bazel test //coverage/tests:all
42-
- name: Run rules_score tests
43-
run: |
44-
cd bazel/rules/rules_score/test
45-
bazel test //...
4651
- name: Run Plantuml Tooling clippy
4752
run: |
4853
bazel build //plantuml/... --config=clippy
@@ -64,3 +69,61 @@ jobs:
6469
- name: Run Libclang Parser Tooling tests
6570
run: |
6671
bazel test //cpp/libclang/...
72+
integration_tests:
73+
runs-on: ubuntu-24.04
74+
permissions:
75+
contents: read
76+
actions: write
77+
steps:
78+
- name: Checkout repository
79+
uses: actions/checkout@v7.0.0
80+
- name: Free Disk Space (Ubuntu)
81+
uses: eclipse-score/more-disk-space@v1
82+
with:
83+
level: 4
84+
- uses: castler/setup-bazel@cache-optimized
85+
with:
86+
bazelisk-cache: true
87+
disk-cache: integration_tests
88+
repository-cache: true
89+
cache-optimized: true
90+
cache-save: ${{ github.ref == 'refs/heads/main' }}
91+
- name: Install Missing Dependencies
92+
run: |
93+
sudo apt-get update
94+
sudo apt-get install -y libcairo2-dev
95+
- name: Run python_basics integration tests
96+
run: |
97+
cd python_basics/integration_tests
98+
bazel test //...
99+
- name: Run starpls integration tests
100+
run: |
101+
cd starpls/integration_tests
102+
bazel test //...
103+
- name: Run cr_checker unit tests
104+
run: |
105+
cd cr_checker/tests
106+
bazel test //...
107+
rules_score_tests:
108+
runs-on: ubuntu-24.04
109+
permissions:
110+
contents: read
111+
actions: write
112+
steps:
113+
- name: Checkout repository
114+
uses: actions/checkout@v7.0.0
115+
- name: Free Disk Space (Ubuntu)
116+
uses: eclipse-score/more-disk-space@v1
117+
with:
118+
level: 4
119+
- uses: castler/setup-bazel@cache-optimized
120+
with:
121+
bazelisk-cache: true
122+
disk-cache: rules_score_tests
123+
repository-cache: true
124+
cache-optimized: true
125+
cache-save: ${{ github.ref == 'refs/heads/main' }}
126+
- name: Run rules_score tests
127+
run: |
128+
cd bazel/rules/rules_score/test
129+
bazel test //...

0 commit comments

Comments
 (0)