Merge pull request #24 from geekbot-com/chore/installation-instructions #74
This file contains hidden or 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
name: Python Tests | |
on: | |
push: | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' # You might want to adjust this or use a matrix strategy | |
- name: Verify Python version compatibility | |
run: | | |
PYTHON_REQUIREMENT=$(grep "requires-python" pyproject.toml | sed -E 's/.*requires-python = "(.*)".*$/\1/') | |
CURRENT_PYTHON_VERSION=$(python --version | cut -d ' ' -f 2) | |
echo "Checking if Python $CURRENT_PYTHON_VERSION satisfies requirement: $PYTHON_REQUIREMENT" | |
pip install packaging | |
python -c "from packaging.specifiers import SpecifierSet; import sys; requirement='$PYTHON_REQUIREMENT'; version='$CURRENT_PYTHON_VERSION'; exit(0 if SpecifierSet(requirement).contains(version) else 1)" | |
if [ $? -eq 0 ]; then | |
echo "✅ Python version $CURRENT_PYTHON_VERSION is compatible with requirement $PYTHON_REQUIREMENT" | |
else | |
echo "❌ Python version $CURRENT_PYTHON_VERSION is NOT compatible with requirement $PYTHON_REQUIREMENT" | |
exit 1 | |
fi | |
- name: Install uv | |
run: | | |
pip install uv | |
- name: Install dependencies | |
run: | | |
uv pip install --system .[dev] | |
uv pip install -r pyproject.toml --group dev --system | |
- name: Run Pytest | |
run: | | |
python -m pytest -vv |