|
| 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 vulnerabilities in dependencies |
| 53 | + run: make check-dependencies |
| 54 | + |
| 55 | + - name: Check for breaking changes in the API |
| 56 | + run: make check-api |
| 57 | + |
| 58 | + exclude-test-jobs: |
| 59 | + runs-on: ubuntu-latest |
| 60 | + outputs: |
| 61 | + jobs: ${{ steps.exclude-jobs.outputs.jobs }} |
| 62 | + steps: |
| 63 | + - id: exclude-jobs |
| 64 | + run: | |
| 65 | + if ${{ github.repository_owner == 'pawamoy-insiders' }}; then |
| 66 | + echo 'jobs=[ |
| 67 | + {"os": "macos-latest"}, |
| 68 | + {"os": "windows-latest"}, |
| 69 | + {"python-version": "3.9"}, |
| 70 | + {"python-version": "3.10"}, |
| 71 | + {"python-version": "3.11"}, |
| 72 | + {"python-version": "3.12"} |
| 73 | + ]' | tr -d '[:space:]' >> $GITHUB_OUTPUT |
| 74 | + else |
| 75 | + echo 'jobs=[]' >> $GITHUB_OUTPUT |
| 76 | + fi |
| 77 | +
|
| 78 | + tests: |
| 79 | + |
| 80 | + needs: exclude-test-jobs |
| 81 | + strategy: |
| 82 | + matrix: |
| 83 | + os: |
| 84 | + - ubuntu-latest |
| 85 | + - macos-latest |
| 86 | + - windows-latest |
| 87 | + python-version: |
| 88 | + - "3.8" |
| 89 | + - "3.9" |
| 90 | + - "3.10" |
| 91 | + - "3.11" |
| 92 | + - "3.12" |
| 93 | + exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }} |
| 94 | + runs-on: ${{ matrix.os }} |
| 95 | + continue-on-error: ${{ matrix.python-version == '3.12' }} |
| 96 | + |
| 97 | + steps: |
| 98 | + - name: Checkout |
| 99 | + uses: actions/checkout@v4 |
| 100 | + |
| 101 | + - name: Set up Python |
| 102 | + uses: actions/setup-python@v5 |
| 103 | + with: |
| 104 | + python-version: ${{ matrix.python-version }} |
| 105 | + allow-prereleases: true |
| 106 | + |
| 107 | + - name: Install uv |
| 108 | + run: pip install uv |
| 109 | + |
| 110 | + - name: Install dependencies |
| 111 | + run: make setup |
| 112 | + |
| 113 | + - name: Run the test suite |
| 114 | + run: make test |
0 commit comments