fix(ci): 修复pip --break-system-packages兼容性问题
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 22s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 57s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 43s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 2m29s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1558h10m4s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1558h10m6s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1558h10m8s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1558h10m6s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1558h10m8s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1558h41m41s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 22s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 57s
CI/CD Pipeline / Integration Tests (pull_request) Failing after 43s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 2m29s
CI/CD Pipeline / Production Browser E2E (pull_request) Failing after 1558h10m4s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 1558h10m6s
CI/CD Pipeline / Build Production Runtime Images (pull_request) Failing after 1558h10m8s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 1558h10m6s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (pull_request) Failing after 1558h10m8s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 1558h41m41s
旧Runner使用pip 22.0.2 (Python 3.10),不支持--break-system-packages参数。 添加动态检测逻辑,兼容新旧版本pip和Python环境。
This commit is contained in:
+34
-10
@@ -91,10 +91,16 @@ jobs:
|
||||
- name: Install dependencies
|
||||
shell: sh
|
||||
run: |
|
||||
# Detect pip --break-system-packages support (pip >= 23.0 / PEP 668)
|
||||
PIP_BREAK_FLAG=""
|
||||
if python3 -m pip install --help 2>/dev/null | grep -q "break-system-packages"; then
|
||||
PIP_BREAK_FLAG="--break-system-packages"
|
||||
fi
|
||||
echo "PIP_BREAK_FLAG=$PIP_BREAK_FLAG" >> "$GITHUB_ENV"
|
||||
set -eu
|
||||
python3 -m pip install --break-system-packages -q -r requirements-base.txt
|
||||
python3 -m pip install --break-system-packages -q -r requirements.txt
|
||||
python3 -m pip install --break-system-packages -q -r requirements-dev.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements-base.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements-dev.txt
|
||||
python3 -m black --version
|
||||
python3 -m isort --version-number
|
||||
python3 -m flake8 --version
|
||||
@@ -220,10 +226,16 @@ jobs:
|
||||
- name: Install dependencies
|
||||
shell: sh
|
||||
run: |
|
||||
# Detect pip --break-system-packages support (pip >= 23.0 / PEP 668)
|
||||
PIP_BREAK_FLAG=""
|
||||
if python3 -m pip install --help 2>/dev/null | grep -q "break-system-packages"; then
|
||||
PIP_BREAK_FLAG="--break-system-packages"
|
||||
fi
|
||||
echo "PIP_BREAK_FLAG=$PIP_BREAK_FLAG" >> "$GITHUB_ENV"
|
||||
set -eu
|
||||
python3 -m pip install --break-system-packages -q -r requirements-base.txt
|
||||
python3 -m pip install --break-system-packages -q -r requirements.txt
|
||||
python3 -m pip install --break-system-packages -q -r requirements-dev.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements-base.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements-dev.txt
|
||||
pytest --version
|
||||
|
||||
- name: Run unit tests with coverage
|
||||
@@ -319,10 +331,16 @@ jobs:
|
||||
- name: Install dependencies
|
||||
shell: sh
|
||||
run: |
|
||||
# Detect pip --break-system-packages support (pip >= 23.0 / PEP 668)
|
||||
PIP_BREAK_FLAG=""
|
||||
if python3 -m pip install --help 2>/dev/null | grep -q "break-system-packages"; then
|
||||
PIP_BREAK_FLAG="--break-system-packages"
|
||||
fi
|
||||
echo "PIP_BREAK_FLAG=$PIP_BREAK_FLAG" >> "$GITHUB_ENV"
|
||||
set -eu
|
||||
python3 -m pip install --break-system-packages -q -r requirements-base.txt
|
||||
python3 -m pip install --break-system-packages -q -r requirements.txt
|
||||
python3 -m pip install --break-system-packages -q -r requirements-dev.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements-base.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements.txt
|
||||
python3 -m pip install $PIP_BREAK_FLAG -q -r requirements-dev.txt
|
||||
pytest --version
|
||||
|
||||
- name: Start Redis
|
||||
@@ -394,7 +412,7 @@ jobs:
|
||||
shell: sh
|
||||
run: |
|
||||
set -eu
|
||||
pip install --break-system-packages -q pytest-rerunfailures
|
||||
pip install $PIP_BREAK_FLAG -q pytest-rerunfailures
|
||||
PYTHONPATH="$PWD/apps/api:$PWD" python3 -m coverage run --append \
|
||||
--source=apps/api/app,packages \
|
||||
--omit="*/migrations/*,*/tests/*,*/test_*.py,*/site-packages/*" \
|
||||
@@ -536,6 +554,12 @@ jobs:
|
||||
- name: Install dependencies
|
||||
shell: sh
|
||||
run: |
|
||||
# Detect pip --break-system-packages support (pip >= 23.0 / PEP 668)
|
||||
PIP_BREAK_FLAG=""
|
||||
if python3 -m pip install --help 2>/dev/null | grep -q "break-system-packages"; then
|
||||
PIP_BREAK_FLAG="--break-system-packages"
|
||||
fi
|
||||
echo "PIP_BREAK_FLAG=$PIP_BREAK_FLAG" >> "$GITHUB_ENV"
|
||||
set -eu
|
||||
docker run --rm \
|
||||
-v "$PWD:/workspace" \
|
||||
|
||||
Reference in New Issue
Block a user