ble-reticulum/.github/workflows/test.yml
torlando-tech c3c8bdd81c fix: configure non-interactive mode for CI apt-get installs
Ubuntu 24.04 CI was hanging on tzdata interactive timezone prompt.

Changes:
- tests/test_installer.sh: Set DEBIAN_FRONTEND=noninteractive, pre-configure timezone
- tests/test_installer.sh: Add apt-get options to suppress prompts
- .github/workflows/test.yml: Set environment variables in installer-test container
- install.sh: Auto-detect CI environment and enable non-interactive mode

This follows Debian/Ubuntu best practices for containerized environments and
prevents interactive prompts from blocking CI runs.

Fixes Ubuntu 24.04 installer-test CI failure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 20:05:59 -04:00

158 lines
4.6 KiB
YAML

name: Tests
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libglib2.0-dev libdbus-1-dev libcairo2-dev libgirepository1.0-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pytest-cov
pip install rns bleak bluezero dbus-python
- name: Create package structure
run: |
touch src/RNS/__init__.py
touch src/RNS/Interfaces/__init__.py
- name: Run unit tests
run: |
# Run only unit tests (fragmentation and prioritization)
python -m pytest tests/test_fragmentation.py tests/test_prioritization.py -v \
--cov=src/RNS/Interfaces/BLEFragmentation.py \
--cov-report=term-missing \
--cov-report=xml:coverage-unit.xml
continue-on-error: false
- name: Upload unit test coverage
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage-unit.xml
flags: unit
fail_ci_if_error: false
continue-on-error: true
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libglib2.0-dev libdbus-1-dev libcairo2-dev libgirepository1.0-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pytest-cov pytest-timeout
pip install rns bleak bluezero dbus-python
- name: Create package structure
run: |
touch src/RNS/__init__.py
touch src/RNS/Interfaces/__init__.py
- name: Run integration tests
run: |
# Run integration tests (no hardware required)
python -m pytest tests/ -v -m "not hardware" \
--cov=src/RNS/Interfaces \
--cov-report=term-missing \
--cov-report=xml:coverage-integration.xml \
--tb=short
continue-on-error: false
- name: Upload integration test coverage
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage-integration.xml
flags: integration
fail_ci_if_error: false
continue-on-error: true
- name: Test summary
if: always()
run: |
echo "## Integration Test Results" >> $GITHUB_STEP_SUMMARY
echo "- Python version: ${{ matrix.python-version }}" >> $GITHUB_STEP_SUMMARY
echo "- Tests run: All integration tests (hardware tests excluded)" >> $GITHUB_STEP_SUMMARY
echo "- See test output above for details" >> $GITHUB_STEP_SUMMARY
installer-test:
name: Installer Test (Fresh System)
runs-on: ubuntu-latest
strategy:
matrix:
os-image:
- "debian:12" # Debian Bookworm (latest stable)
- "ubuntu:22.04" # Ubuntu Jammy
- "ubuntu:24.04" # Ubuntu Noble (latest LTS)
container:
image: ${{ matrix.os-image }}
env:
DEBIAN_FRONTEND: noninteractive
DEBCONF_NONINTERACTIVE_SEEN: "true"
TZ: UTC
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: workspace
- name: Run installer integration test
run: |
cd workspace
bash tests/test_installer.sh
continue-on-error: false
- name: Installation summary
if: always()
run: |
echo "## Installer Test Results (${{ matrix.os-image }})" >> $GITHUB_STEP_SUMMARY
echo "✓ System packages: python3-gi, python3-dbus, python3-cairo, bluez" >> $GITHUB_STEP_SUMMARY
echo "✓ Pip packages: bleak, bluezero" >> $GITHUB_STEP_SUMMARY
echo "✓ Install method: System packages (no compilation)" >> $GITHUB_STEP_SUMMARY
echo "✓ Installation time: < 1 minute" >> $GITHUB_STEP_SUMMARY