|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master] |
| 6 | + pull_request: |
| 7 | + branches: [main, master] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + lint: |
| 12 | + name: Lint and Format Check |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up Python |
| 19 | + uses: actions/setup-python@v5 |
| 20 | + with: |
| 21 | + python-version: "3.11" |
| 22 | + |
| 23 | + - name: Install UV |
| 24 | + uses: astral-sh/setup-uv@v3 |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + uv pip install --system ruff |
| 29 | +
|
| 30 | + - name: Run ruff format check |
| 31 | + run: ruff format --check . |
| 32 | + |
| 33 | + - name: Run ruff linting |
| 34 | + run: ruff check . |
| 35 | + |
| 36 | + test: |
| 37 | + name: Test |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - name: Checkout code |
| 41 | + uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Set up Python 3.11 |
| 44 | + uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: "3.11" |
| 47 | + |
| 48 | + - name: Install UV |
| 49 | + uses: astral-sh/setup-uv@v3 |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + run: | |
| 53 | + uv pip install --system -e ".[dev]" |
| 54 | +
|
| 55 | + - name: Run tests |
| 56 | + run: | |
| 57 | + pytest |
| 58 | +
|
| 59 | + test-package-install: |
| 60 | + name: Test Package Installation |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - name: Checkout code |
| 64 | + uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: Set up Python |
| 67 | + uses: actions/setup-python@v5 |
| 68 | + with: |
| 69 | + python-version: "3.11" |
| 70 | + |
| 71 | + - name: Install UV |
| 72 | + uses: astral-sh/setup-uv@v3 |
| 73 | + |
| 74 | + - name: Install package |
| 75 | + run: | |
| 76 | + uv pip install --system -e . |
| 77 | +
|
| 78 | + - name: Test CLI availability |
| 79 | + run: | |
| 80 | + which gen-stac || echo "CLI not found in PATH, checking if it's installed..." |
| 81 | + python -c "from overture_stac import OvertureRelease, RegistryManifest; print('Package imports successfully')" |
| 82 | +
|
| 83 | + - name: Test imports |
| 84 | + run: | |
| 85 | + python -c "from overture_stac.overture_stac import OvertureRelease; print('OvertureRelease imported')" |
| 86 | + python -c "from overture_stac.registry_manifest import RegistryManifest; print('RegistryManifest imported')" |
| 87 | +
|
| 88 | + all-checks-pass: |
| 89 | + name: All Checks Pass |
| 90 | + needs: [lint, test, test-package-install] |
| 91 | + runs-on: ubuntu-latest |
| 92 | + if: always() |
| 93 | + steps: |
| 94 | + - name: Check if all jobs passed |
| 95 | + run: | |
| 96 | + if [ "${{ needs.lint.result }}" != "success" ] || \ |
| 97 | + [ "${{ needs.test.result }}" != "success" ] || \ |
| 98 | + [ "${{ needs.test-package-install.result }}" != "success" ]; then |
| 99 | + echo "One or more checks failed" |
| 100 | + exit 1 |
| 101 | + fi |
| 102 | + echo "All checks passed!" |
0 commit comments