Skip to content

chore: rename let to xorq (#1450) #53

chore: rename let to xorq (#1450)

chore: rename let to xorq (#1450) #53

name: ci-test-install
on:
push:
# Skip the backend suite if all changes are docs
paths-ignore:
- "docs/**"
- "**/*.md"
- "**/*.qmd"
- "*.md"
- "codecov.yml"
- ".envrc"
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test-installation:
name: Test installation on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
- os: ubuntu-latest
python-version: "3.11"
- os: ubuntu-latest
python-version: "3.12"
- os: ubuntu-latest
python-version: "3.13"
- os: windows-latest
python-version: "3.13"
- os: macos-latest
python-version: "3.13"
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Get package extras
id: get-extras
shell: bash
run: |
python -c "
import configparser
import json
import os
try:
config = configparser.ConfigParser()
config.read('setup.cfg')
extras = list(config['options.extras_require'].keys())
except:
try:
import tomllib
with open('pyproject.toml', 'rb') as f:
data = tomllib.load(f)
extras = list(data.get('project', {}).get('optional-dependencies', {}).keys())
except:
extras = []
extras_json = json.dumps(extras)
print(f'extras={extras_json}')
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
f.write(f'extras={extras_json}\n')
"
- name: Build package
run: uv build
- name: Get wheel filename
id: wheel-name
shell: bash
run: |
wheel_file=$(ls dist/*.whl | head -1)
echo "wheel_file=$wheel_file" >> $GITHUB_OUTPUT
echo "Found wheel: $wheel_file"
- name: Test installation from wheel and source distribution
shell: bash
run: |
# Test wheel installation
python -m venv .venv-wheel
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv-wheel/Scripts/activate
else
source .venv-wheel/bin/activate
fi
python -m pip install --upgrade pip
python -m pip install dist/*.whl
# Test basic import and version in separate directory
mkdir -p test-wheel && cd test-wheel
python -c "import pathlib; print(f'Current working directory: {pathlib.Path.cwd()}')"
python -c "import xorq; print(f'Successfully imported {xorq.__name__} version {xorq.__version__}')"
cd ..
deactivate
# Test source distribution installation
python -m venv .venv-sdist
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv-sdist/Scripts/activate
else
source .venv-sdist/bin/activate
fi
python -m pip install --upgrade pip
python -m pip install dist/*.tar.gz
python -c "import xorq; print(f'Successfully installed xorq {xorq.__version__} from source distribution')"
deactivate
- name: Test extras installation from wheel
shell: bash
run: |
extras='${{ steps.get-extras.outputs.extras }}'
wheel_file='${{ steps.wheel-name.outputs.wheel_file }}'
echo "Testing extras: $extras"
echo "Using wheel: $wheel_file"
# Test each extra from the wheel file
python -c "
import json
import subprocess
import sys
import os
extras = json.loads('$extras')
wheel_file = '$wheel_file'
if not extras:
print('No extras found to test')
sys.exit(0)
for extra in extras:
print(f'Testing extra: {extra}')
try:
# Create fresh venv for each extra
venv_name = f'.venv-extra-{extra}'
subprocess.run([sys.executable, '-m', 'venv', venv_name], check=True)
# Determine activation script path
if os.name == 'nt': # Windows
pip_path = os.path.join(venv_name, 'Scripts', 'pip')
python_path = os.path.join(venv_name, 'Scripts', 'python')
else: # Unix-like
pip_path = os.path.join(venv_name, 'bin', 'pip')
python_path = os.path.join(venv_name, 'bin', 'python')
# Install package with extra from wheel
subprocess.run([python_path, '-m', 'pip', 'install', '--upgrade', 'pip'], check=True)
subprocess.run([pip_path, 'install', f'{wheel_file}[{extra}]'], check=True)
# Test import
subprocess.run([python_path, '-c', 'import xorq'], check=True)
print(f'Successfully tested extra: {extra}')
except subprocess.CalledProcessError as e:
print(f'Failed to test extra {extra}: {e}')
sys.exit(1)
"