Skip to content
Merged
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
79 changes: 46 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ jobs:
conda-version: 25.11.0
test-type: parallel
# maximum Python/conda combo
- python-version: '3.13'
- python-version: '3.14'
conda-version: canary
test-type: serial
- python-version: '3.13'
- python-version: '3.14'
conda-version: canary
test-type: parallel
env:
Expand Down Expand Up @@ -217,7 +217,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.13']
python-version: ['3.14']

steps:
- name: Checkout Source
Expand Down Expand Up @@ -281,15 +281,19 @@ jobs:
strategy:
fail-fast: false
matrix:
# test lower version (w/ stable conda) and upper version (w/ canary conda)
python-version: ['3.10']
conda-version: [release]
test-type: [serial, parallel]
include:
- python-version: '3.13'
# test lower version (w/ stable conda)
- python-version: '3.10'
conda-version: release
test-type: serial
- python-version: '3.10'
conda-version: release
test-type: parallel
# upper version (w/ canary conda)
- python-version: '3.14'
conda-version: canary
test-type: serial
- python-version: '3.13'
- python-version: '3.14'
conda-version: canary
test-type: parallel
env:
Expand Down Expand Up @@ -379,28 +383,33 @@ jobs:
needs: changes
if: github.event_name == 'schedule' || needs.changes.outputs.code == 'true'

# we still need intel macs so we are stuck on intel runners
# the issue is that there are recipes that depend on packages
# that do not exist for osx-arm64 - see #5388
runs-on: macos-15-intel
runs-on: ${{ matrix.runs-on }}
defaults:
run:
# https://github.com/conda-incubator/setup-miniconda#use-a-default-shell
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
# test lower version (w/ stable conda) and upper version (w/ canary conda)
python-version: ['3.10']
conda-version: [release]
test-type: [serial, parallel]
include:
- python-version: '3.13'
# test lower version (w/ osx-64 & stable conda)
- python-version: '3.10'
conda-version: release
test-type: serial
runs-on: macos-15-intel # osx-64
- python-version: '3.10'
conda-version: release
test-type: parallel
runs-on: macos-15-intel # osx-64
# upper version (w/ osx-arm64 & canary conda)
- python-version: '3.14'
conda-version: canary
test-type: serial
- python-version: '3.13'
runs-on: macos-latest # osx-arm64
- python-version: '3.14'
conda-version: canary
test-type: parallel
runs-on: macos-latest # osx-arm64
env:
# Use conda-forge for release tests since conda 25.11+ is not in defaults for osx-64
CONDA_CHANNEL_LABEL: ${{ matrix.conda-version == 'canary' && 'conda-canary/label/dev' || 'conda-forge' }}
Expand Down Expand Up @@ -431,21 +440,25 @@ jobs:

- name: SDK Download
run: |
echo "MACOSX_SDK_DIR=${HOME}/macosx_sdks" >> "$GITHUB_ENV"
export MACOSX_SDK_DIR=${HOME}/macosx_sdks
echo "MACOSX_SDK_VERSION=10.15" >> "$GITHUB_ENV"
export MACOSX_SDK_VERSION=10.15
echo "MACOSX_SDK_ROOT=${MACOSX_SDK_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk" >> "$GITHUB_ENV"
export MACOSX_SDK_ROOT=${MACOSX_SDK_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk

if [ ! -d ${MACOSX_SDK_DIR} ]; then mkdir ${MACOSX_SDK_DIR}; fi
if [ ! -d ${MACOSX_SDK_ROOT} ]; then
url="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz"
curl -L --output MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz "${url}"
sdk_sha256=ac75d9e0eb619881f5aa6240689fce862dcb8e123f710032b7409ff5f4c3d18b
echo "${sdk_sha256} *MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" | shasum -a 256 -c
tar -xf MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz -C "${MACOSX_SDK_DIR}"
if [ "${{ matrix.runs-on }}" = "macos-latest" ]; then
MACOSX_SDK_ROOT="$(xcrun --sdk macosx --show-sdk-path)"
else
MACOSX_SDK_VERSION=10.15
MACOSX_SDK_SHA256=ac75d9e0eb619881f5aa6240689fce862dcb8e123f710032b7409ff5f4c3d18b

MACOSX_SDK_DIR="${HOME}/macosx_sdks"
if [ ! -d "${MACOSX_SDK_DIR}" ]; then mkdir "${MACOSX_SDK_DIR}"; fi

MACOSX_SDK_ROOT="${MACOSX_SDK_DIR}/MacOSX${MACOSX_SDK_VERSION}.sdk"
if [ ! -d "${MACOSX_SDK_ROOT}" ]; then
url="https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz"
curl -L --output "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" "${url}"

echo "${MACOSX_SDK_SHA256} *MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" | shasum -a 256 -c
tar -xf "MacOSX${MACOSX_SDK_VERSION}.sdk.tar.xz" -C "${MACOSX_SDK_DIR}"
fi
fi
echo "MACOSX_SDK_ROOT=${MACOSX_SDK_ROOT}" >> "$GITHUB_ENV"

- name: Conda Install
run: >
Expand Down
4 changes: 2 additions & 2 deletions conda_build/skeletons/cpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from __future__ import annotations

import codecs
import gzip
import hashlib
import json
Expand Down Expand Up @@ -264,7 +263,8 @@ def get_cpan_api_url(url, colons):
output = output.decode("utf-8-sig")
rel_dict = json.loads(output)
except OSError:
rel_dict = json.loads(codecs.open(json_path, encoding="utf-8").read())
with open(json_path, encoding="utf-8") as fp:
rel_dict = json.load(fp)
except CondaHTTPError:
rel_dict = None
return rel_dict
Expand Down
19 changes: 19 additions & 0 deletions news/5941-python-314.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* Add Python 3.13 to test matrix. (#5941)
1 change: 1 addition & 0 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ python:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
9 changes: 9 additions & 0 deletions tests/cli/test_main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import TYPE_CHECKING

import pytest
from conda.base.context import context
from conda.exceptions import PackagesNotFoundError

from conda_build import api
Expand Down Expand Up @@ -42,6 +43,10 @@ def test_build_empty_sections(conda_build_test_recipe_envvar: str):


@pytest.mark.serial
@pytest.mark.skipif(
context.subdir == "osx-arm64",
reason="conda_build_test channel does not support osx-arm64",
)
def test_build_add_channel():
"""This recipe requires the conda_build_test_requirement package, which is
only on the conda_build_test channel. This verifies that the -c argument
Expand Down Expand Up @@ -459,6 +464,10 @@ def test_relative_path_test_artifact(
main_build.execute(args)


@pytest.mark.skipif(
context.subdir == "osx-arm64",
reason="imagesize<1.0 package not available on osx-arm64",
)
def test_test_extra_dep(testing_metadata):
testing_metadata.meta["test"]["imports"] = ["imagesize"]
api.output_yaml(testing_metadata, "meta.yaml")
Expand Down
5 changes: 5 additions & 0 deletions tests/cli/test_main_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import pytest
import yaml
from conda.base.context import context
from conda.exceptions import PackagesNotFoundError

from conda_build import api
Expand All @@ -22,6 +23,10 @@
from conda_build.metadata import MetaData


@pytest.mark.skipif(
context.subdir == "osx-arm64",
reason="conda_build_test channel does not support osx-arm64",
)
def test_render_add_channel(tmp_path: Path) -> None:
"""This recipe requires the conda_build_test_requirement package, which is
only on the conda_build_test channel. This verifies that the -c argument
Expand Down
46 changes: 28 additions & 18 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ def test_recipe_builds(
pytest.xfail("Numpy build doesn't run on Python 3.13 yet.")
elif recipe.name == "dll_linking_fail":
pytest.xfail("Recipe being built needs to fail linking tests.")
elif (
recipe.name
in (
"r_test_import",
"transitive_subpackage",
"always_include_files_glob",
"osx_rpath",
)
and context.subdir == "osx-arm64"
):
pytest.skip("Recipe uses packages that are not available on osx-arm64")

# These variables are defined solely for testing purposes,
# so they can be checked within build scripts
Expand Down Expand Up @@ -1478,12 +1489,18 @@ def test_failed_recipe_leaves_folders(testing_config):


@pytest.mark.sanity
@pytest.mark.skipif(
context.subdir == "osx-arm64", reason="r-base package not available on osx-arm64"
)
def test_only_r_env_vars_defined(testing_config):
recipe = os.path.join(metadata_dir, "_r_env_defined")
api.build(recipe, config=testing_config)


@pytest.mark.sanity
@pytest.mark.skipif(
context.subdir == "osx-arm64", reason="perl package not available on osx-arm64"
)
def test_only_perl_env_vars_defined(testing_config):
recipe = os.path.join(metadata_dir, "_perl_env_defined")
api.build(recipe, config=testing_config)
Expand Down Expand Up @@ -2164,27 +2181,20 @@ def test_api_build_grpc_issue5645(monkeypatch, tmp_path, testing_config):


@pytest.mark.skipif(
not on_mac, reason="needs to cross-compile from osx-64 to osx-arm64"
not on_mac,
reason="needs to cross-compile from osx-64 to osx-arm64",
)
def test_api_build_pytorch_cpu_issue5644(monkeypatch, tmp_path, testing_config):
# this test has to cross-compile from osx-64 to osx-arm64
try:
if "CONDA_SUBDIR" in os.environ:
old_subdir = os.environ["CONDA_SUBDIR"]
has_old_subdir = True
else:
has_old_subdir = False
old_subdir = None
os.environ["CONDA_SUBDIR"] = "osx-64"

testing_config.channel_urls = ["conda-forge"]
monkeypatch.chdir(tmp_path)
api.build(str(metadata_path / "_pytorch_cpu"), config=testing_config)
finally:
if has_old_subdir:
os.environ["CONDA_SUBDIR"] = old_subdir
else:
del os.environ["CONDA_SUBDIR"]
# monkeypatch.setenv("CONDA_SUBDIR", "osx-64")
monkeypatch.chdir(tmp_path)
api.build(
str(metadata_path / "_pytorch_cpu"),
config=testing_config,
channel_urls=["conda-forge"],
platform="osx",
arch="64",
)


@pytest.mark.skipif(on_win, reason="file permissions not relevant on Windows")
Expand Down
4 changes: 4 additions & 0 deletions tests/test_api_build_go_package.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (C) 2014 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda.base.context import context

from conda_build.api import build

Expand All @@ -9,6 +10,9 @@

@pytest.mark.sanity
@pytest.mark.serial
@pytest.mark.skipif(
context.subdir == "osx-arm64", reason="go package not compiled for osx-arm64"
)
def test_recipe_build(testing_config, monkeypatch):
# These variables are defined solely for testing purposes,
# so they can be checked within build scripts
Expand Down
22 changes: 18 additions & 4 deletions tests/test_api_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def test_pin_compatible_semver(testing_config):
assert "zlib >=1.2.11,<2.0a0" in metadata.get_value("requirements/run")


@pytest.mark.skipif(
context.subdir == "osx-arm64",
reason="python=3.6 package not available on osx-arm64",
)
def test_transitive_subpackage_dependency(testing_config):
recipe_dir = os.path.join(metadata_dir, "transitive_subpackage")
metadata = api.render(recipe_dir, config=testing_config)[1][0]
Expand Down Expand Up @@ -218,10 +222,20 @@ def test_noarch_with_platform_deps(testing_workdir, testing_config):
def test_noarch_with_no_platform_deps(testing_workdir, testing_config):
recipe_path = os.path.join(metadata_dir, "_noarch_with_no_platform_deps")
build_ids = set()
for platform in ["osx", "linux", "win"]:
metadata = api.render(recipe_path, config=testing_config, platform=platform)[0][
0
]
for platform, arch in [
("osx", "64"),
("osx", "arm64"),
("linux", "64"),
("linux", "aarch64"),
("win", "64"),
("win", "arm64"),
]:
metadata = api.render(
recipe_path,
config=testing_config,
platform=platform,
arch=arch,
)[0][0]
build_ids.add(metadata.build_id())

assert len(build_ids) == 1
Expand Down
9 changes: 9 additions & 0 deletions tests/test_api_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import pytest
import ruamel.yaml
from conda.base.context import context

from conda_build import api
from conda_build.skeletons.pypi import (
Expand Down Expand Up @@ -406,6 +407,10 @@ def test_pypi_with_version_arg(tmp_path: Path):


@pytest.mark.slow
@pytest.mark.skipif(
context.subdir == "osx-arm64",
reason="python=3.6 package not available on osx-arm64",
)
def test_pypi_with_extra_specs(tmp_path: Path, testing_config):
# regression test for https://github.com/conda/conda-build/issues/1697
# For mpi4py:
Expand All @@ -429,6 +434,10 @@ def test_pypi_with_extra_specs(tmp_path: Path, testing_config):


@pytest.mark.slow
@pytest.mark.skipif(
context.subdir == "osx-arm64",
reason="python=3.6 package not available on osx-arm64",
)
def test_pypi_with_version_inconsistency(tmp_path: Path, testing_config):
# regression test for https://github.com/conda/conda-build/issues/189
# For mpi4py:
Expand Down
Loading