| name: Setup UV and Python | |||||
| inputs: | |||||
| python-version: | |||||
| description: Python version to use and the UV installed with | |||||
| required: true | |||||
| default: '3.12' | |||||
| uv-version: | |||||
| description: UV version to set up | |||||
| required: true | |||||
| default: '0.8.9' | |||||
| uv-lockfile: | |||||
| description: Path to the UV lockfile to restore cache from | |||||
| required: true | |||||
| default: '' | |||||
| enable-cache: | |||||
| required: true | |||||
| default: true | |||||
| runs: | |||||
| using: composite | |||||
| steps: | |||||
| - name: Set up Python ${{ inputs.python-version }} | |||||
| uses: actions/setup-python@v5 | |||||
| with: | |||||
| python-version: ${{ inputs.python-version }} | |||||
| - name: Install uv | |||||
| uses: astral-sh/setup-uv@v6 | |||||
| with: | |||||
| version: ${{ inputs.uv-version }} | |||||
| python-version: ${{ inputs.python-version }} | |||||
| enable-cache: ${{ inputs.enable-cache }} | |||||
| cache-dependency-glob: ${{ inputs.uv-lockfile }} |
| persist-credentials: false | persist-credentials: false | ||||
| - name: Setup UV and Python | - name: Setup UV and Python | ||||
| uses: ./.github/actions/setup-uv | |||||
| uses: astral-sh/setup-uv@v6 | |||||
| with: | with: | ||||
| enable-cache: true | |||||
| python-version: ${{ matrix.python-version }} | python-version: ${{ matrix.python-version }} | ||||
| uv-lockfile: api/uv.lock | |||||
| cache-dependency-glob: api/uv.lock | |||||
| - name: Check UV lockfile | - name: Check UV lockfile | ||||
| run: uv lock --project api --check | run: uv lock --project api --check |
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||
| # Use uv to ensure we have the same ruff version in CI and locally. | # Use uv to ensure we have the same ruff version in CI and locally. | ||||
| - uses: astral-sh/setup-uv@7edac99f961f18b581bbd960d59d049f04c0002f | |||||
| - uses: astral-sh/setup-uv@v6 | |||||
| with: | |||||
| python-version: "3.12" | |||||
| - run: | | - run: | | ||||
| cd api | cd api | ||||
| uv sync --dev | uv sync --dev |
| persist-credentials: false | persist-credentials: false | ||||
| - name: Setup UV and Python | - name: Setup UV and Python | ||||
| uses: ./.github/actions/setup-uv | |||||
| uses: astral-sh/setup-uv@v6 | |||||
| with: | with: | ||||
| uv-lockfile: api/uv.lock | |||||
| enable-cache: true | |||||
| python-version: "3.12" | |||||
| cache-dependency-glob: api/uv.lock | |||||
| - name: Install dependencies | - name: Install dependencies | ||||
| run: uv sync --project api | run: uv sync --project api |
| - name: Setup UV and Python | - name: Setup UV and Python | ||||
| if: steps.changed-files.outputs.any_changed == 'true' | if: steps.changed-files.outputs.any_changed == 'true' | ||||
| uses: ./.github/actions/setup-uv | |||||
| uses: astral-sh/setup-uv@v6 | |||||
| with: | with: | ||||
| uv-lockfile: api/uv.lock | |||||
| enable-cache: false | enable-cache: false | ||||
| python-version: "3.12" | |||||
| cache-dependency-glob: api/uv.lock | |||||
| - name: Install dependencies | - name: Install dependencies | ||||
| if: steps.changed-files.outputs.any_changed == 'true' | if: steps.changed-files.outputs.any_changed == 'true' |
| remove_tool_cache: true | remove_tool_cache: true | ||||
| - name: Setup UV and Python | - name: Setup UV and Python | ||||
| uses: ./.github/actions/setup-uv | |||||
| uses: astral-sh/setup-uv@v6 | |||||
| with: | with: | ||||
| enable-cache: true | |||||
| python-version: ${{ matrix.python-version }} | python-version: ${{ matrix.python-version }} | ||||
| uv-lockfile: api/uv.lock | |||||
| cache-dependency-glob: api/uv.lock | |||||
| - name: Check UV lockfile | - name: Check UV lockfile | ||||
| run: uv lock --project api --check | run: uv lock --project api --check |