feat: adiciona suporte para armazenar caminhos relativos de arquivos #91
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint and unit checks | |
| on: | |
| pull_request: | |
| branches: [ main ] | |
| push: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Python lint with pre-commit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| requirements-dev.txt | |
| requirements.txt | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-dev.txt | |
| - name: Run pre-commit hooks | |
| run: | | |
| pre-commit run --all-files | |
| unit: | |
| name: Unit tests (${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| needs: lint | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-latest | |
| platform: linux/amd64 | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| platform: linux/arm64 | |
| env: | |
| PLATFORM: ${{ matrix.platform }} | |
| services: | |
| postgres: | |
| image: postgres:11 | |
| env: | |
| POSTGRES_PASSWORD: queridodiario | |
| POSTGRES_USER: queridodiario | |
| POSTGRES_DB: queridodiariodb | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| opensearch: | |
| image: opensearchproject/opensearch:2.9.0 | |
| env: | |
| discovery.type: single-node | |
| plugins.security.ssl.http.enabled: false | |
| plugins.security.disabled: true | |
| OPENSEARCH_INITIAL_ADMIN_PASSWORD: admin | |
| options: >- | |
| --health-cmd "curl -s http://localhost:9200 >/dev/null || exit 1" | |
| --health-interval 15s | |
| --health-timeout 10s | |
| --health-retries 20 | |
| ports: | |
| - 9200:9200 | |
| apache-tika: | |
| image: ghcr.io/${{ github.repository }}/apache-tika:latest | |
| ports: | |
| - 9998:9998 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Start MinIO | |
| run: | | |
| docker run -d \ | |
| --name minio \ | |
| --network host \ | |
| --health-cmd "curl -f http://localhost:9000/minio/health/live || exit 1" \ | |
| --health-interval 10s \ | |
| --health-timeout 5s \ | |
| --health-retries 5 \ | |
| -e MINIO_ROOT_USER=minio-access-key \ | |
| -e MINIO_ROOT_PASSWORD=minio-secret-key \ | |
| quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z \ | |
| server /data --console-address :9001 | |
| # Wait for MinIO to be ready | |
| echo "Waiting for MinIO to be ready..." | |
| timeout 60 bash -c 'until curl -sf http://localhost:9000/minio/health/live > /dev/null 2>&1; do sleep 2; done' | |
| echo "MinIO is ready" | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| cache-dependency-path: requirements.txt | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Create MinIO bucket | |
| run: | | |
| # Wait for MinIO to be ready | |
| for i in {1..30}; do | |
| if curl -sf http://localhost:9000/minio/health/live > /dev/null 2>&1; then | |
| echo "MinIO is ready" | |
| break | |
| fi | |
| echo "Waiting for MinIO... ($i/30)" | |
| sleep 2 | |
| done | |
| # Detect architecture and download appropriate MinIO client | |
| ARCH=$(uname -m) | |
| if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then | |
| MC_URL="https://dl.min.io/client/mc/release/linux-arm64/mc" | |
| else | |
| MC_URL="https://dl.min.io/client/mc/release/linux-amd64/mc" | |
| fi | |
| echo "Downloading MinIO client for architecture: $ARCH" | |
| curl -sLo /tmp/mc "$MC_URL" | |
| chmod +x /tmp/mc | |
| # Configure MinIO client | |
| /tmp/mc alias set minio http://localhost:9000 minio-access-key minio-secret-key | |
| # Create bucket if it doesn't exist | |
| /tmp/mc mb minio/queridodiariobucket --ignore-existing || true | |
| echo "MinIO bucket created successfully" | |
| - name: Create OpenSearch index | |
| timeout-minutes: 2 | |
| run: | | |
| echo "=== Creating OpenSearch index ===" | |
| echo "OpenSearch host: http://localhost:9200" | |
| echo "Testing connectivity..." | |
| curl -v http://localhost:9200/_cluster/health || echo "OpenSearch not responding" | |
| echo "Running init script..." | |
| chmod +x init-scripts/opensearch/create-opensearch-index.sh | |
| OPENSEARCH_HOST=http://localhost:9200 \ | |
| OPENSEARCH_USER=admin \ | |
| OPENSEARCH_PASSWORD=admin \ | |
| INDEX_NAME=querido-diario \ | |
| ./init-scripts/opensearch/create-opensearch-index.sh | |
| echo "=== OpenSearch index creation completed ===" | |
| - name: Run unit tests | |
| timeout-minutes: 5 | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| PYTHONUNBUFFERED: 1 | |
| POSTGRES_PASSWORD: queridodiario | |
| POSTGRES_USER: queridodiario | |
| POSTGRES_DB: queridodiariodb | |
| POSTGRES_HOST: localhost | |
| POSTGRES_PORT: 5432 | |
| STORAGE_REGION: us-east-1 | |
| STORAGE_ENDPOINT: http://localhost:9000 | |
| STORAGE_ACCESS_KEY: minio-access-key | |
| STORAGE_ACCESS_SECRET: minio-secret-key | |
| STORAGE_BUCKET: queridodiariobucket | |
| OPENSEARCH_HOST: http://localhost:9200 | |
| OPENSEARCH_INDEX: querido-diario | |
| OPENSEARCH_USER: admin | |
| OPENSEARCH_PASSWORD: admin | |
| APACHE_TIKA_SERVER: http://localhost:9998 | |
| DEBUG: 1 | |
| HF_HUB_OFFLINE: 1 | |
| TRANSFORMERS_OFFLINE: 1 | |
| SENTENCE_TRANSFORMERS_HOME: /tmp/sentence_transformers | |
| run: | | |
| echo "=========================================" | |
| echo "🧪 STARTING INSTRUMENTED TEST RUN" | |
| echo "=========================================" | |
| echo "Working directory: $(pwd)" | |
| echo "Python: $(which python)" | |
| echo "Python version: $(python --version)" | |
| echo "Time: $(date)" | |
| echo "" | |
| # Make runner executable | |
| chmod +x instrumented_test_runner.py | |
| # Run with our instrumented runner | |
| python instrumented_test_runner.py | |
| echo "" | |
| echo "=========================================" | |
| echo "Test run completed at: $(date)" | |
| echo "=========================================" |