forked from conda-forge/staged-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_osx_build.sh
executable file
·98 lines (80 loc) · 3.22 KB
/
run_osx_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
set -x
source .scripts/logging_utils.sh
( startgroup "Provisioning build tools" ) 2> /dev/null
MINIFORGE_HOME=${MINIFORGE_HOME:-${HOME}/miniforge3}
MINIFORGE_HOME=${MINIFORGE_HOME%/} # remove trailing slash
export CONDA_BLD_PATH=${CONDA_BLD_PATH:-${MINIFORGE_HOME}/conda-bld}
if [[ -f "${MINIFORGE_HOME}/conda-meta/history" ]]; then
echo "Build tools already installed at ${MINIFORGE_HOME}."
else
if command -v micromamba >/dev/null 2>&1; then
micromamba_exe="micromamba"
echo "Found micromamba in PATH"
else
MICROMAMBA_VERSION="1.5.10-0"
if [[ "$(uname -m)" == "arm64" ]]; then
osx_arch="osx-arm64"
else
osx_arch="osx-64"
fi
MICROMAMBA_URL="https://github.com/mamba-org/micromamba-releases/releases/download/${MICROMAMBA_VERSION}/micromamba-${osx_arch}"
echo "Downloading micromamba ${MICROMAMBA_VERSION}"
micromamba_exe="$(mktemp -d)/micromamba"
curl -L -o "${micromamba_exe}" "${MICROMAMBA_URL}"
chmod +x "${micromamba_exe}"
fi
echo "Creating environment"
"${micromamba_exe}" create --yes --root-prefix ~/.conda --prefix "${MINIFORGE_HOME}" \
--channel conda-forge \
--file environment.yaml
fi
( endgroup "Provisioning build tools" ) 2> /dev/null
( startgroup "Configuring conda" ) 2> /dev/null
cat >~/.condarc <<CONDARC
always_yes: true
show_channel_urls: true
solver: libmamba
CONDARC
source "${MINIFORGE_HOME}/etc/profile.d/conda.sh"
conda activate base
echo -e "\n\nSetting up the condarc and mangling the compiler."
setup_conda_rc ./ ./recipes ./.ci_support/${CONFIG}.yaml
if [[ "${CI:-}" != "" ]]; then
mangle_compiler ./ ./recipes .ci_support/${CONFIG}.yaml
fi
if [[ "${CI:-}" != "" ]]; then
echo -e "\n\nMangling homebrew in the CI to avoid conflicts."
/usr/bin/sudo mangle_homebrew
/usr/bin/sudo -k
else
echo -e "\n\nNot mangling homebrew as we are not running in CI"
fi
echo -e "\n\nRunning the build setup script."
source run_conda_forge_build_setup
set -e
# make sure there is a package directory so that artifact publishing works
mkdir -p "${CONDA_BLD_PATH}/osx-64/" "${CONDA_BLD_PATH}/osx-arm64/" "${CONDA_BLD_PATH}/noarch/"
# Make sure CONDA_BLD_PATH is a valid channel; only do it if noarch/repodata.json doesn't exist
# to save some time running locally
test -f "${CONDA_BLD_PATH}/noarch/repodata.json" || conda index "${CONDA_BLD_PATH}"
# Find the recipes from upstream:main in this PR and remove them.
echo ""
echo "Finding recipes merged in main and removing them from the build."
pushd ./recipes > /dev/null
if [ "${CI:-}" != "" ]; then
git fetch --force origin main:main
fi
shopt -s extglob dotglob
git ls-tree --name-only main -- !(example|example-v1) | xargs -I {} sh -c "rm -rf {} && echo Removing recipe: {}"
shopt -u extglob dotglob
popd > /dev/null
echo ""
( endgroup "Configuring conda" ) 2> /dev/null
# We just want to build all of the recipes.
echo "Building all recipes"
python .ci_support/build_all.py
( startgroup "Inspecting artifacts" ) 2> /dev/null
# inspect_artifacts was only added in conda-forge-ci-setup 4.6.0; --all-packages in 4.9.3
command -v inspect_artifacts >/dev/null 2>&1 && inspect_artifacts --all-packages || echo "inspect_artifacts needs conda-forge-ci-setup >=4.9.3"
( endgroup "Inspecting artifacts" ) 2> /dev/null