Skip to content

chore(release): dotpromptz-handlebars 0.1.9 #93

chore(release): dotpromptz-handlebars 0.1.9

chore(release): dotpromptz-handlebars 0.1.9 #93

# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: "Handlebarrz Tests"
on:
pull_request:
paths:
- "python/handlebarrz/**"
- ".github/workflows/handlebarrz-tests.yml"
jobs:
handlebarrz_linux:
name: Build Handlebarrz Linux (${{ matrix.target.name }})
runs-on: ${{ matrix.target.runner }}
env:
# Enable sccache for Rust builds
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
matrix:
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
target:
- { name: "Ubuntu ARM64", runner: "ubuntu-24.04-arm", rust_target: "" }
- { name: "Ubuntu x86_64", runner: "ubuntu-latest", rust_target: "" }
- { name: "Alpine ARM64", runner: "ubuntu-24.04-arm", rust_target: "aarch64-unknown-linux-musl" }
- { name: "Alpine x86_64", runner: "ubuntu-latest", rust_target: "x86_64-unknown-linux-musl" }
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target.rust_target }}
env:
RUSTUP_MAX_RETRIES: 3
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install musl tools (Alpine builds)
if: contains(matrix.target.name, 'Alpine')
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install maturin
run: uv pip install --system "maturin[patchelf]"
- name: Build wheel
working-directory: ./python/handlebarrz
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1
run: |
if [ -n "${{ matrix.target.rust_target }}" ]; then
maturin build --release --strip -o dist --target ${{ matrix.target.rust_target }} -i python${{ matrix.python_version }}
else
maturin build --release --strip -o dist -i python${{ matrix.python_version }}
fi
- name: Install and test wheel (non-musl only)
if: ${{ !contains(matrix.target.name, 'Alpine') }}
working-directory: ./python/handlebarrz
run: |
pip install dist/*.whl
pip install pytest pytest-cov
pytest
handlebarrz_native:
name: Build Handlebarrz Native
runs-on: ${{ matrix.config.os }}
env:
# Enable sccache for Rust builds (disabled on macos-15-intel due to missing binaries)
SCCACHE_GHA_ENABLED: ${{ matrix.config.os != 'macos-15-intel' && 'true' || 'false' }}
RUSTC_WRAPPER: ${{ matrix.config.os != 'macos-15-intel' && 'sccache' || '' }}
strategy:
matrix:
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
config:
- { os: "macos-14", target: "aarch64-apple-darwin", name: "macOS ARM64", python_arch: "arm64" }
# Use macos-15-intel for x86_64 builds - macos-13 is retired, macos-14 (ARM64) has issues with x64 Python
- { os: "macos-15-intel", target: "x86_64-apple-darwin", name: "macOS x86_64", python_arch: "x64" }
- { os: "windows-latest", target: "x86_64-pc-windows-msvc", name: "Windows x86_64", python_arch: "x64" }
# - { os: "windows-latest", target: "aarch64-pc-windows-msvc", name: "Windows ARM64", python_arch: "arm64" }
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
architecture: ${{ matrix.config.python_arch }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.config.target }}
env:
RUSTUP_MAX_RETRIES: 3
- name: Setup sccache
if: matrix.config.os != 'macos-15-intel'
uses: mozilla-actions/sccache-action@v0.0.9
- run: pip install maturin
- name: Build wheel
working-directory: ./python/handlebarrz
# For Windows x64, we need to point to python lib usually, but for cross (arm64 on win x64) we definetely need it or not?
# In publish workflow:
# Win x64: maturin build ... -i python-path
# Win Arm64: maturin build ... --target ... -i python-path
# macOS: maturin build ...
# So I will just use -i everywhere if possible, or conditional.
# Maturin -i works on all platforms to bind to specific python.
run: maturin build --release --strip -o dist --target ${{ matrix.config.target }}
- name: Install built wheel
working-directory: ./python/handlebarrz
shell: bash
run: |
pip install dist/*.whl
pip install pytest pytest-cov
- name: Run tests
working-directory: ./python/handlebarrz
shell: bash
run: pytest --cov=handlebarrz --cov-report=term-missing