|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ci-${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + name: Lint (ruff) |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Set up uv |
| 21 | + uses: astral-sh/setup-uv@v5 |
| 22 | + with: |
| 23 | + enable-cache: true |
| 24 | + |
| 25 | + - name: Set up Python |
| 26 | + run: uv python install 3.12 |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: uv sync --frozen |
| 30 | + |
| 31 | + - name: ruff check |
| 32 | + run: uv run ruff check datamasque tests |
| 33 | + |
| 34 | + - name: ruff format --check |
| 35 | + run: uv run ruff format --check datamasque tests |
| 36 | + |
| 37 | + typecheck: |
| 38 | + name: Typecheck (mypy) |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Set up uv |
| 44 | + uses: astral-sh/setup-uv@v5 |
| 45 | + with: |
| 46 | + enable-cache: true |
| 47 | + |
| 48 | + - name: Set up Python |
| 49 | + run: uv python install 3.12 |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + run: uv sync --frozen |
| 53 | + |
| 54 | + - name: mypy |
| 55 | + run: uv run mypy datamasque |
| 56 | + |
| 57 | + test: |
| 58 | + name: Tests (py${{ matrix.python-version }}) |
| 59 | + runs-on: ubuntu-latest |
| 60 | + strategy: |
| 61 | + fail-fast: false |
| 62 | + matrix: |
| 63 | + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v4 |
| 66 | + |
| 67 | + - name: Set up uv |
| 68 | + uses: astral-sh/setup-uv@v5 |
| 69 | + with: |
| 70 | + enable-cache: true |
| 71 | + |
| 72 | + - name: Set up Python ${{ matrix.python-version }} |
| 73 | + run: uv python install ${{ matrix.python-version }} |
| 74 | + |
| 75 | + - name: Install dependencies |
| 76 | + run: uv sync --frozen --python ${{ matrix.python-version }} |
| 77 | + |
| 78 | + - name: pytest |
| 79 | + run: >- |
| 80 | + uv run --python ${{ matrix.python-version }} |
| 81 | + pytest tests/ |
| 82 | + --junitxml=report.xml |
| 83 | + --cov=datamasque |
| 84 | + --cov-report=term |
| 85 | + --cov-report=xml:coverage.xml |
| 86 | + --import-mode=importlib |
| 87 | +
|
| 88 | + - name: Upload test results |
| 89 | + if: always() |
| 90 | + uses: actions/upload-artifact@v4 |
| 91 | + with: |
| 92 | + name: test-results-py${{ matrix.python-version }} |
| 93 | + path: | |
| 94 | + report.xml |
| 95 | + coverage.xml |
| 96 | + retention-days: 7 |
| 97 | + |
| 98 | + docs: |
| 99 | + name: Docs (sphinx) |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - uses: actions/checkout@v4 |
| 103 | + |
| 104 | + - name: Set up uv |
| 105 | + uses: astral-sh/setup-uv@v5 |
| 106 | + with: |
| 107 | + enable-cache: true |
| 108 | + |
| 109 | + - name: Set up Python |
| 110 | + run: uv python install 3.12 |
| 111 | + |
| 112 | + - name: Install dependencies |
| 113 | + run: uv sync --frozen |
| 114 | + |
| 115 | + - name: sphinx-build |
| 116 | + run: uv run sphinx-build -b html -W --keep-going docs docs/_build/html |
| 117 | + |
| 118 | + - name: Upload built docs |
| 119 | + if: always() |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: docs-html |
| 123 | + path: docs/_build/html |
| 124 | + retention-days: 7 |
0 commit comments