Remove lazy_static #144
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 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.11", "3.12", "3.13", "3.14" ] | |
| 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: Install Just | |
| uses: extractions/setup-just@v3 | |
| - 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.14) | |
| if: runner.os == 'Linux' && matrix.python-version == '3.14' | |
| env: | |
| BUILD_RUST_IMPL: "1" | |
| shell: bash | |
| run: uv sync --all-extras | |
| - name: Prepare the project (Linux !py3.14) | |
| if: runner.os == 'Linux' && matrix.python-version != '3.14' | |
| 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: just lint-py | |
| - name: Install cargo-llvm-cov (Linux py3.14) | |
| if: runner.os == 'Linux' && matrix.python-version == '3.14' | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - name: Test with Rust extension (Linux py3.14) | |
| if: runner.os == 'Linux' && matrix.python-version == '3.14' | |
| shell: bash | |
| env: | |
| BUILD_RUST_IMPL: "1" | |
| CARGO_TERM_COLOR: "always" | |
| run: | | |
| just test-py-cov | |
| just test-rust-cov | |
| - name: Test without Rust extension (Other OS and Python versions) | |
| if: runner.os != 'Linux' && matrix.python-version != '3.14' | |
| shell: bash | |
| env: | |
| BUILD_RUST_IMPL: "0" | |
| run: just test-py | |
| - name: Upload coverage to Codecov | |
| if: runner.os == 'Linux' && matrix.python-version == '3.14' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} # required for private repos or protected branches | |
| files: lcov.info,coverage.xml | |
| fail_ci_if_error: true | |
| - name: Build the package without Rust extension (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 with Rust extension (Linux py3.14) | |
| if: runner.os == 'Linux' && matrix.python-version == '3.14' | |
| shell: bash | |
| env: | |
| BUILD_RUST_IMPL: "1" | |
| run: uv build --wheel | |
| - name: Build the package without Rust extension (Linux !py3.14) | |
| if: runner.os == 'Linux' && matrix.python-version != '3.14' | |
| 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.14) | |
| if: runner.os == 'Linux' && matrix.python-version == '3.14' | |
| 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 --version | |
| done | |
| - name: Verify wheel installation (Linux !py3.14) | |
| if: runner.os == 'Linux' && matrix.python-version != '3.14' | |
| 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.14" | |
| 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: "cp314-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 --version | |
| done | |
| - name: Build, fix and test wheels (macOS arm64) | |
| if: runner.os == 'macOS' && matrix.arch == 'arm64' | |
| shell: bash | |
| env: | |
| CIBW_BUILD: "cp314-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 --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="cp314-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 --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="cp314-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 --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/* |