Skip to content

test(hackathon): Add Darwin build to OCI #13688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 6 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ requirements_json_test:
REQUIREMENTS_ALLOW_JSON_PATH: ".gitlab/requirements_allow.json"

package-oci:
parallel:
matrix:
- OS: [ linux, windows ]
ARCH: [ amd64, arm64 ]
- OS: [ darwin ]
ARCH: [ arm64 ]
needs: [ download_dependency_wheels, download_ddtrace_artifacts ]

promote-oci-to-prod:
Expand Down
8 changes: 8 additions & 0 deletions .gitlab/download-dependency-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ export PYTHONUNBUFFERED=TRUE
--platform manylinux2014 \
--output-dir ../pywheels-dep \
--verbose

../lib-injection/dl_wheels.py \
--python-version=$PYTHON_VERSION \
--local-ddtrace \
--arch arm64 \
--platform macosx_12_0 \
--output-dir ../pywheels-dep \
--verbose
39 changes: 28 additions & 11 deletions .gitlab/prepare-oci-package.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -eo pipefail

if [ "$OS" != "linux" ]; then
echo "Only linux packages are supported. Exiting"
if [ "$OS" != "linux" ] && [ "$OS" != "darwin" ]; then
echo "Only linux or darwin packages are supported. Exiting"
exit 0
fi

Expand Down Expand Up @@ -31,15 +31,32 @@ BUILD_DIR=sources

echo -n "$PYTHON_PACKAGE_VERSION" > sources/version

echo "Cleaning up binaries for ${ARCH}"
if [ "${ARCH}" == "arm64" ]; then
echo "Removing x86_64 binaries"
find ../pywheels-dep/ -type f -name '*x86_64*' -exec rm -f {} \;
elif [ "${ARCH}" == "amd64" ]; then
echo "Removing aarch64 binaries"
find ../pywheels-dep/ -type f -name '*aarch64*' -exec rm -f {} \;
else
echo "No ARCH set, not removing any binaries"
if [ "$OS" == "linux" ]; then
echo "Cleaning up binaries for Linux ${ARCH}"
echo "Removing Darwin binaries"
find ../pywheels-dep/ -type f -name '*macosx*' -exec rm -f {} \;
if [ "${ARCH}" == "arm64" ]; then
echo "Removing x86_64 binaries"
find ../pywheels-dep/ -type f -name '*x86_64*' -exec rm -f {} \;
elif [ "${ARCH}" == "amd64" ]; then
echo "Removing aarch64 binaries"
find ../pywheels-dep/ -type f -name '*aarch64*' -exec rm -f {} \;
else
echo "No ARCH set, not removing any binaries"
fi
elif [ "$OS" == "darwin" ]; then
echo "Cleaning up binaries for Darwin ${ARCH}"
echo "Removing Linux binaries"
find ../pywheels-dep/ -type f -name '*linux*' -exec rm -f {} \;
if [ "${ARCH}" == "arm64" ]; then
echo "Removing x86_64 binaries"
find ../pywheels-dep/ -type f -name '*x86_64*' -exec rm -f {} \;
elif [ "${ARCH}" == "amd64" ]; then
echo "Removing arm64 binaries"
find ../pywheels-dep/ -type f -name '*arm64*' -exec rm -f {} \;
else
echo "No ARCH set, not removing any binaries"
fi
fi
cp -r ../pywheels-dep/site-packages* sources/ddtrace_pkgs

Expand Down
4 changes: 2 additions & 2 deletions lib-injection/dl_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@

# Supported Python versions lists all python versions that can install at least one version of the ddtrace library.
supported_versions = ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
supported_arches = ["aarch64", "x86_64", "i686"]
supported_platforms = ["musllinux_1_2", "manylinux2014"]
supported_arches = ["aarch64", "x86_64", "i686", "arm64"]
supported_platforms = ["musllinux_1_2", "manylinux2014", "macosx_12_0"]

parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion lib-injection/sources/sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def _inject():

_log("user-installed ddtrace not found, configuring application to use injection site-packages")

current_platform = "manylinux2014" if _get_clib() == "gnu" else "musllinux_1_2"
current_platform = "macosx_12_0" if sys.platform == "darwin" else ("manylinux2014" if _get_clib() == "gnu" else "musllinux_1_2")
_log("detected platform %s" % current_platform, level="debug")

pkgs_path = os.path.join(SCRIPT_DIR, "ddtrace_pkgs")
Expand Down
Loading