Skip to content

fix: fsspec tests should not depend on specific files #391

fix: fsspec tests should not depend on specific files

fix: fsspec tests should not depend on specific files #391

Workflow file for this run

name: Build and Test
on:
push:
branches:
- main
tags:
- "*"
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
- run: |
ruff check
ruff format --check
rust_tests:
name: Rust tests - ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.runner }}
container: ${{ matrix.platform.container }}
strategy:
matrix:
platform:
- name: Linux x86_64
runner: ubuntu-latest
- name: Linux ARM64
runner: ubuntu-24.04-arm
- name: Windows x64
runner: windows-latest
- name: Windows ARM64
runner: windows-11-arm
- name: macOS x86_64
runner: macos-13
- name: macOS ARM64
runner: macos-14
steps:
- uses: actions/checkout@v4
- name: Cache Rust build
uses: actions/cache@v4
with:
path: |
target
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-test-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ runner.arch }}-
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.19"
enable-cache: true
cache-dependency-glob: "**/uv.lock"
# python-version: "3.12"
- name: Install required python dependencies
run: uv sync --no-install-project
shell: bash
- name: Run cargo tests
run: |
# pyo3 and uv do not work well together...
PY_LIBDIR=$(uv run --no-sync python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
echo "Python libdir: $PY_LIBDIR"
# setting LD_LIBRARY_PATH for Linux: https://github.com/astral-sh/uv/issues/11006#issuecomment-2672486381
export LD_LIBRARY_PATH="$PY_LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" # LINUX
if [[ "$RUNNER_OS" == "Windows" ]]; then
uv run --no-sync python -c "import sys; print(sys.path)"
uv run --no-sync where python
export PYTHONPATH="$(echo .venv/Lib/site-packages)"
else
# setting PYTHONHOME and PYTHONPATH seem to be the best solution for macOS at the moment
# https://github.com/PyO3/pyo3/issues/1741#issuecomment-955805634
export PYTHONHOME="$(uv run --no-sync python -c 'import sys; print(sys.base_prefix)')" # MACOS
export PYTHONPATH="$(echo .venv/lib/python*/site-packages)" # MACOS
fi
uv run --no-sync cargo test --no-default-features
shell: bash
build:
needs: rust_tests
name: Build Wheels - ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.runner }}
container: ${{ matrix.platform.container }}
strategy:
matrix:
platform:
- name: linux-x86_64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
before-script: python3 -m ensurepip && cat /etc/os-release && yum install clang -y
manylinux: "2_28"
is-musl: false
- name: linux-aarch64
runner: ubuntu-latest
target: aarch64-unknown-linux-gnu
skip_tests: true
before-script: |
apt-get update && \
apt-get install --assume-yes --no-install-recommends crossbuild-essential-arm64
manylinux: "2_28"
is-musl: false
- name: linux-musl-x86_64
runner: ubuntu-22.04
target: x86_64-unknown-linux-musl
container: docker://messense/rust-musl-cross:x86_64-musl
before-script: cat /etc/os-release && apt install clang -y
manylinux: musllinux_1_2
is-musl: true
- name: windows-x64
runner: windows-latest
target: x86_64-pc-windows-msvc
is-musl: false
- name: macos-x86_64
runner: macos-13
target: x86_64-apple-darwin
is-musl: false
- name: macos-arm64
runner: macos-14
target: aarch64-apple-darwin
is-musl: false
steps:
- uses: actions/checkout@v4
- name: Cache Rust build
uses: actions/cache@v4
with:
path: |
target
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-build-${{ matrix.platform.name }}-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.platform.name }}-
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
manylinux: ${{ matrix.platform.manylinux }}
container: ${{ matrix.platform.is-musl == true && 'off' || '' }}
before-script-linux: ${{ matrix.platform.before-script }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform.name }}
path: dist
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
test:
needs: build
name: Test - ${{ matrix.config.name }}
runs-on: ${{ matrix.config.runner }}
strategy:
fail-fast: false
matrix:
config:
# Platform tests with Python 3.12
- name: Linux x86_64
runner: ubuntu-latest
platform-name: linux-x86_64
is-musl: false
python-version: "3.12"
is-min-deps: false
- name: Linux musl
runner: ubuntu-22.04
platform-name: linux-musl-x86_64
is-musl: true
python-version: "3.12"
is-min-deps: false
- name: Linux ARM64
runner: ubuntu-24.04-arm
platform-name: linux-aarch64
is-musl: false
python-version: "3.12"
is-min-deps: false
- name: Windows
runner: windows-latest
platform-name: windows-x64
is-musl: false
python-version: "3.12"
is-min-deps: false
- name: macOS x86_64
runner: macos-13
platform-name: macos-x86_64
is-musl: false
python-version: "3.12"
is-min-deps: false
- name: macOS ARM64
runner: macos-14
platform-name: macos-arm64
is-musl: false
python-version: "3.12"
is-min-deps: false
# Additional Python versions for Linux x86_64
- name: Python 3.9
runner: ubuntu-latest
platform-name: linux-x86_64
is-musl: false
python-version: "3.9"
is-min-deps: false
- name: Python 3.10
runner: ubuntu-latest
platform-name: linux-x86_64
is-musl: false
python-version: "3.10"
is-min-deps: false
- name: Python 3.11
runner: ubuntu-latest
platform-name: linux-x86_64
is-musl: false
python-version: "3.11"
is-min-deps: false
- name: Python 3.13
runner: ubuntu-latest
platform-name: linux-x86_64
is-musl: false
python-version: "3.13"
is-min-deps: false
- name: Python 3.14 Pre Release
runner: ubuntu-latest
platform-name: linux-x86_64
is-musl: false
python-version: "3.14"
is-min-deps: false
# Minimum dependencies test
- name: Min Dependencies
runner: ubuntu-latest
platform-name: linux-x86_64
is-musl: false
python-version: "3.9"
is-min-deps: true
steps:
# Use the test composite action
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.19"
enable-cache: ${{ matrix.config.is-musl && 'false' || 'true' }}
cache-dependency-glob: "**/uv.lock"
python-version: ${{ matrix.config.python-version }}
- name: Download wheels
uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.config.platform-name }}
path: dist
# Regular tests (non-musl platforms)
- name: Run regular tests
if: ${{ !matrix.config.is-min-deps && !matrix.config.is-musl }}
shell: bash
run: |
WHEEL_PATH=$(ls dist/*.whl)
uv venv
uv sync --no-install-project --no-default-groups --group=test
uv pip install --force-reinstall "$WHEEL_PATH"
uv run --no-sync pytest tests/
# Musl tests
- name: Run musl tests
if: ${{ !matrix.config.is-min-deps && matrix.config.is-musl }}
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/astral-sh/uv:0.8.19-alpine
options: -v ${{ github.workspace }}:/io -w /io
run: |
apk add python3 py3-pip py3-psutil gcc python3-dev musl-dev linux-headers
WHEEL_PATH=$(ls dist/*.whl)
uv venv
uv sync --no-install-project --no-default-groups --group=test
uv pip install --force-reinstall "$WHEEL_PATH"
uv run --no-sync pytest tests/
# Minimum dependencies test
- name: Run tests with minimum dependencies
if: ${{ matrix.config.is-min-deps }}
shell: bash
run: |
WHEEL_PATH=$(ls dist/*.whl)
uv venv
uv sync --resolution lowest-direct --no-install-project --no-default-groups --group=test
uv pip install --no-deps --force-reinstall "$WHEEL_PATH"
uv run --no-sync --no-default-groups --group=test pytest tests/