Skip to content

Commit

Permalink
Start using uv (#16203)
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCallahan committed Sep 5, 2024
1 parent 622f090 commit 57e34a2
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 16 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
env:
UV_CACHE_DIR: /tmp/.uv-cache
UV_SYSTEM_PYTHON: 1
steps:
- name: Checkout Robottelo
uses: actions/checkout@v4
Expand All @@ -26,22 +29,34 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install Dependencies
run: |
sudo apt update
sudo apt-get install -y libgnutls28-dev libcurl4-openssl-dev libssl-dev
wget https://raw.githubusercontent.com/SatelliteQE/broker/master/broker_settings.yaml.example
# link vs compile time ssl implementations can break the environment when installing requirements
# Uninstall pycurl - its likely not installed, but in case the ubuntu-latest packages change
# Then compile and install it with PYCURL_SSL_LIBRARY set to openssl
pip install -U pip wheel
pip uninstall -y pycurl
pip install --compile --no-cache-dir pycurl
pip install -U --no-cache-dir -r requirements.txt -r requirements-optional.txt
uv pip uninstall pycurl
uv pip install --compile --no-cache-dir pycurl
uv pip install -r requirements.txt -r requirements-optional.txt
for conffile in conf/*.yaml.template; do mv -- "$conffile" "${conffile%.yaml.template}.yaml"; done
cp broker_settings.yaml.example broker_settings.yaml
cp .env.example .env
- name: Minimize uv cache
run: uv cache prune --ci

- name: Collect Tests
run: |
# To skip vault login in pull request checks
Expand Down
29 changes: 22 additions & 7 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
strategy:
matrix:
python-version: [3.12]
env:
UV_CACHE_DIR: /tmp/.uv-cache
UV_SYSTEM_PYTHON: 1
steps:
- name: Checkout Robottelo
uses: actions/checkout@v4
Expand All @@ -24,22 +27,34 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install Dependencies
run: |
sudo apt-get update -y
sudo apt update
sudo apt-get install -y libgnutls28-dev libcurl4-openssl-dev libssl-dev
wget https://raw.githubusercontent.com/SatelliteQE/broker/master/broker_settings.yaml.example
# link vs compile time ssl implementations can break the environment when installing requirements
# Uninstall pycurl - its likely not installed, but in case the ubuntu-latest packages change
# Then compile and install it with PYCURL_SSL_LIBRARY set to openssl
pip install -U pip
pip uninstall -y pycurl
pip install --compile --no-cache-dir pycurl
pip install -U -r requirements.txt -r requirements-optional.txt
uv pip uninstall pycurl
uv pip install --compile --no-cache-dir pycurl
uv pip install -r requirements.txt -r requirements-optional.txt
for conffile in conf/*.yaml.template; do mv -- "$conffile" "${conffile%.yaml.template}.yaml"; done
cp broker_settings.yaml.example broker_settings.yaml
cp .env.example .env
- name: Minimize uv cache
run: uv cache prune --ci

- name: Customer scenario check
run: |
touch .env.md
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM fedora:38
MAINTAINER https://github.com/SatelliteQE

COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

RUN dnf install -y gcc git make cmake libffi-devel openssl-devel python3-devel \
python3-pip redhat-rpm-config which libcurl-devel libxml2-devel
redhat-rpm-config which libcurl-devel libxml2-devel

COPY / /robottelo/
WORKDIR /robottelo

ENV PYCURL_SSL_LIBRARY=openssl
RUN pip install -r requirements.txt
ENV UV_SYSTEM_PYTHON=1
RUN uv pip install -r requirements.txt

CMD make test-robottelo
9 changes: 9 additions & 0 deletions scripts/config_helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "click",
# "deepdiff",
# "logzero",
# "pyyaml",
# ]
# ///
"""A series of commands to help with robottelo configuration"""

from pathlib import Path
Expand Down
8 changes: 8 additions & 0 deletions scripts/customer_scenarios.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/usr/bin/env python
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "click",
# "requests",
# "testimony",
# ]
# ///
from functools import cache

import click
Expand Down
7 changes: 7 additions & 0 deletions scripts/fixture_cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "click",
# "pytest",
# ]
# ///
from pathlib import Path

import click
Expand Down
7 changes: 6 additions & 1 deletion scripts/tokenize_customer_scenario.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "codemod",
# ]
# ///
"""
This script adds ':customerscenario: true' to all tests by uuid
depends on `pip install https://github.com/facebook/codemod/tarball/master`
On command line should be like:
Expand Down
6 changes: 6 additions & 0 deletions scripts/validate_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "dynaconf",
# ]
# ///
"""Usage: python scripts/validate_config.py"""

from dynaconf.validator import ValidationError
Expand Down

0 comments on commit 57e34a2

Please sign in to comment.