|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + quality: |
| 10 | + name: Code Quality |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v5 |
| 15 | + |
| 16 | + - name: Install uv |
| 17 | + uses: astral-sh/setup-uv@v3 |
| 18 | + with: |
| 19 | + version: "latest" |
| 20 | + |
| 21 | + - name: Set up Python |
| 22 | + run: uv python install 3.12 |
| 23 | + |
| 24 | + - name: Cache pre-commit |
| 25 | + uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: ~/.cache/pre-commit |
| 28 | + key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: uv sync --extra dev --extra test |
| 32 | + |
| 33 | + - name: Run code quality checks |
| 34 | + run: | |
| 35 | + echo "🔍 Running all code quality checks..." |
| 36 | + uv run pre-commit run --all-files --show-diff-on-failure |
| 37 | +
|
| 38 | + test: |
| 39 | + name: Test Python ${{ matrix.python-version }} |
| 40 | + runs-on: ubuntu-latest |
| 41 | + needs: quality |
| 42 | + strategy: |
| 43 | + matrix: |
| 44 | + python-version: ["3.9", "3.10", "3.11", "3.12"] |
| 45 | + fail-fast: false |
| 46 | + |
| 47 | + steps: |
| 48 | + - name: Checkout code |
| 49 | + uses: actions/checkout@v5 |
| 50 | + |
| 51 | + - name: Install uv |
| 52 | + uses: astral-sh/setup-uv@v3 |
| 53 | + with: |
| 54 | + version: "latest" |
| 55 | + |
| 56 | + - name: Set up Python ${{ matrix.python-version }} |
| 57 | + run: uv python install ${{ matrix.python-version }} |
| 58 | + |
| 59 | + - name: Install dependencies |
| 60 | + run: uv sync --extra dev --extra test |
| 61 | + |
| 62 | + - name: Run tests with coverage |
| 63 | + run: | |
| 64 | + echo "🧪 Running tests for Python ${{ matrix.python-version }}..." |
| 65 | + uv run pytest --cov=eoapi_notifier --cov-report=xml --cov-report=term-missing --tb=short -v |
| 66 | +
|
| 67 | + - name: Upload coverage to Codecov |
| 68 | + if: matrix.python-version == '3.12' |
| 69 | + uses: codecov/codecov-action@v5 |
| 70 | + with: |
| 71 | + files: ./coverage.xml |
| 72 | + flags: unittests |
| 73 | + name: codecov-umbrella |
| 74 | + fail_ci_if_error: false |
| 75 | + |
| 76 | + build: |
| 77 | + name: Build & Verify Package |
| 78 | + runs-on: ubuntu-latest |
| 79 | + needs: [quality, test] |
| 80 | + steps: |
| 81 | + - name: Checkout code |
| 82 | + uses: actions/checkout@v5 |
| 83 | + |
| 84 | + - name: Install uv |
| 85 | + uses: astral-sh/setup-uv@v3 |
| 86 | + with: |
| 87 | + version: "latest" |
| 88 | + |
| 89 | + - name: Set up Python |
| 90 | + run: uv python install 3.12 |
| 91 | + |
| 92 | + - name: Build package |
| 93 | + run: | |
| 94 | + echo "📦 Building Python package..." |
| 95 | + uv build |
| 96 | +
|
| 97 | + - name: Verify package installation |
| 98 | + run: | |
| 99 | + echo "✅ Verifying package can be installed..." |
| 100 | + uv pip install dist/*.whl --system |
| 101 | + python -c "import eoapi_notifier; print('Package installed successfully')" |
| 102 | +
|
| 103 | + - name: Upload build artifacts |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: python-package-distributions |
| 107 | + path: dist/ |
0 commit comments