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
27 changes: 27 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# This macro is needed in order for mlmd to build with ZetaSQL which can only
# be compiled upon c++17 or higher.
build --cxxopt="-std=c++17"
build --host_cxxopt="-std=c++17"

# Needed to avoid zetasql proto error.
build --protocopt=--experimental_allow_proto3_optional
Expand All @@ -23,5 +24,31 @@ build --protocopt=--experimental_allow_proto3_optional
# parameter 'user_link_flags' is deprecated and will be removed soon.
# It may be temporarily re-enabled by setting --incompatible_require_linker_input_cc_api=false
build --incompatible_require_linker_input_cc_api=false

build:macos --apple_platform_type=macos
build:macos_arm64 --cpu=darwin_arm64
build:macos_arm64 --linkopt=-Wl,-undefined,dynamic_lookup
build:macos_arm64 --host_linkopt=-Wl,-undefined,dynamic_lookup
build --conlyopt=-std=c11
build --host_conlyopt=-std=c11
build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17
build --copt=-Wno-error
build --cxxopt=-Wno-error
build --cxxopt=-fpermissive
build --conlyopt=-Wno-array-parameter
build --conlyopt=-Wno-implicit-function-declaration
build --host_copt=-Wno-error
build --host_cxxopt=-Wno-error
build --host_cxxopt=-fpermissive
build --host_conlyopt=-Wno-array-parameter
build --host_conlyopt=-Wno-implicit-function-declaration
# Linux-only linker flags (not supported on macOS)
build:linux --linkopt=-Wl,--no-as-needed
build:linux --host_linkopt=-Wl,--no-as-needed
build:macos_arm64 --copt=-Wno-error=c23-extensions
build:macos_arm64 --host_copt=-Wno-error=c23-extensions
build:macos_arm64 --copt=-Wno-c23-extensions
build:macos_arm64 --host_copt=-Wno-c23-extensions
build:macos_arm64 --action_env=CONDA_PREFIX
build:macos_arm64 --action_env=CMAKE_ICONV_FLAG="-DCMAKE_DISABLE_FIND_PACKAGE_Iconv=ON -DICONV_LIBRARIES=$CONDA_PREFIX/lib/libiconv.dylib -DICONV_INCLUDE_DIR=$CONDA_PREFIX/include"
53 changes: 0 additions & 53 deletions .github/workflows/build.yml

This file was deleted.

97 changes: 97 additions & 0 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build ml-metadata with Conda

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.13"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ${{ matrix.os == 'macos-latest' && 'ci/environment-macos.yml' || 'ci/environment.yml' }}
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}

- name: Display environment info
shell: bash -l {0}
run: |
micromamba info
micromamba list

- name: Install Bazel
shell: bash -l {0}
run: |
# Install Bazelisk (manages Bazel versions)
if [ "$RUNNER_OS" == "Linux" ]; then
curl -Lo /tmp/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-amd64
elif [ "$RUNNER_OS" == "macOS" ]; then
curl -Lo /tmp/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-darwin-amd64
fi
chmod +x /tmp/bazelisk
sudo mv /tmp/bazelisk /usr/local/bin/bazel
echo "USE_BAZEL_VERSION=6.1.0" >> $GITHUB_ENV
bazel --version

- name: Build the package
shell: bash -l {0}
run: |
python setup.py bdist_wheel

- name: Repair wheel (Linux)
if: runner.os == 'Linux'
shell: bash -l {0}
run: |
WHEEL_PATH="$(ls dist/*.whl)"
WHEEL_DIR=$(dirname "${WHEEL_PATH}")
auditwheel repair --plat manylinux2014_x86_64 -w "${WHEEL_DIR}" "${WHEEL_PATH}"
rm "${WHEEL_PATH}"

- name: Upload wheel artifact
uses: actions/upload-artifact@v4.4.0
with:
name: ml-metadata-wheel-${{ matrix.os }}-py${{ matrix.python-version }}
path: dist/*.whl

upload_to_pypi:
name: Upload to PyPI
runs-on: ubuntu-latest
if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch')
needs: [build]
environment:
name: pypi
url: https://pypi.org/p/ml-metadata/
permissions:
id-token: write
steps:
- name: Retrieve wheels
uses: actions/download-artifact@v4.1.8
with:
merge-multiple: true
path: wheels

- name: List the build artifacts
run: |
ls -lAs wheels/

- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9
with:
packages_dir: wheels/
76 changes: 76 additions & 0 deletions .github/workflows/conda-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Test ml-metadata with Conda

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.13"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ${{ matrix.os == 'macos-latest' && 'ci/environment-macos.yml' || 'ci/environment.yml' }}
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}

- name: Display environment info
shell: bash -l {0}
run: |
micromamba info
micromamba list

- name: Install Bazel
shell: bash -l {0}
run: |
# Install Bazelisk (manages Bazel versions)
if [ "$RUNNER_OS" == "Linux" ]; then
curl -Lo /tmp/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-amd64
elif [ "$RUNNER_OS" == "macOS" ]; then
curl -Lo /tmp/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-darwin-amd64
fi
chmod +x /tmp/bazelisk
sudo mv /tmp/bazelisk /usr/local/bin/bazel
echo "USE_BAZEL_VERSION=6.1.0" >> $GITHUB_ENV
bazel --version

- name: Build the package
shell: bash -l {0}
run: |
python setup.py bdist_wheel

- name: Install built wheel (Linux/macOS)
if: runner.os != 'Windows'
shell: bash -l {0}
run: |
pip install dist/*.whl

- name: Install built wheel (Windows)
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
pip install (Get-ChildItem dist/*.whl | Select-Object -First 1).FullName

- name: Run tests
shell: bash -l {0}
run: |
# cleanup (interferes with tests)
rm -rf bazel-*
# run tests
pytest -vv
34 changes: 0 additions & 34 deletions .github/workflows/test.yml

This file was deleted.

Loading