mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-02-27 12:46:07 -05:00
81 lines
3.1 KiB
YAML
81 lines
3.1 KiB
YAML
name: 🧪 Manual Test Suite Selector
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
run_scan:
|
|
description: '📂 scan/ (Scan, Logic, Locks, IPs)'
|
|
type: boolean
|
|
default: true
|
|
run_api:
|
|
description: '📂 api_endpoints/ & server/ (Endpoints & Server)'
|
|
type: boolean
|
|
default: false
|
|
run_backend:
|
|
description: '📂 backend/ & db/ (SQL Builder, Security & Migration)'
|
|
type: boolean
|
|
default: false
|
|
run_docker_env:
|
|
description: '📂 docker_tests/ (Environment & PUID/PGID)'
|
|
type: boolean
|
|
default: false
|
|
run_ui:
|
|
description: '📂 ui/ (Selenium & Dashboard)'
|
|
type: boolean
|
|
default: false
|
|
run_root_files:
|
|
description: '📄 Root Test Files (WOL, Atomicity, etc.)'
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
comprehensive-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Environment
|
|
run: sudo apt-get update && sudo apt-get install -y sqlite3
|
|
|
|
- name: Build Test Path Command
|
|
id: builder
|
|
run: |
|
|
PATHS=""
|
|
# Folder Mapping with 'test/' prefix
|
|
if [ "${{ github.event.inputs.run_scan }}" == "true" ]; then PATHS="$PATHS test/scan/"; fi
|
|
if [ "${{ github.event.inputs.run_api }}" == "true" ]; then PATHS="$PATHS test/api_endpoints/ test/server/"; fi
|
|
if [ "${{ github.event.inputs.run_backend }}" == "true" ]; then PATHS="$PATHS test/backend/ test/db/"; fi
|
|
if [ "${{ github.event.inputs.run_docker_env }}" == "true" ]; then PATHS="$PATHS test/docker_tests/"; fi
|
|
if [ "${{ github.event.inputs.run_ui }}" == "true" ]; then PATHS="$PATHS test/ui/"; fi
|
|
|
|
# Root Files Mapping (files sitting directly in /test/)
|
|
if [ "${{ github.event.inputs.run_root_files }}" == "true" ]; then
|
|
PATHS="$PATHS test/test_device_atomicity.py test/test_mcp_disablement.py test/test_plugin_helper.py test/test_wol_validation.py"
|
|
fi
|
|
|
|
# If nothing is selected, default to the whole test folder
|
|
if [ -z "$PATHS" ]; then PATHS="test/"; fi
|
|
|
|
echo "final_paths=$PATHS" >> $GITHUB_OUTPUT
|
|
|
|
- name: Run Docker Integration Script
|
|
run: |
|
|
chmod +x ./scripts/run_tests_in_docker_environment.sh
|
|
|
|
# We update the pytest command to use the specific paths built above.
|
|
# Note: We still keep your 'not' filter to skip E2E tests unless you want them.
|
|
TARGET_PATHS="${{ steps.builder.outputs.final_paths }}"
|
|
SED_COMMAND="pytest $TARGET_PATHS -m 'not (docker or compose or feature_complete)'"
|
|
|
|
echo "🚀 Targeted Pytest Command: $SED_COMMAND"
|
|
|
|
sed -i "s|pytest -m 'not (docker or compose or feature_complete)'|$SED_COMMAND|g" ./scripts/run_tests_in_docker_environment.sh
|
|
|
|
./scripts/run_tests_in_docker_environment.sh
|
|
|
|
- name: Cleanup
|
|
if: always()
|
|
run: |
|
|
docker stop netalertx-test-container || true
|
|
docker rm netalertx-test-container || true |