Skip to content

test uv

test uv #53

name: Stress Tests
on:
push:
env:
OS: ubuntu-24.04
ARCH: x86_64
CIBW_SYSTEM: manylinux
PYTHON_VERSION: cp313
TESTSUITE: fast
ITERATIONS: 3
jobs:
build:
name: "Build wheel: cp313-manylinux_x86_64"
runs-on: ubuntu-24.04
steps:
- name: Checkout DuckDB Python
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- uses: astral-sh/setup-uv@v6
with:
version: "0.8.16"
enable-cache: false
cache-suffix: -${{ env.PYTHON_VERSION }}-${{ env.OS }}
python-version: ${{ env.PYTHON_VERSION }}
- name: Export test requirements
shell: bash
run: |
ls -l
ls -l external
uv export --only-group test --no-emit-project --output-file test-requirements.txt --quiet
- name: Configure Cache Env
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Build wheel
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ env.ARCH }}
CIBW_BUILD: ${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
CIBW_TEST_SKIP: '*'
# Platform-specific ccache installation commands
CIBW_BEFORE_TEST: >
sccache --show-stats &&
uv export --only-group test --no-emit-project --output-file pylock.toml --directory {project} --quiet &&
uv pip install -r pylock.toml
CIBW_TEST_COMMAND: sccache --show-stats
CIBW_BEFORE_BUILD_LINUX: >
if [ "$(uname -m)" = "aarch64" ]; then ARCH=aarch64; else ARCH=x86_64; fi &&
curl -L https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-${ARCH}-unknown-linux-musl.tar.gz | tar xz &&
cp sccache-v0.10.0-${ARCH}-unknown-linux-musl/sccache /usr/bin &&
sccache --show-stats
CIBW_BEFORE_BUILD_MACOS: brew install sccache
CIBW_BEFORE_BUILD_WINDOWS: >
del "C:\Strawberry\c\bin\ccache.exe" &&
choco install sccache
SCCACHE_GHA_ENABLED: "on"
SCCACHE_C_CUSTOM_CACHE_BUSTER: ${{ env.PYTHON_VERSION }}-${{ env.OS }}
ACTIONS_CACHE_SERVICE_V2: "1"
CIBW_ENVIRONMENT: CMAKE_C_COMPILER_LAUNCHER="" CMAKE_CXX_COMPILER_LAUNCHER="" CFLAGS="-Wno-attributes" CXXFLAGS="-Wno-attributes"
CIBW_ENVIRONMENT_PASS: SCCACHE_GHA_ENABLED ACTIONS_RUNTIME_TOKEN ACTIONS_RESULTS_URL ACTIONS_CACHE_SERVICE_V2 SCCACHE_C_CUSTOM_CACHE_BUSTER PYTHON_GIL
- name: Upload test requirements
uses: actions/upload-artifact@v4
with:
name: test-requirements-${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
path: test-requirements.txt
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
path: wheelhouse/
test:
name: 'Test: ${{ matrix.pytest_config.name }} - cp313-manylinux_x86_64'
runs-on: ubuntu-24.04
needs: build
strategy:
fail-fast: false
matrix:
pytest_config:
- name: "Random Order" # randomization is automatic due to pytest-randomly
args: ""
iterations: 3
- name: "Multiprocess" # uses pytest-xdist
args: "-n auto"
iterations: 3
- name: "Threaded" # uses pytest-run-parallel
# TODO: Update to use threading specific tests or explicitly mark unsafe tests. test_module was chosen as an example.
args: "--parallel-threads=4 --iterations=8 tests/fast/test_module.py --ignore"
iterations: 1
steps:
- uses: astral-sh/setup-uv@v6
with:
version: "0.8.16"
enable-cache: true
activate-environment: true
cache-suffix: -${{ env.PYTHON_VERSION }}-${{ env.OS }}
python-version: ${{ env.PYTHON_VERSION }}
- name: Checkout test files only
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: wheel-${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
path: wheelhouse/
- name: Download test requirements
uses: actions/download-artifact@v4
with:
name: test-requirements-${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
path: .
- name: Install dependencies
shell: bash
run: |
uv sync --no-install-project
uv pip install wheelhouse/*.whl
- name: Run ${{ matrix.pytest_config.name }} tests
shell: bash
run: |
TEST_TARGET="tests/fast"
ITERATIONS="${{ matrix.pytest_config.iterations }}"
PYTEST_ARGS="${{ matrix.pytest_config.args }}"
echo "Running ${{ matrix.pytest_config.name }} pytest $ITERATIONS times against: $TEST_TARGET"
for i in $(seq 1 $ITERATIONS); do
echo ""
echo "${{ matrix.pytest_config.name }} Run $i/$ITERATIONS:"
echo "--------"
pytest $PYTEST_ARGS "$TEST_TARGET" --durations=5
if [ $? -ne 0 ]; then
echo "${{ matrix.pytest_config.name }} Run $i failed!"
else
echo "${{ matrix.pytest_config.name }} Run $i passed!"
fi
done