|
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +defaults: |
| 10 | + run: |
| 11 | + shell: bash |
| 12 | + |
| 13 | +env: |
| 14 | + LANG: en_US.utf-8 |
| 15 | + LC_ALL: en_US.utf-8 |
| 16 | + PYTHONIOENCODING: UTF-8 |
| 17 | + PYTHON_VERSIONS: "" |
| 18 | + |
| 19 | +jobs: |
| 20 | + |
| 21 | + quality: |
| 22 | + |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Fetch all tags |
| 30 | + run: git fetch --depth=1 --tags |
| 31 | + |
| 32 | + - name: Set up Python |
| 33 | + uses: actions/setup-python@v5 |
| 34 | + with: |
| 35 | + python-version: "3.11" |
| 36 | + |
| 37 | + - name: Install uv |
| 38 | + run: pip install uv |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: make setup |
| 42 | + |
| 43 | + - name: Check if the documentation builds correctly |
| 44 | + run: make check-docs |
| 45 | + |
| 46 | + - name: Check the code quality |
| 47 | + run: make check-quality |
| 48 | + |
| 49 | + - name: Check if the code is correctly typed |
| 50 | + run: make check-types |
| 51 | + |
| 52 | + - name: Check for breaking changes in the API |
| 53 | + run: make check-api |
| 54 | + |
| 55 | + exclude-test-jobs: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + outputs: |
| 58 | + jobs: ${{ steps.exclude-jobs.outputs.jobs }} |
| 59 | + steps: |
| 60 | + - id: exclude-jobs |
| 61 | + run: | |
| 62 | + if ${{ github.repository_owner == 'pawamoy-insiders' }}; then |
| 63 | + echo 'jobs=[ |
| 64 | + {"os": "macos-latest"}, |
| 65 | + {"os": "windows-latest"}, |
| 66 | + {"python-version": "3.9"}, |
| 67 | + {"python-version": "3.10"}, |
| 68 | + {"python-version": "3.11"}, |
| 69 | + {"python-version": "3.12"}, |
| 70 | + {"python-version": "3.13"} |
| 71 | + ]' | tr -d '[:space:]' >> $GITHUB_OUTPUT |
| 72 | + else |
| 73 | + echo 'jobs=[ |
| 74 | + {"os": "macos-latest", "resolution": "lowest-direct"}, |
| 75 | + {"os": "windows-latest", "resolution": "lowest-direct"} |
| 76 | + ]' | tr -d '[:space:]' >> $GITHUB_OUTPUT |
| 77 | + fi |
| 78 | +
|
| 79 | + tests: |
| 80 | + |
| 81 | + needs: exclude-test-jobs |
| 82 | + strategy: |
| 83 | + matrix: |
| 84 | + os: |
| 85 | + - ubuntu-latest |
| 86 | + - macos-latest |
| 87 | + - windows-latest |
| 88 | + python-version: |
| 89 | + - "3.8" |
| 90 | + - "3.9" |
| 91 | + - "3.10" |
| 92 | + - "3.11" |
| 93 | + - "3.12" |
| 94 | + - "3.13" |
| 95 | + resolution: |
| 96 | + - highest |
| 97 | + - lowest-direct |
| 98 | + exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }} |
| 99 | + runs-on: ${{ matrix.os }} |
| 100 | + continue-on-error: ${{ matrix.python-version == '3.13' }} |
| 101 | + |
| 102 | + steps: |
| 103 | + - name: Checkout |
| 104 | + uses: actions/checkout@v4 |
| 105 | + |
| 106 | + - name: Set up Python |
| 107 | + uses: actions/setup-python@v5 |
| 108 | + with: |
| 109 | + python-version: ${{ matrix.python-version }} |
| 110 | + allow-prereleases: true |
| 111 | + |
| 112 | + - name: Install uv |
| 113 | + run: pip install uv |
| 114 | + |
| 115 | + - name: Install dependencies |
| 116 | + env: |
| 117 | + UV_RESOLUTION: ${{ matrix.resolution }} |
| 118 | + run: make setup |
| 119 | + |
| 120 | + - name: Run the test suite |
| 121 | + run: make test |
0 commit comments