Skip to content

Add headless mode and enhance GitHub Actions #67

Add headless mode and enhance GitHub Actions

Add headless mode and enhance GitHub Actions #67

Workflow file for this run

name: Test
on: [push, pull_request]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test (Python ${{ matrix.target.python }}, ${{ matrix.target.os }})
runs-on: ${{ matrix.target.builder }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
# NOTE: Full testsuite on Windows is disabled because the test script
# requires Linux kernel source tree. However, headless mode tests
# are now enabled for Windows.
target:
# Python 3.12
- python: '3.12'
os: Linux
builder: ubuntu-24.04
- python: '3.12'
os: macOS
builder: macos-15
- python: '3.12'
os: Windows
builder: windows-2022
headless-only: true
steps:
- name: Set up environment
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
# Disable file name validation on Windows because Linux source tree
# contains potentially problematic file names.
git config --global core.protectNTFS false
fi
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.target.python }}
- name: Check Python version
run: |
set -x
python --version
pip --version
python -c "import platform; print(platform.architecture())"
- name: Install Python dependencies
run: |
pip install --user setuptools wheel
- name: Check out Linux source code
# Skip for Windows (headless-only mode)
if: ${{ matrix.target.headless-only != true }}
uses: actions/checkout@v5
# On Windows, checkout of 'aux.c' is expected to fail because ... Windows.
continue-on-error: true
with:
repository: torvalds/linux
ref: v5.4
- name: Check out Kconfiglib source code
uses: actions/checkout@v5
with:
# Windows (headless-only): checkout to root directory
# Linux/macOS (full test): checkout to Kconfiglib subdirectory
path: ${{ matrix.target.headless-only && '.' || 'Kconfiglib' }}
- name: Apply Linux Kconfig Makefile patch
# Skip for Windows (headless-only mode)
if: ${{ matrix.target.headless-only != true }}
run: |
git apply Kconfiglib/makefile.patch
- name: Run testsuite
# Skip for Windows (headless-only mode)
if: ${{ matrix.target.headless-only != true }}
run: |
Kconfiglib/tests/reltest python
- name: Test headless mode
# Use root dir for Windows, Kconfiglib subdir for Linux/macOS
working-directory: ${{ matrix.target.headless-only && '.' || 'Kconfiglib' }}
run: |
python << 'EOF'
from kconfiglib import Kconfig
import menuconfig
print('Testing headless mode...')
kconf = Kconfig('examples/Kmenuconfig')
menuconfig.menuconfig(kconf, headless=True)
print('Headless mode test passed')
EOF
- name: Install windows-curses (Windows only)
if: matrix.target.os == 'Windows'
run: |
pip install windows-curses
- name: Test menuconfig import (Windows Python 3.12)
if: matrix.target.os == 'Windows'
# Use root dir for Windows (headless-only mode)
working-directory: ${{ matrix.target.headless-only && '.' || 'Kconfiglib' }}
run: |
python -c "import menuconfig; print('menuconfig import successful')"