Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 50 additions & 2 deletions .github/workflows/build_test_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ permissions:
contents: read

jobs:
build_wheels:
name: Build wheels on self-hosted manylinux_2_28 for TestPyPi
build_wheels_linux_x64:
name: Build wheels on self-hosted manylinux_2_28_x64 for TestPyPi
runs-on: linux_x64

steps:
Expand Down Expand Up @@ -54,3 +54,51 @@ jobs:
# Run a simple smoke test
python -c "import zvec; print('Import OK:', zvec.__version__)"
shell: bash

build_wheels_linux_arm64:
name: Build wheels on self-hosted manylinux_2_28_arm64 for TestPyPi
runs-on: linux_arm64

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python (for cibuildwheel controller)
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install cibuildwheel
run: |
pip install --upgrade pip
pip install cibuildwheel==2.17.0
- name: Build wheels using cibuildwheel
run: |
python -m cibuildwheel --output-dir wheelhouse
# Save list of built wheels for publishing
ls wheelhouse/*.whl | tee $GITHUB_STEP_SUMMARY
echo "wheels=$(ls wheelhouse/*.whl | tr '\n' ' ')" >> $GITHUB_ENV
- name: Publish to TestPyPI
if: success() && github.event_name == 'workflow_dispatch'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
run: |
pip install twine
twine upload --skip-existing --verbose wheelhouse/*.whl
- name: (Optional) Install and test from TestPyPI
if: success() && github.event_name == 'workflow_dispatch'
run: |
# Create a clean venv
python -m venv test_env
source test_env/bin/activate
pip install --upgrade pip
# Install from TestPyPI (must allow pre-releases if version has dev/alpha)
pip install numpy
pip install --index-url https://test.pypi.org/simple/ zvec
# Run a simple smoke test
python -c "import zvec; print('Import OK:', zvec.__version__)"
shell: bash
54 changes: 52 additions & 2 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,60 @@ permissions:
contents: read

jobs:
build_wheels:
name: Build wheels on self-hosted manylinux_2_28
build_wheels_linux_x64:
name: Build wheels on self-hosted manylinux_2_28_x64
runs-on: linux_x64

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python (for cibuildwheel controller)
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install cibuildwheel
run: |
pip install --upgrade pip
pip install cibuildwheel==2.17.0

- name: Build wheels using cibuildwheel
run: |
python -m cibuildwheel --output-dir wheelhouse
# Save list of built wheels for publishing
ls wheelhouse/*.whl | tee $GITHUB_STEP_SUMMARY
echo "wheels=$(ls wheelhouse/*.whl | tr '\n' ' ')" >> $GITHUB_ENV

- name: Publish to PyPI
if: success() && github.event_name == 'workflow_dispatch'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_REPOSITORY: pypi
run: |
pip install twine
twine upload --skip-existing --verbose wheelhouse/*.whl

- name: (Optional) Install and test from PyPI
if: success() && github.event_name == 'workflow_dispatch'
run: |
# Create a clean venv
python -m venv test_env
source test_env/bin/activate
pip install --upgrade pip
# Install from PyPI
pip install zvec
# Run a simple smoke test
python -c "import zvec; print('Import OK:', zvec.__version__)"
shell: bash

build_wheels_linux_arm64:
name: Build wheels on self-hosted manylinux_2_28_arm64
runs-on: linux_arm64

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
139 changes: 139 additions & 0 deletions .github/workflows/linux_arm64_docker_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Zvec LinuxARM64 CI

on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
merge_group:
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:

concurrency:
group: pr-${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Zvec LinuxARM64 CI
runs-on: linux_arm64

strategy:
matrix:
python-version: ['3.10']
fail-fast: false

container:
image: quay.io/pypa/manylinux_2_28_aarch64:2024-03-10-4935fcc
options: --user root

steps:
- name: Set up Python path for manylinux
run: |
case "${{ matrix.python-version }}" in
"3.10") PY_PATH="/opt/python/cp310-cp310" ;;
"3.11") PY_PATH="/opt/python/cp311-cp311" ;;
"3.12") PY_PATH="/opt/python/cp312-cp312" ;;
*) echo "Unsupported Python version: ${{ matrix.python-version }}"; exit 1 ;;
esac
echo "PYTHON_BIN=$PY_PATH/bin/python" >> $GITHUB_ENV
echo "PIP_BIN=$PY_PATH/bin/pip" >> $GITHUB_ENV
echo "CLANG_FORMATTER_BIN=$PY_PATH/bin/clang-format" >> $GITHUB_ENV
$PY_PATH/bin/python --version
shell: bash

- name: Prepare clean build directory
run: |
export CLEAN_WORKSPACE="/tmp/zvec"
mkdir -p "$CLEAN_WORKSPACE"
cd "$CLEAN_WORKSPACE"

git config --global --add safe.directory "$CLEAN_WORKSPACE"
git clone --recursive "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" .

if [ -n "${{ github.event.number }}" ]; then
git fetch origin "pull/${{ github.event.number }}/head"
git checkout FETCH_HEAD
else
git checkout "${{ github.sha }}"
fi

echo "CLEAN_WORKSPACE=$CLEAN_WORKSPACE" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash

- name: Install Ruff
run: |
${{ env.PIP_BIN }} install --upgrade pip ruff
shell: bash

- name: Run Ruff Linter
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m ruff check .
shell: bash

- name: Run Ruff Formatter Check
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m ruff format --check .
shell: bash

- name: Run clang-format Check
run: |
${{ env.PIP_BIN }} install clang-format==18.1.8
cd "$CLEAN_WORKSPACE"


CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
! -path "./build/*" \
! -path "./tests/*" \
! -path "./scripts/*" \
! -path "./python/*" \
! -path "./thirdparty/*" \
! -path "./.git/*")

if [ -z "$CPP_FILES" ]; then
echo "No C++ files found to check."
exit 0
fi

${{ env.CLANG_FORMATTER_BIN }} --dry-run --Werror $CPP_FILES
shell: bash

- name: Install Python dependencies and build package
run: |
cd "$CLEAN_WORKSPACE"
NPROC=$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)

${{ env.PIP_BIN }} install cmake ninja

CMAKE_GENERATOR="Unix Makefiles" \
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
${{ env.PIP_BIN }} install -v . --config-settings='cmake.define.BUILD_TOOLS="ON"'
shell: bash

- name: Install test dependencies
run: |
${{ env.PIP_BIN }} install pytest pytest-cov
shell: bash

- name: Run Python Tests with Coverage
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m pytest python/tests/ --cov=zvec --cov-report=xml --no-cov-on-fail
shell: bash

- name: Run Cpp Tests with Coverage
run: |
${{ env.PIP_BIN }} install pybind11==3.0
cd "$CLEAN_WORKSPACE/build"
make unittest -j$(nproc)
shell: bash
Loading
Loading