Skip to content

Add --line-endings #130

Add --line-endings

Add --line-endings #130

Workflow file for this run

name: Python package Lint+Test+Build
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, windows-latest ] # Ahh... Why macOS is so expensive for CI builds...
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
steps:
- uses: actions/checkout@v5
# Set up the environment for the extension build on macOS and Windows
# This OS doesn't compile the extension for `{many,musl}linux` distributions in containers
- name: Set up 'BUILD_RUST_IMPL' environment variable
if: runner.os == 'Linux'
shell: bash
run: echo "BUILD_RUST_IMPL=1" >> $GITHUB_ENV
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
version: "latest"
enable-cache: true
- name: Rust cache
uses: Swatinem/rust-cache@v2
- name: Prepare the project (Windows and macOS)
if: runner.os == 'Windows' || runner.os == 'macOS'
shell: bash
run: uv sync --all-extras
- name: Prepare the project (Linux py3.13)
if: runner.os == 'Linux' && matrix.python-version == '3.13'
env:
BUILD_RUST_IMPL: "1"
shell: bash
run: uv sync --all-extras
- name: Prepare the project (Linux !py3.13)
if: runner.os == 'Linux' && matrix.python-version != '3.13'
env:
BUILD_RUST_IMPL: "0"
shell: bash
run: uv sync --all-extras
- name: Minimize uv cache
shell: bash
run: uv cache prune --ci
- name: Lint
shell: bash
run: make lint
- name: Test
shell: bash
run: make test
- name: Build the package (Windows and macOS)
if: runner.os == 'Windows' || runner.os == 'macOS'
shell: bash
env:
BUILD_RUST_IMPL: "0"
run: uv build --wheel
- name: Build the package (Linux py3.13)
if: runner.os == 'Linux' && matrix.python-version == '3.13'
shell: bash
run: uv build --wheel
- name: Build the package (Linux !py3.13)
if: runner.os == 'Linux' && matrix.python-version != '3.13'
shell: bash
env:
BUILD_RUST_IMPL: "0"
run: uv build --wheel
- name: Verify wheel installation (Windows and macOS)
if: runner.os == 'Windows' || runner.os == 'macOS'
shell: bash
run: |
for wheel in dist/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- python -c "import ftl_extract; print(ftl_extract.__version__)"
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- ftl --version
done
- name: Verify wheel installation (Linux py3.13)
if: runner.os == 'Linux' && matrix.python-version == '3.13'
shell: bash
run: |
for wheel in dist/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- python -c "import ftl_extract; print(ftl_extract.__version__)"
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- ftl --version
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl-extract --version
done
- name: Verify wheel installation (Linux !py3.13)
if: runner.os == 'Linux' && matrix.python-version != '3.13'
shell: bash
run: |
for wheel in dist/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- python -c "import ftl_extract; print(ftl_extract.__version__)"
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- ftl --version
done
extension-build:
# Wait for the `ci` job to finish to save resources and money if `ci` can't compile the extension 🤷‍♂️
needs: ci
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
arch: x86_64
libc: manylinux
- os: ubuntu-latest
arch: x86_64
libc: musllinux
- os: ubuntu-24.04-arm
arch: aarch64
libc: manylinux
- os: ubuntu-24.04-arm
arch: aarch64
libc: musllinux
- os: windows-latest
arch: AMD64
# Ahh... Why macOS is so expensive for CI builds...
# - os: macos-14
# arch: arm64
steps:
- uses: actions/checkout@v5
# Set up the environment for the extension build on macOS and Windows
# This OS doesn't compile the extension for `{many,musl}linux` distributions in containers
- name: Set up 'BUILD_RUST_IMPL' environment variable
if: runner.os == 'Windows' || runner.os == 'macOS'
shell: bash
run: echo "BUILD_RUST_IMPL=1" >> $GITHUB_ENV
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.13"
version: "latest"
activate-environment: "true"
- name: Rust cache
uses: Swatinem/rust-cache@v2
- name: Prepare the project
shell: bash
run: uv sync --all-extras --verbose
- name: Build and fix wheels (Windows)
if: runner.os == 'Windows' && matrix.arch == 'AMD64'
shell: bash
env:
CIBW_BUILD: "cp313-win_amd64"
run: |
uv run cibuildwheel --config-file pyproject.toml --output-dir wheelhouse --platform windows
for wheel in wheelhouse/*.whl; do
uv run wheel tags --python-tag py3 --abi-tag none --remove $wheel
done
for wheel in wheelhouse/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- ftl --version
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl-extract --version
done
- name: Build, fix and test wheels (macOS arm64)
if: runner.os == 'macOS' && matrix.arch == 'arm64'
shell: bash
env:
CIBW_BUILD: "cp313-macosx_arm64"
run: |
uv run cibuildwheel --config-file pyproject.toml --output-dir wheelhouse --platform macos
for wheel in wheelhouse/*.whl; do
uv run wheel tags --python-tag py3 --abi-tag none --remove $wheel
done
for wheel in wheelhouse/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- ftl --version
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl-extract --version
done
- name: Build, fix and test wheels (Linux manylinux)
if: runner.os == 'Linux' && matrix.libc == 'manylinux'
shell: bash
run: |
export CIBW_MANYLINUX_$(echo ${{ matrix.arch }} | tr '[:lower:]' '[:upper:]')_IMAGE="quay.io/pypa/manylinux_2_28_${{ matrix.arch }}"
export CIBW_BUILD="cp313-manylinux_${{ matrix.arch }}"
uv run cibuildwheel --config-file pyproject.toml --archs ${{ matrix.arch }} --output-dir wheelhouse --platform linux
for wheel in wheelhouse/*.whl; do
uv run wheel tags --python-tag py3 --abi-tag none --remove $wheel
done
for wheel in wheelhouse/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl-extract --version
done
- name: Build, fix and test wheels (Linux musllinux)
if: runner.os == 'Linux' && matrix.libc == 'musllinux'
shell: bash
run: |
export CIBW_MUSLLINUX_$(echo ${{ matrix.arch }} | tr '[:lower:]' '[:upper:]')_IMAGE="quay.io/pypa/musllinux_1_2_${{ matrix.arch }}"
export CIBW_BUILD="cp313-musllinux_${{ matrix.arch }}"
uv run cibuildwheel --config-file pyproject.toml --archs ${{ matrix.arch }} --output-dir wheelhouse --platform linux
for wheel in wheelhouse/*.whl; do
uv run wheel tags --python-tag py3 --abi-tag none --remove $wheel
done
for wheel in wheelhouse/*.whl; do
uv run --verbose --with $wheel --no-project --refresh-package ftl_extract -- fast-ftl-extract --version
done
- name: Build sdist
if: runner.os == 'Linux' && matrix.arch == 'x86_64' && matrix.libc == 'manylinux'
shell: bash
run: uv build --sdist --out-dir wheelhouse
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: ftl_extract-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.libc }}-${{ github.run_id }}
if-no-files-found: error
path: wheelhouse/*