Migrate Python projects from poetry to uv #530
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: Set up Python environment | |
shell: bash | |
run: | | |
python -m venv .venv | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. .venv/Scripts/activate | |
else | |
. .venv/bin/activate | |
fi | |
python -m pip install --upgrade pip | |
pip install uv | |
- name: selfie-lib - install dependencies | |
shell: bash | |
working-directory: python/selfie-lib | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
uv pip install -e . -r requirements.txt -r dev-requirements.txt | |
- name: selfie-lib - pytest | |
shell: bash | |
working-directory: python/selfie-lib | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
python -m pytest -vv | |
- name: selfie-lib - pyright | |
shell: bash | |
working-directory: python/selfie-lib | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
python -m pyright | |
- name: selfie-lib - ruff | |
shell: bash | |
working-directory: python/selfie-lib | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
python -m ruff format --check && python -m ruff check | |
- name: pytest-selfie - install dependencies | |
shell: bash | |
working-directory: python/pytest-selfie | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
uv pip install -e . -r requirements.txt -r dev-requirements.txt | |
- name: pytest-selfie - pyright | |
shell: bash | |
working-directory: python/pytest-selfie | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
python -m pyright | |
- name: pytest-selfie - ruff | |
shell: bash | |
working-directory: python/pytest-selfie | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
python -m ruff format --check && python -m ruff check | |
- name: example-pytest-selfie - install dependencies | |
shell: bash | |
working-directory: python/example-pytest-selfie | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
uv pip install -e . -r requirements.txt -r dev-requirements.txt | |
- name: example-pytest-selfie - pytest | |
shell: bash | |
working-directory: python/example-pytest-selfie | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
python -m pytest -vv | |
- name: example-pytest-selfie - pyright | |
shell: bash | |
working-directory: python/example-pytest-selfie | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
python -m pyright | |
- name: example-pytest-selfie - ruff | |
shell: bash | |
working-directory: python/example-pytest-selfie | |
run: | | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
. ../../.venv/Scripts/activate | |
else | |
. ../../.venv/bin/activate | |
fi | |
python -m ruff format --check && python -m ruff check |