🔧(actions) migrate from pip to uv

Migrate usage of pip to uv in github actions. How python is setup is
also changed. Doing like this, we will just have to upgrade the python
version requirement in the pyproject file
This commit is contained in:
Quentin BEY
2026-01-29 23:21:41 +01:00
parent 8ace3099b9
commit b13f4db536

View File

@@ -220,19 +220,22 @@ jobs:
working-directory: src/backend working-directory: src/backend
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v6
- name: Install Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version-file: "src/backend/pyproject.toml"
- name: Install development dependencies - name: Install uv
run: pip install --user .[dev] uses: astral-sh/setup-uv@v6
- name: Install the project
run: uv sync --locked --all-extras
- name: Check code formatting with ruff - name: Check code formatting with ruff
run: ~/.local/bin/ruff format . --diff run: uv run ruff format . --diff
- name: Lint code with ruff - name: Lint code with ruff
run: ~/.local/bin/ruff check . run: uv run ruff check .
- name: Lint code with pylint - name: Lint code with pylint
run: ~/.local/bin/pylint . run: uv run pylint .
test-back: test-back:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -278,17 +281,23 @@ jobs:
path: "src/backend/core/templates/mail" path: "src/backend/core/templates/mail"
key: mail-templates-${{ hashFiles('src/mail/mjml') }} key: mail-templates-${{ hashFiles('src/mail/mjml') }}
fail-on-cache-miss: true fail-on-cache-miss: true
- name: Install Python
uses: actions/setup-python@v5 - name: Set up Python
uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version-file: "src/backend/pyproject.toml"
- name: Install development dependencies - name: Install uv
run: pip install --user .[dev] uses: astral-sh/setup-uv@v6
- name: Install the dependencies
run: uv sync --locked --all-extras
- name: Install gettext (required to compile messages) - name: Install gettext (required to compile messages)
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y gettext sudo apt-get install -y gettext
- name: Generate a MO file from strings extracted from the project - name: Generate a MO file from strings extracted from the project
run: python manage.py compilemessages run: uv run python manage.py compilemessages
- name: Run tests - name: Run tests
run: ~/.local/bin/pytest -n 2 run: uv run pytest -n 2