Skip to content

[CI] Automatic dependency updates #1

[CI] Automatic dependency updates

[CI] Automatic dependency updates #1

Workflow file for this run

name: CI
on:
pull_request:
permissions:
contents: read
jobs:
# ============================================
# Linting with flake8
# ============================================
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install flake8
run: pip install flake8
- name: Run flake8
run: flake8 logzio --count --show-source --statistics
# ============================================
# Unit Tests across multiple Python versions
# ============================================
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov future requests
- name: Run unit tests with coverage
run: |
pytest --cov-report=term-missing --cov=logzio tests/ -v --ignore=tests/e2e/
- name: Upload coverage report
if: matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: .coverage
retention-days: 5
# ============================================
# E2E Integration Test with Logz.io
# Sends real logs and validates via API
# ============================================
e2e-integration:
name: E2E Integration Test
runs-on: ubuntu-latest
# Only run E2E if unit tests pass
needs: [lint, test]
# Skip E2E if secrets are not available (e.g., fork PRs)
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest requests
- name: Install package in development mode
run: pip install -e .
- name: Generate unique ENV_ID
id: env-id
run: echo "value=e2e-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_OUTPUT
- name: Run E2E integration test
env:
LOGZIO_TOKEN: ${{ secrets.LOGZIO_TOKEN }}
LOGZIO_LOGS_API_KEY: ${{ secrets.LOGZIO_LOGS_API_KEY }}
LOGZIO_API_URL: ${{ secrets.LOGZIO_API_URL }}
ENV_ID: ${{ steps.env-id.outputs.value }}
run: |
pytest tests/e2e/test_logzio_e2e.py -v --tb=long
# ============================================
# Summary job for branch protection
# ============================================
ci-success:
name: CI Success
runs-on: ubuntu-latest
needs: [lint, test, e2e-integration]
if: always()
steps:
- name: Check all jobs passed
run: |
if [[ "${{ needs.lint.result }}" != "success" ]]; then
echo "Lint job failed"
exit 1
fi
if [[ "${{ needs.test.result }}" != "success" ]]; then
echo "Test job failed"
exit 1
fi
if [[ "${{ needs.e2e-integration.result }}" != "success" && "${{ needs.e2e-integration.result }}" != "skipped" ]]; then
echo "E2E integration job failed"
exit 1
fi
echo "All CI checks passed! ✅"