Skip to content

chore(deps): Bump actions/checkout from 4 to 6 #38

chore(deps): Bump actions/checkout from 4 to 6

chore(deps): Bump actions/checkout from 4 to 6 #38

Workflow file for this run

name: CI
on:
push:
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# --------------------------------------------------------------------------
# Lint with ruff (ubuntu only)
# --------------------------------------------------------------------------
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install ruff
- run: ruff check west_env/ west_commands/ tests/
- run: ruff format --check west_env/ west_commands/ tests/
# --------------------------------------------------------------------------
# Unit tests — Windows / Linux / macOS × Python 3.10 / 3.11 / 3.12
# --------------------------------------------------------------------------
unit-tests:
name: Unit tests (${{ matrix.os }}, py${{ matrix.python-version }})
needs: [lint]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install west-env with test dependencies
run: pip install -e ".[test]"
- name: Run core unit tests
run: >
pytest
tests/test_config.py
tests/test_container.py
tests/test_engine.py
tests/test_util.py
tests/test_backend.py
tests/test_sync.py
tests/test_new_modules.py
tests/test_buildcheck.py
-v
- name: macOS backend detection smoke test
if: matrix.os == 'macos-latest'
run: |
python - <<'EOF'
import sys
from west_env.backend import detect_all
probes = detect_all('darwin')
assert 'podman-machine' in probes, "Expected podman-machine probe on macOS"
assert 'docker-machine' in probes, "Expected docker-machine probe on macOS"
print("[PASS] macOS backend detection: probed", list(probes.keys()))
EOF
# --------------------------------------------------------------------------
# Podman integration tests — ubuntu only (Podman pre-installed on ubuntu)
# --------------------------------------------------------------------------
podman-integration:
name: Podman integration (ubuntu)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install west-env
run: pip install -e ".[test]"
- name: Verify Podman available
run: podman --version
- name: Run Podman integration tests
run: pytest tests/test_podman_integration.py -v
env:
WEST_ENV_PODMAN_TEST_BASE_IMAGE: alpine/git:latest
# --------------------------------------------------------------------------
# Docker integration tests — ubuntu only (Docker available on GH runners)
# --------------------------------------------------------------------------
docker-integration:
name: Docker integration (ubuntu)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install west-env
run: pip install -e ".[test]"
- name: Docker integration + west e2e tests
run: >
pytest
tests/test_docker_integration.py
tests/test_west_e2e.py
tests/test_mode_switch.py
-v
env:
WEST_ENV_DOCKER_TEST_BASE_IMAGE: alpine/git:latest
# --------------------------------------------------------------------------
# native_sim hello_world — closed-loop Zephyr build (ubuntu only)
# --------------------------------------------------------------------------
native-sim-build:
name: native_sim hello_world (ubuntu)
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install west-env
run: pip install -e ".[test]"
- name: Install 32-bit build deps
run: sudo apt-get install -y --no-install-recommends gcc-multilib
- name: Cache west modules
id: cache-west
uses: actions/cache@v4
with:
path: /tmp/ci-ws
key: west-${{ runner.os }}-${{ hashFiles('tests/fixtures/ci-workspace/west.yml') }}
- name: Copy CI fixture workspace
if: steps.cache-west.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/ci-ws
cp -r tests/fixtures/ci-workspace /tmp/ci-ws/workspace
- name: west init
if: steps.cache-west.outputs.cache-hit != 'true'
working-directory: /tmp/ci-ws/workspace
run: west init -l .
- name: west update (Zephyr only, no HALs)
if: steps.cache-west.outputs.cache-hit != 'true'
working-directory: /tmp/ci-ws/workspace
run: west update --narrow --fetch-opt=--depth=1
- name: Install Zephyr Python requirements
working-directory: /tmp/ci-ws/workspace
run: |
ZEPHYR_BASE=$(west list zephyr -f '{abspath}')
pip install -r "$ZEPHYR_BASE/scripts/requirements.txt"
- name: west-env doctor (Python layer + backend detection)
working-directory: /tmp/ci-ws/workspace
run: |
python - <<'EOF'
from west_env.util import check_python, check_west
from west_env.backend import doctor_lines
import sys
ok = check_python() and check_west()
for line in doctor_lines('linux'):
print(line)
sys.exit(0 if ok else 1)
EOF
- name: Build hello_world for native_sim
working-directory: /tmp/ci-ws/workspace
env:
ZEPHYR_TOOLCHAIN_VARIANT: host
run: |
ZEPHYR_BASE=$(west list zephyr -f '{abspath}')
west build -b native_sim "$ZEPHYR_BASE/samples/hello_world"
- name: Validate hello_world output
run: |
OUTPUT=$(timeout 10s /tmp/ci-ws/workspace/build/zephyr/zephyr.exe 2>&1 || true)
echo "$OUTPUT" | grep -q "Hello World" \
|| { echo "FAIL: Hello World not found"; exit 1; }
echo "PASS: Hello World confirmed"
# --------------------------------------------------------------------------
# Security audit
# --------------------------------------------------------------------------
security:
name: pip-audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install package and pip-audit
run: |
pip install -e .
pip install pip-audit
- name: Run pip-audit
run: pip-audit --desc on || true