Migrate Python projects from poetry to uv #518
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
paths: | ||
- "python/**" | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
os: [ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install uv (Unix) | ||
if: runner.os != 'Windows' | ||
shell: bash | ||
run: | | ||
curl -LsSf https://astral.sh/uv/install.sh | sh | ||
echo "${HOME}/.local/bin" >> $GITHUB_PATH | ||
- name: Install uv (Windows) | ||
if: runner.os == 'Windows' | ||
shell: pwsh | ||
run: | | ||
python -m pip install uv | ||
$pythonPath = (Get-Command python).Path | ||
$scriptsPath = Join-Path (Split-Path $pythonPath) "Scripts" | ||
echo $scriptsPath | Out-File -FilePath $env:GITHUB_PATH -Append | ||
- name: selfie-lib - install dependencies | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
Check failure on line 40 in .github/workflows/python-ci.yml GitHub Actions / .github/workflows/python-ci.ymlInvalid workflow file
|
||
run: | | ||
uv venv | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
uv pip install -r requirements.txt -r dev-requirements.txt | ||
working-directory: python/selfie-lib | ||
- name: selfie-lib - pytest | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
python -m pytest -vv | ||
working-directory: python/selfie-lib | ||
- name: selfie-lib - pyright | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
python -m pyright | ||
working-directory: python/selfie-lib | ||
- name: selfie-lib - ruff | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
python -m ruff format --check && python -m ruff check | ||
working-directory: python/selfie-lib | ||
- name: pytest-selfie - install dependencies | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
uv venv | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
uv pip install -r requirements.txt -r dev-requirements.txt | ||
working-directory: python/pytest-selfie | ||
- name: pytest-selfie - pyright | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
python -m pyright | ||
working-directory: python/pytest-selfie | ||
- name: pytest-selfie - ruff | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
python -m ruff format --check && python -m ruff check | ||
working-directory: python/pytest-selfie | ||
- name: example-pytest-selfie - install dependencies | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
uv venv | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
uv pip install -r requirements.txt -r dev-requirements.txt | ||
working-directory: python/example-pytest-selfie | ||
- name: example-pytest-selfie - pytest | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
python -m pytest -vv | ||
working-directory: python/example-pytest-selfie | ||
- name: example-pytest-selfie - pyright | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
python -m pyright | ||
working-directory: python/example-pytest-selfie | ||
- name: example-pytest-selfie - ruff | ||
shell: ${{ runner.os == 'Windows' && 'C:\\Program Files\\Git\\bin\\bash.exe -e' || 'bash' }} | ||
run: | | ||
source .venv/bin/activate || . .venv/Scripts/activate | ||
python -m ruff format --check && python -m ruff check | ||
working-directory: python/example-pytest-selfie |