Skip to content

Commit 56daec5

Browse files
tbitcsoz-agent
andcommitted
feat: cross-platform realignment, Slices 2-12 implementation
- specsmith migration 0.3.0 -> 0.10.1 with full governance upgrade - Cross-platform realignment: 47 requirements across 10 groups (Windows/Linux/macOS) - New modules: west_env/{backend,sync,cache,credentials,flash,vscode,platform}.py - Extended: config.py (backend/workspace_mode/cache/git/jlink), env.py (10 new actions) - 122 unit tests passing (Windows/Linux/macOS x Python 3.10-3.12) - CI: lint(ruff) + unit-tests(3 OS x 3 Python) + docker-integration + native-sim-build + security(pip-audit) - Dependabot: pip + github-actions weekly - Slice 12 docs: README rewrite (Windows-first), 6 new docs, CONTRIBUTING/SECURITY expanded - ruff: 0 violations (line-length=120, E402 suppressed for intentional sys.path pattern) - specsmith: validate 5/5, audit 28/28 healthy Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent 4b193ea commit 56daec5

54 files changed

Lines changed: 5430 additions & 358 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# EditorConfig — https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
indent_style = space
10+
indent_size = 4
11+
12+
[*.py]
13+
indent_size = 4
14+
max_line_length = 100
15+
16+
[*.{yml,yaml}]
17+
indent_size = 2
18+
19+
[*.md]
20+
trim_trailing_whitespace = false
21+
22+
[Makefile]
23+
indent_style = tab
24+
25+
[*.{cmd,bat}]
26+
end_of_line = crlf
27+
28+
[*.{ps1,psm1}]
29+
end_of_line = crlf
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug in west-env
4+
title: "bug: "
5+
labels: bug
6+
---
7+
8+
## Description
9+
10+
<!-- Clear description of the bug -->
11+
12+
## Steps to Reproduce
13+
14+
1.
15+
2.
16+
3.
17+
18+
## Expected Behavior
19+
20+
<!-- What should happen -->
21+
22+
## Actual Behavior
23+
24+
<!-- What actually happens -->
25+
26+
## Environment
27+
28+
- OS:
29+
- Python version:
30+
- west-env version:
31+
32+
## Additional Context
33+
34+
<!-- Logs, screenshots, or other relevant information -->
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an enhancement for west-env
4+
title: "feat: "
5+
labels: enhancement
6+
---
7+
8+
## Summary
9+
10+
<!-- Brief description of the feature -->
11+
12+
## Motivation
13+
14+
<!-- Why is this needed? What problem does it solve? -->
15+
16+
## Proposed Solution
17+
18+
<!-- How should this work? -->
19+
20+
## Alternatives Considered
21+
22+
<!-- Other approaches you've thought about -->
23+
24+
## Additional Context
25+
26+
<!-- Mockups, references, or related issues -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Description
2+
3+
<!-- Brief description of what this PR does -->
4+
5+
Closes #
6+
7+
## Changes
8+
9+
-
10+
11+
## Governance Checklist
12+
13+
- [ ] Read `AGENTS.md` and followed the workflow
14+
- [ ] Changes proposed in `LEDGER.md` before implementation
15+
- [ ] `docs/REQUIREMENTS.md` updated (if new/changed requirements)
16+
- [ ] `docs/TESTS.md` updated (if new/changed tests)
17+
- [ ] Lint passes: `ruff check`
18+
- [ ] Type check passes: `mypy`
19+
- [ ] Tests pass: `pytest`
20+
- [ ] Security scan passes: `pip-audit`
21+
- [ ] `LEDGER.md` entry recorded

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 5
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"
13+
open-pull-requests-limit: 5

.github/workflows/ci.yml

Lines changed: 94 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,161 +1,167 @@
1-
# SPDX-License-Identifier: Apache-2.0
2-
#
3-
# west-env CI
4-
# ===========
5-
#
6-
# Job 1 — unit-tests
7-
# Pure-Python unit tests for the west_env package.
8-
# Matrix: ubuntu / macOS / Windows × Python 3.10 / 3.11 / 3.12
9-
# (Zephyr supports Python 3.10–3.12.)
10-
#
11-
# Job 2 — native-sim-build
12-
# End-to-end integration test on ubuntu-latest:
13-
# 1. Set up a minimal west workspace (Zephyr only, no HALs).
14-
# 2. `west env doctor` — verifies the native environment looks healthy.
15-
# 3. `west env build -b native_sim` on Zephyr's hello_world sample.
16-
# 4. Run the resulting binary and assert it prints "Hello World".
17-
#
18-
# Container-backed builds are not tested here because the Zephyr container
19-
# image is not a public artifact in this repository. They can be exercised
20-
# locally with `west env build --container ...`.
21-
22-
name: west-env CI
1+
name: CI
232

243
on:
254
push:
265
pull_request:
276

7+
concurrency:
8+
group: ci-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
2814
jobs:
2915
# --------------------------------------------------------------------------
30-
# Job 1: unit tests across platforms and Python versions
16+
# Lint with ruff (ubuntu only)
17+
# --------------------------------------------------------------------------
18+
lint:
19+
name: Lint (ruff)
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
- run: pip install ruff
27+
- run: ruff check west_env/ west_commands/ tests/
28+
- run: ruff format --check west_env/ west_commands/ tests/
29+
30+
# --------------------------------------------------------------------------
31+
# Unit tests — Windows / Linux / macOS × Python 3.10 / 3.11 / 3.12
3132
# --------------------------------------------------------------------------
3233
unit-tests:
33-
name: Unit tests (py${{ matrix.python-version }}, ${{ matrix.os }})
34-
runs-on: ${{ matrix.os }}
34+
name: Unit tests (${{ matrix.os }}, py${{ matrix.python-version }})
35+
needs: [lint]
3536
strategy:
3637
fail-fast: false
3738
matrix:
38-
os: [ubuntu-latest, macos-latest, windows-latest]
39+
os: [ubuntu-latest, windows-latest, macos-latest]
3940
python-version: ["3.10", "3.11", "3.12"]
40-
41+
runs-on: ${{ matrix.os }}
4142
steps:
4243
- uses: actions/checkout@v4
43-
44-
- name: Set up Python ${{ matrix.python-version }}
45-
uses: actions/setup-python@v5
44+
- uses: actions/setup-python@v5
4645
with:
4746
python-version: ${{ matrix.python-version }}
48-
4947
- name: Install west-env with test dependencies
5048
run: pip install -e ".[test]"
49+
- name: Run core unit tests
50+
run: >
51+
pytest
52+
tests/test_config.py
53+
tests/test_container.py
54+
tests/test_engine.py
55+
tests/test_util.py
56+
tests/test_backend.py
57+
tests/test_sync.py
58+
tests/test_new_modules.py
59+
-v
5160
52-
- name: Run unit tests
53-
run: pytest tests/test_config.py tests/test_container.py tests/test_engine.py tests/test_util.py -v
61+
# --------------------------------------------------------------------------
62+
# Docker integration tests — ubuntu only (Docker available on GH runners)
63+
# --------------------------------------------------------------------------
64+
docker-integration:
65+
name: Docker integration (ubuntu)
66+
runs-on: ubuntu-latest
67+
timeout-minutes: 20
68+
steps:
69+
- uses: actions/checkout@v4
70+
- uses: actions/setup-python@v5
71+
with:
72+
python-version: "3.11"
73+
- name: Install west-env
74+
run: pip install -e ".[test]"
75+
- name: Docker integration + west e2e tests
76+
run: >
77+
pytest
78+
tests/test_docker_integration.py
79+
tests/test_west_e2e.py
80+
tests/test_mode_switch.py
81+
-v
82+
env:
83+
WEST_ENV_DOCKER_TEST_BASE_IMAGE: alpine/git:latest
5484

5585
# --------------------------------------------------------------------------
56-
# Job 2: native_sim hello_world — closed-loop integration test
86+
# native_sim hello_world — closed-loop Zephyr build (ubuntu only)
5787
# --------------------------------------------------------------------------
5888
native-sim-build:
59-
name: native_sim hello_world (ubuntu-latest)
89+
name: native_sim hello_world (ubuntu)
6090
runs-on: ubuntu-latest
6191
timeout-minutes: 30
62-
6392
steps:
6493
- uses: actions/checkout@v4
65-
66-
- name: Set up Python 3.11
67-
uses: actions/setup-python@v5
94+
- uses: actions/setup-python@v5
6895
with:
6996
python-version: "3.11"
70-
71-
# Install the PR's west-env code so that `west env` reflects this branch.
72-
- name: Install west-env (this PR)
97+
- name: Install west-env
7398
run: pip install -e ".[test]"
74-
75-
# native_sim builds with -m32 and requires 32-bit glibc headers.
76-
- name: Install 32-bit build dependencies (gcc-multilib)
99+
- name: Install 32-bit build deps
77100
run: sudo apt-get install -y --no-install-recommends gcc-multilib
78-
79-
# Cache Zephyr source to avoid a full clone on every run.
80101
- name: Cache west modules
81102
id: cache-west
82103
uses: actions/cache@v4
83104
with:
84105
path: /tmp/ci-ws
85-
key: west-modules-${{ runner.os }}-${{ hashFiles('tests/fixtures/ci-workspace/west.yml') }}
86-
87-
# -----------------------------------------------------------------------
88-
# Workspace setup (skipped when cache is warm)
89-
# -----------------------------------------------------------------------
106+
key: west-${{ runner.os }}-${{ hashFiles('tests/fixtures/ci-workspace/west.yml') }}
90107
- name: Copy CI fixture workspace
91108
if: steps.cache-west.outputs.cache-hit != 'true'
92109
run: |
93110
mkdir -p /tmp/ci-ws
94111
cp -r tests/fixtures/ci-workspace /tmp/ci-ws/workspace
95-
96112
- name: west init
97113
if: steps.cache-west.outputs.cache-hit != 'true'
98114
working-directory: /tmp/ci-ws/workspace
99115
run: west init -l .
100-
101-
- name: west update (Zephyr only — no HALs)
116+
- name: west update (Zephyr only, no HALs)
102117
if: steps.cache-west.outputs.cache-hit != 'true'
103118
working-directory: /tmp/ci-ws/workspace
104119
run: west update --narrow --fetch-opt=--depth=1
105-
106-
# Always re-install Python requirements (cheap, idempotent).
107120
- name: Install Zephyr Python requirements
108121
working-directory: /tmp/ci-ws/workspace
109122
run: |
110123
ZEPHYR_BASE=$(west list zephyr -f '{abspath}')
111124
pip install -r "$ZEPHYR_BASE/scripts/requirements.txt"
112-
113-
# -----------------------------------------------------------------------
114-
# Sanity check: native doctor (Python layer only)
115-
#
116-
# `west env doctor` requires west-env to be listed in the workspace
117-
# manifest under west-commands: — we skip the CLI wrapper here and
118-
# exercise the underlying Python functions directly instead.
119-
# The CLI dispatch layer is covered by the unit-tests job.
120-
# -----------------------------------------------------------------------
121-
- name: west-env doctor check (native mode)
125+
- name: west-env doctor (Python layer + backend detection)
122126
working-directory: /tmp/ci-ws/workspace
123127
run: |
124128
python - <<'EOF'
125129
from west_env.util import check_python, check_west
130+
from west_env.backend import doctor_lines
126131
import sys
127132
ok = check_python() and check_west()
133+
for line in doctor_lines('linux'):
134+
print(line)
128135
sys.exit(0 if ok else 1)
129136
EOF
130-
131-
# -----------------------------------------------------------------------
132-
# Build
133-
#
134-
# In native mode, `west env build` is exactly:
135-
# subprocess.check_call(["west", "build"] + passthrough)
136-
# so calling `west build` directly exercises the same code path and
137-
# avoids the west extension-command discovery requirement.
138-
# -----------------------------------------------------------------------
139137
- name: Build hello_world for native_sim
140138
working-directory: /tmp/ci-ws/workspace
141139
env:
142-
# Use the host GCC/Clang; no Zephyr SDK required for native_sim.
143140
ZEPHYR_TOOLCHAIN_VARIANT: host
144141
run: |
145142
ZEPHYR_BASE=$(west list zephyr -f '{abspath}')
146143
west build -b native_sim "$ZEPHYR_BASE/samples/hello_world"
147-
148-
# -----------------------------------------------------------------------
149-
# Closed-loop output validation
150-
# -----------------------------------------------------------------------
151144
- name: Validate hello_world output
152145
run: |
153-
# native_sim runs the Zephyr kernel loop indefinitely; use timeout
154-
# to capture early stdout then kill the process.
155146
OUTPUT=$(timeout 10s /tmp/ci-ws/workspace/build/zephyr/zephyr.exe 2>&1 || true)
156-
echo "--- binary output ---"
157-
echo "$OUTPUT"
158-
echo "---------------------"
159147
echo "$OUTPUT" | grep -q "Hello World" \
160-
|| { echo "FAIL: 'Hello World' not found in binary output"; exit 1; }
161-
echo "PASS: Hello World confirmed in output"
148+
|| { echo "FAIL: Hello World not found"; exit 1; }
149+
echo "PASS: Hello World confirmed"
150+
151+
# --------------------------------------------------------------------------
152+
# Security audit
153+
# --------------------------------------------------------------------------
154+
security:
155+
name: pip-audit
156+
runs-on: ubuntu-latest
157+
steps:
158+
- uses: actions/checkout@v4
159+
- uses: actions/setup-python@v5
160+
with:
161+
python-version: "3.12"
162+
- name: Install package and pip-audit
163+
run: |
164+
pip install -e .
165+
pip install pip-audit
166+
- name: Run pip-audit
167+
run: pip-audit --desc on || true

0 commit comments

Comments
 (0)