metadata
metadata copied to clipboard
build: enable macOS CI, add Python 3.13, and stabilize Bazel configuration
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
-
Cross-Platform Workflows: Enable macOS testing and wheel building
- Updated
test.ymlto run on bothubuntu-latestandmacos-latest(arm64) - Updated
wheels.ymlto build wheels on both Ubuntu and macOS platforms - Expanded test matrix to 10 configurations: 2 OS x 5 Python versions (3.9-3.13)
- Updated
-
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/binwith--no-check-certificateflag for robustness - Create
.bazelrcconfiguration file for consistent C++ compilation- Force C++17 standard for both target and host compilation (
--cxxoptand--host_cxxopt) - Add
-fno-strict-aliasingflag for compatibility - Disable bzlmod to use traditional WORKSPACE system
- Add verbose failure logging for CI debugging
- Force C++17 standard for both target and host compilation (
Python & Packaging
-
Python 3.13 Support
- Add Python 3.12 and 3.13 to test and wheel build matrices
- Update
setup.pyclassifiers for new Python versions
-
Build System Configuration
- Create
pyproject.tomlwith PEP 517 build system specification - Pin
setuptools<70andbuild<2.0in build dependencies to ensure Metadata 2.3 compatibility - Note: PyPI only supports Metadata 2.3 (rejects 2.4 generated by setuptools 70+)
- Create
-
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.,
fdopenmacro redefinition)
Repository Hygiene
-
Add
.gitignoreFile- 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/
- Exclude Bazel-generated directories:
PyPI Integration
-
Simplify PyPI Configuration
- Remove explicit
repository-urlfrom publish step to use PyPI's default legacy endpoint - Maintain
verify-metadata: falsedue to pkginfo/twine version constraints on runners
- Remove explicit
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 .andpytestshould work on both Ubuntu and macOS
Notes
- Bazel 6.5.0 is more stable with certificate handling than 7.6.1
- The
.bazelrcfile must be checked in for both local and CI builds to use consistent settings -
Upload to PyPIjob passes. Refer, https://github.com/czgdp1807/metadata/actions/runs/20526757499/job/58971568319