forked from conda-forge/staged-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_steps.sh
executable file
·96 lines (71 loc) · 3.52 KB
/
build_steps.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
#!/usr/bin/env bash
# PLEASE NOTE: This script has been automatically generated by conda-smithy. Any changes here
# will be lost next time ``conda smithy rerender`` is run. If you would like to make permanent
# changes to this script, consider a proposal to conda-smithy so that other feedstocks can also
# benefit from the improvement.
set -xeuo pipefail
export FEEDSTOCK_ROOT="${FEEDSTOCK_ROOT:-/home/conda/staged-recipes}"
source "${FEEDSTOCK_ROOT}/.scripts/logging_utils.sh"
# This closes the matching `startgroup` on `run_docker_build.sh`
( endgroup "Start Docker" ) 2> /dev/null
( startgroup "Configuring conda" ) 2> /dev/null
export PYTHONUNBUFFERED=1
export CI_SUPPORT="/home/conda/staged-recipes-copy/.ci_support"
cat >~/.condarc <<CONDARC
always_yes: true
channels:
- conda-forge
conda-build:
root-dir: ${FEEDSTOCK_ROOT}/build_artifacts
pkgs_dirs:
- ${FEEDSTOCK_ROOT}/build_artifacts/pkg_cache
- /opt/conda/pkgs
show_channel_urls: true
solver: libmamba
CONDARC
# Workaround for errors related to "unsafe" directories:
# https://github.blog/2022-04-12-git-security-vulnerability-announced/#cve-2022-24765
git config --global --add safe.directory "${FEEDSTOCK_ROOT}"
# Copy the host recipes folder so we don't ever muck with it
# Skip build_artifacts and other big items because it gets huge with time
mkdir -p ~/staged-recipes-copy
shopt -s extglob dotglob
cp -r "${FEEDSTOCK_ROOT}"/!(.|..|build_artifacts|.pixi|miniforge3|MacOSX*.sdk.tar.xz|SDKs|output) ~/staged-recipes-copy
shopt -u extglob dotglob
# Remove any macOS system files
find ~/staged-recipes-copy/recipes -maxdepth 1 -name ".DS_Store" -delete
# Find the recipes from main in this PR and remove them.
echo "Pending recipes."
ls -la ~/staged-recipes-copy/recipes
echo "Finding recipes merged in main and removing them from the build."
pushd "${FEEDSTOCK_ROOT}/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 ~/staged-recipes-copy/recipes/{} && echo Removing recipe: {}"
shopt -u extglob dotglob
popd > /dev/null
# Update environment
mv /opt/conda/conda-meta/history /opt/conda/conda-meta/history.$(date +%Y-%m-%d-%H-%M-%S)
echo > /opt/conda/conda-meta/history
micromamba install --root-prefix ~/.conda --prefix /opt/conda \
--yes --override-channels --channel conda-forge --strict-channel-priority \
--file "${FEEDSTOCK_ROOT}/environment.yaml"
setup_conda_rc "${FEEDSTOCK_ROOT}" "/home/conda/staged-recipes-copy/recipes" "${CI_SUPPORT}/${CONFIG}.yaml"
source run_conda_forge_build_setup
# yum installs anything from a "yum_requirements.txt" file that isn't a blank line or comment.
find ~/staged-recipes-copy/recipes -mindepth 2 -maxdepth 2 -type f -name "yum_requirements.txt" \
| xargs -n1 cat | { grep -v -e "^#" -e "^$" || test $? == 1; } | \
xargs -r /usr/bin/sudo -n yum install -y
# Make sure build_artifacts is a valid channel
conda index "${FEEDSTOCK_ROOT}/build_artifacts"
( endgroup "Configuring conda" ) 2> /dev/null
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
( startgroup "Final checks" ) 2> /dev/null
touch "${FEEDSTOCK_ROOT}/build_artifacts/conda-forge-build-done"