|  | 
|  | 1 | +name: Test | 
|  | 2 | + | 
|  | 3 | +on: | 
|  | 4 | +  push: | 
|  | 5 | +    branches: | 
|  | 6 | +      - main | 
|  | 7 | +  pull_request: | 
|  | 8 | +    branches: | 
|  | 9 | +      - main | 
|  | 10 | +  schedule: | 
|  | 11 | +    - cron: "0 0 * * *" | 
|  | 12 | + | 
|  | 13 | +jobs: | 
|  | 14 | +  source: | 
|  | 15 | +    runs-on: ubuntu-latest | 
|  | 16 | +    strategy: | 
|  | 17 | +      matrix: | 
|  | 18 | +        python-version: ["3.9", "3.10", "3.11", "3.12"] | 
|  | 19 | +    steps: | 
|  | 20 | +      - uses: actions/checkout@v4 | 
|  | 21 | +      - uses: oven-sh/setup-bun@v2 | 
|  | 22 | +        with: | 
|  | 23 | +          bun-version: latest | 
|  | 24 | +      - name: Use Python ${{ matrix.python-version }} | 
|  | 25 | +        uses: actions/setup-python@v5 | 
|  | 26 | +        with: | 
|  | 27 | +          python-version: ${{ matrix.python-version }} | 
|  | 28 | +      - name: Install Python Dependencies | 
|  | 29 | +        run: | | 
|  | 30 | +          pip3 install hatch uv | 
|  | 31 | +      - name: Run Tests | 
|  | 32 | +        run: | | 
|  | 33 | +          hatch test --cover --python ${{ matrix.python-version }} | 
|  | 34 | +          mv .coverage ".coverage.py${{ matrix.python-version }}" | 
|  | 35 | +      - name: Upload coverage data | 
|  | 36 | +        uses: actions/upload-artifact@v4 | 
|  | 37 | +        with: | 
|  | 38 | +          name: "coverage-data-py${{ matrix.python-version }}" | 
|  | 39 | +          path: ".coverage.py${{ matrix.python-version }}" | 
|  | 40 | +          if-no-files-found: error | 
|  | 41 | +          include-hidden-files: true | 
|  | 42 | +          retention-days: 7 | 
|  | 43 | +  coverage: | 
|  | 44 | +    needs: | 
|  | 45 | +      - source | 
|  | 46 | +    runs-on: ubuntu-latest | 
|  | 47 | +    steps: | 
|  | 48 | +      - uses: actions/checkout@v4 | 
|  | 49 | +      - name: Use Latest Python | 
|  | 50 | +        uses: actions/setup-python@v5 | 
|  | 51 | +        with: | 
|  | 52 | +          python-version: "3.x" | 
|  | 53 | +      - name: Install Python Dependencies | 
|  | 54 | +        run: python -m pip install --upgrade coverage[toml] | 
|  | 55 | +      - name: Download data | 
|  | 56 | +        uses: actions/download-artifact@v4 | 
|  | 57 | +        with: | 
|  | 58 | +          merge-multiple: true | 
|  | 59 | +      - name: Combine coverage and fail if it's <100% | 
|  | 60 | +        run: | | 
|  | 61 | +          python -m coverage combine | 
|  | 62 | +          python -m coverage html --skip-covered --skip-empty | 
|  | 63 | +          python -m coverage report --fail-under=100 | 
|  | 64 | +      - name: Upload HTML report | 
|  | 65 | +        uses: actions/upload-artifact@v4 | 
|  | 66 | +        with: | 
|  | 67 | +          name: coverage-report | 
|  | 68 | +          path: htmlcov | 
0 commit comments