metadata icon indicating copy to clipboard operation
metadata copied to clipboard

build: enable macOS CI, add Python 3.13, and stabilize Bazel configuration

Open czgdp1807 opened this issue 1 month ago • 0 comments

Description

This PR enables cross-platform CI/CD support, adds Python 3.13 compatibility, and stabilizes the Bazel build environment with explicit configuration for consistent builds across all platforms.

Changes

CI/CD Infrastructure

  1. Cross-Platform Workflows: Enable macOS testing and wheel building

    • Updated test.yml to run on both ubuntu-latest and macos-latest (arm64)
    • Updated wheels.yml to build wheels on both Ubuntu and macOS platforms
    • Expanded test matrix to 10 configurations: 2 OS x 5 Python versions (3.9-3.13)
  2. Bazel Build System Stabilization

    • Downgrade Bazel from 7.6.1 to 6.5.0 for improved certificate handling stability
    • Add explicit Bazel pre-installation step in both workflows
    • Install Bazel to ~/.local/bin with --no-check-certificate flag for robustness
    • Create .bazelrc configuration file for consistent C++ compilation
      • Force C++17 standard for both target and host compilation (--cxxopt and --host_cxxopt)
      • Add -fno-strict-aliasing flag for compatibility
      • Disable bzlmod to use traditional WORKSPACE system
      • Add verbose failure logging for CI debugging

Python & Packaging

  1. Python 3.13 Support

    • Add Python 3.12 and 3.13 to test and wheel build matrices
    • Update setup.py classifiers for new Python versions
  2. Build System Configuration

    • Create pyproject.toml with PEP 517 build system specification
    • Pin setuptools<70 and build<2.0 in build dependencies to ensure Metadata 2.3 compatibility
    • Note: PyPI only supports Metadata 2.3 (rejects 2.4 generated by setuptools 70+)
  3. Zlib Dependency Upgrade

    • Upgrade zlib from 1.2.12 to 1.3.1 in WORKSPACE
    • Fixes macro conflicts and compilation issues on macOS with newer Clang versions
    • Resolves Apple Silicon compatibility issues (e.g., fdopen macro redefinition)

Repository Hygiene

  1. Add .gitignore File
    • Exclude Bazel-generated directories: bazel-bin, bazel-metadata, bazel-out, bazel-testlogs
    • Ignore generated protobuf Python files: tensorflow_metadata/proto/v0/*_pb2.py
    • Prevent build artifacts from tracking: build/, dist/, *.egg-info/

PyPI Integration

  1. Simplify PyPI Configuration
    • Remove explicit repository-url from publish step to use PyPI's default legacy endpoint
    • Maintain verify-metadata: false due to pkginfo/twine version constraints on runners

Motivation

  • Cross-Platform Support: Enable developers on macOS and Apple Silicon to contribute and test locally
  • Python Compatibility: Support current and upcoming Python versions (3.12, 3.13)
  • Build Reliability: Explicit Bazel installation and configuration ensures consistent builds across all CI runners
  • Clean Repository: Prevent generated and build artifacts from cluttering version control
  • PyPI Compatibility: Ensure wheels meet PyPI's metadata version requirements

Testing

  • CI will test on: Ubuntu (x86_64) and macOS (arm64)
  • Wheels built for: 2 OS x 5 Python versions = 10 configurations
  • Verify: All CI jobs pass on both platforms
  • Local testing: pip install -e . and pytest should work on both Ubuntu and macOS

Notes

  • Bazel 6.5.0 is more stable with certificate handling than 7.6.1
  • The .bazelrc file must be checked in for both local and CI builds to use consistent settings
  • Upload to PyPI job passes. Refer, https://github.com/czgdp1807/metadata/actions/runs/20526757499/job/58971568319

czgdp1807 avatar Dec 25 '25 10:12 czgdp1807