fix(ci): resolve PEP 668 Python environment issues using venv
Validators (Pushes and Pull Requests) / Database & Schema Validation (push) Failing after 7s
Validators (Pushes and Pull Requests) / CI Workflow Lint (push) Failing after 11s
Workflow Lint & Validation / Lint All Workflow Files (push) Failing after 13s
Workflow Lint & Validation / Validate Secrets Contract (push) Successful in 5s
Workflow Lint & Validation / Notify Lint Results (push) Failing after 1s
Validators (Pushes and Pull Requests) / Core Validators & Database Setup (push) Failing after 38s
Validators (Pushes and Pull Requests) / WBS & Audit Validations (push) Has been skipped
Validators (Pushes and Pull Requests) / .NET Contracts (push) Has been skipped
Validators (Pushes and Pull Requests) / Calibration & Performance (push) Has been skipped
Validators (Pushes and Pull Requests) / Operational Report & Decision Packet (push) Has been skipped
Validators (Pushes and Pull Requests) / UI & Storage Validation (push) Failing after 13s
Validators (Pushes and Pull Requests) / Security & Secrets (push) Successful in 7s
Validators (Pushes and Pull Requests) / Notify PR Results (push) Has been skipped

Solutions Applied:
✓ core job: Python venv for dependency isolation
  - /usr/bin/python3 -m venv $HOME/venv
  - Prevents 'externally-managed-environment' error
  - pip install within venv (no --break-system-packages)
  - PYTHONPATH points to site-packages

✓ workflow-lint job: Separate venv for yaml parsing
  - /usr/bin/python3 -m venv $HOME/venv_lint
  - PyYAML installed in isolated environment
  - Avoids PEP 668 conflicts

✓ Configure Runtime Paths: Create Temp directory
  - mkdir -p Temp
  - Ensures output files can be written
  - Solves FileNotFoundError for validation reports

Why venv instead of --break-system-packages:
- More portable and maintainable
- Follows Python best practices (PEP 668)
- No system package contamination
- Reproducible across environments

Expected Results:
✓ Setup Python Environment: No more externally-managed error
✓ Python imports: No more ModuleNotFoundError
✓ File writes: No more FileNotFoundError

Phase 0 Week 1: CI Baseline Refinement (Attempt 6)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 14:42:48 +09:00
parent c0ca72a913
commit e68f349617
+31 -13
View File
@@ -50,6 +50,10 @@ jobs:
run: |
export PATH=/usr/local/bin:$PATH
echo "/usr/local/bin" >> $GITHUB_PATH
# Ensure Temp directory exists
mkdir -p Temp
echo "=== 런타임 확인 ==="
/usr/bin/python3 --version
node --version
@@ -57,13 +61,20 @@ jobs:
- name: Setup Python Environment
run: |
PYTHON_DEPS="$HOME/python_deps/core"
mkdir -p "$PYTHON_DEPS"
/usr/bin/python3 -m pip install --disable-pip-version-check --quiet --upgrade pip setuptools wheel
/usr/bin/python3 -m pip install --disable-pip-version-check --quiet \
--target "$PYTHON_DEPS" requests pyyaml openpyxl pytest psycopg
echo "PYTHONPATH=$PYTHON_DEPS:${PYTHONPATH:-}" >> $GITHUB_ENV
/usr/bin/python3 -c 'import sys; sys.path.insert(0, "'$PYTHON_DEPS'"); import requests, yaml, openpyxl, pytest, psycopg; print("✓ Python dependencies installed")'
# Create virtual environment (PEP 668 compliant)
/usr/bin/python3 -m venv $HOME/venv
source $HOME/venv/bin/activate
# Upgrade pip and install packages
pip install --disable-pip-version-check --quiet --upgrade pip setuptools wheel
pip install --disable-pip-version-check --quiet requests pyyaml openpyxl pytest psycopg
# Add venv to PATH and PYTHONPATH
echo "$HOME/venv/bin" >> $GITHUB_PATH
echo "PYTHONPATH=$HOME/venv/lib/python3.12/site-packages:${PYTHONPATH:-}" >> $GITHUB_ENV
# Verify installation
python3 -c 'import requests, yaml, openpyxl, pytest, psycopg; print("✓ Python dependencies installed")'
- name: Apply Database Migrations
env:
@@ -443,12 +454,19 @@ jobs:
- name: Setup Python Environment
run: |
PYTHON_DEPS="$HOME/python_deps/lint"
mkdir -p "$PYTHON_DEPS"
/usr/bin/python3 -m pip install --disable-pip-version-check --quiet \
--target "$PYTHON_DEPS" pyyaml
echo "PYTHONPATH=$PYTHON_DEPS:${PYTHONPATH:-}" >> $GITHUB_ENV
echo "✓ Python dependencies installed"
# Create virtual environment (PEP 668 compliant)
/usr/bin/python3 -m venv $HOME/venv_lint
source $HOME/venv_lint/bin/activate
# Install YAML parser
pip install --disable-pip-version-check --quiet pyyaml
# Add venv to PATH
echo "$HOME/venv_lint/bin" >> $GITHUB_PATH
echo "PYTHONPATH=$HOME/venv_lint/lib/python3.12/site-packages:${PYTHONPATH:-}" >> $GITHUB_ENV
# Verify
python3 -c 'import yaml; print("✓ PyYAML installed")'
- name: Lint CI Workflow
run: python3 tools/validate_gitea_ci_workflow_lint_v1.py --workflow .gitea/workflows/ci.yml