mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-08 07:45:32 +01:00
fix(ci): actualiza y corrige workflows de CI/CD
Mejoras realizadas en los workflows de GitHub Actions: **ci.yml:** - Mejora verificación de dependencias Python para validar formato y presencia de paquetes ML/OCR críticos - Corrige cache key en frontend-bundle-analysis (pnpm-lock.yaml en vez de package-lock.json) - Agrega timeout de 20 minutos al job verify-environment **docker-intellidocs.yml:** - Agrega variable SKIP_SLOW_TESTS=1 en smoke tests ML para evitar timeouts - Mejora lógica de determinación de tags Docker con sanitización de nombres de branches - Agrega soporte para tags y manejo de caracteres especiales en nombres de branches - Agrega timeouts: 30min (test-ml-dependencies), 120min (build-and-push), 20min (test-docker-image) **translate-strings.yml:** - Especifica versión explícita de Python (3.11) y UV (0.9.x) - Agrega parámetro --python en uv sync para consistencia - Cambia runner de ubuntu-latest a ubuntu-24.04 - Agrega timeout de 20 minutos Estas correcciones aseguran que: - Las verificaciones sean más robustas y precisas - Los jobs no se cuelguen indefinidamente - Los caches se invaliden correctamente - Los tags Docker se generen correctamente para cualquier nombre de branch
This commit is contained in:
parent
7055a8485e
commit
e93af403c8
3 changed files with 54 additions and 7 deletions
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
|
|
@ -77,6 +77,7 @@ jobs:
|
||||||
verify-environment:
|
verify-environment:
|
||||||
name: "Verify Environment & Services"
|
name: "Verify Environment & Services"
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 20
|
||||||
needs:
|
needs:
|
||||||
- pre-commit
|
- pre-commit
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -126,16 +127,43 @@ jobs:
|
||||||
echo "✓ requirements.txt generated successfully"
|
echo "✓ requirements.txt generated successfully"
|
||||||
- name: Verify Python dependencies installation
|
- name: Verify Python dependencies installation
|
||||||
run: |
|
run: |
|
||||||
# Verify that requirements.txt can be parsed
|
# Verify that requirements.txt is valid and dependencies can be resolved
|
||||||
if ! python -c "
|
if ! python -c "
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
try:
|
try:
|
||||||
with open('requirements.txt', 'r') as f:
|
with open('requirements.txt', 'r') as f:
|
||||||
lines = f.readlines()
|
lines = [l.strip() for l in f.readlines() if l.strip() and not l.startswith('#')]
|
||||||
print(f'✓ requirements.txt has {len(lines)} entries')
|
|
||||||
|
# Validate format of each dependency line
|
||||||
|
invalid_lines = []
|
||||||
|
for line in lines:
|
||||||
|
# Skip empty lines and comments
|
||||||
|
if not line or line.startswith('#'):
|
||||||
|
continue
|
||||||
|
# Basic validation: should contain package name
|
||||||
|
if not re.match(r'^[a-zA-Z0-9_-]+', line):
|
||||||
|
invalid_lines.append(line)
|
||||||
|
|
||||||
|
if invalid_lines:
|
||||||
|
print(f'✗ Invalid dependency lines found: {invalid_lines}')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print(f'✓ requirements.txt has {len(lines)} valid entries')
|
||||||
|
|
||||||
|
# Verify critical ML/OCR dependencies are present
|
||||||
|
content = ' '.join(lines)
|
||||||
|
required_packages = ['torch', 'transformers', 'opencv-python', 'sentence-transformers', 'scikit-learn']
|
||||||
|
missing = [pkg for pkg in required_packages if pkg not in content]
|
||||||
|
|
||||||
|
if missing:
|
||||||
|
print(f'✗ Missing critical ML/OCR dependencies: {missing}')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print(f'✓ All critical ML/OCR dependencies present')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'✗ Error reading requirements.txt: {e}')
|
print(f'✗ Error validating requirements.txt: {e}')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
"; then
|
"; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -461,7 +489,7 @@ except Exception as e:
|
||||||
path: |
|
path: |
|
||||||
~/.pnpm-store
|
~/.pnpm-store
|
||||||
~/.cache
|
~/.cache
|
||||||
key: ${{ runner.os }}-frontenddeps-${{ hashFiles('src-ui/package-lock.json') }}
|
key: ${{ runner.os }}-frontenddeps-${{ hashFiles('src-ui/pnpm-lock.yaml') }}
|
||||||
- name: Re-link Angular cli
|
- name: Re-link Angular cli
|
||||||
run: cd src-ui && pnpm link @angular/cli
|
run: cd src-ui && pnpm link @angular/cli
|
||||||
- name: Build frontend and upload analysis
|
- name: Build frontend and upload analysis
|
||||||
|
|
|
||||||
15
.github/workflows/docker-intellidocs.yml
vendored
15
.github/workflows/docker-intellidocs.yml
vendored
|
|
@ -22,6 +22,7 @@ jobs:
|
||||||
test-ml-dependencies:
|
test-ml-dependencies:
|
||||||
name: Validate ML/OCR Dependencies
|
name: Validate ML/OCR Dependencies
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 30
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|
@ -83,6 +84,9 @@ jobs:
|
||||||
"
|
"
|
||||||
|
|
||||||
- name: Run ML smoke tests
|
- name: Run ML smoke tests
|
||||||
|
env:
|
||||||
|
# Skip slow tests that download models to avoid timeouts/disk space issues
|
||||||
|
SKIP_SLOW_TESTS: "1"
|
||||||
run: |
|
run: |
|
||||||
uv run pytest src/documents/tests/test_ml_smoke.py -v --tb=short
|
uv run pytest src/documents/tests/test_ml_smoke.py -v --tb=short
|
||||||
|
|
||||||
|
|
@ -92,6 +96,7 @@ jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
name: Build IntelliDocs Docker Image
|
name: Build IntelliDocs Docker Image
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 120
|
||||||
needs: test-ml-dependencies
|
needs: test-ml-dependencies
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -167,6 +172,7 @@ jobs:
|
||||||
test-docker-image:
|
test-docker-image:
|
||||||
name: Test Docker Image
|
name: Test Docker Image
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 20
|
||||||
needs: build-and-push
|
needs: build-and-push
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
|
|
||||||
|
|
@ -183,8 +189,15 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
||||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
echo "tag=latest" >> $GITHUB_OUTPUT
|
||||||
|
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||||
|
# For tags, use the tag name directly
|
||||||
|
TAG_NAME="${{ github.ref_name }}"
|
||||||
|
echo "tag=${TAG_NAME}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
# For branches, sanitize name to be Docker-compatible
|
||||||
|
# Replace / with - and remove special characters
|
||||||
|
SANITIZED_TAG=$(echo "${{ github.ref_name }}" | sed 's/\//-/g' | sed 's/[^a-zA-Z0-9._-]/-/g')
|
||||||
|
echo "tag=${SANITIZED_TAG}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Pull Docker image
|
- name: Pull Docker image
|
||||||
|
|
|
||||||
8
.github/workflows/translate-strings.yml
vendored
8
.github/workflows/translate-strings.yml
vendored
|
|
@ -6,7 +6,8 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
generate-translate-strings:
|
generate-translate-strings:
|
||||||
name: Generate Translation Strings
|
name: Generate Translation Strings
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
|
timeout-minutes: 20
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -18,6 +19,8 @@ jobs:
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: setup-python
|
id: setup-python
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
- name: Install system dependencies
|
- name: Install system dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
|
|
@ -25,10 +28,13 @@ jobs:
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6
|
uses: astral-sh/setup-uv@v6
|
||||||
with:
|
with:
|
||||||
|
version: '0.9.x'
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
|
python-version: ${{ steps.setup-python.outputs.python-version }}
|
||||||
- name: Install backend python dependencies
|
- name: Install backend python dependencies
|
||||||
run: |
|
run: |
|
||||||
uv sync \
|
uv sync \
|
||||||
|
--python ${{ steps.setup-python.outputs.python-version }} \
|
||||||
--group dev \
|
--group dev \
|
||||||
--frozen
|
--frozen
|
||||||
- name: Generate backend translation strings
|
- name: Generate backend translation strings
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue