This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-suite.sh
executable file
·150 lines (133 loc) · 4.56 KB
/
run-suite.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#! /usr/bin/env bash
# set -e
set -x
if [[ $# < 2 ]];
then
echo "Usage: $0 benchmark-dir project python-version"
exit -1
fi
BASEDIR=$(dirname "$0")
submodule=$1
project=$2
py_version=$3
project_dir=$submodule/$project
project_logs_dir=$project_dir/logs
project_lock_dir=$project_dir/lockfiles
docker_image=profile-$project
docker_image_lock=profile-$project-lock
if [[ ! -d logs ]];
then
mkdir logs
fi
if [[ ! -d $project_logs_dir ]];
then
mkdir $project_logs_dir
fi
if [[ ! -f $project_logs_dir/results.txt ]];
then
echo "env,time" > $project_logs_dir/results.txt
fi
if [[ ! -d $project_lock_dir ]];
then
mkdir $project_lock_dir
fi
docker build $BASEDIR \
--build-arg PYPI_URL=$PYPI_URL \
--build-arg PROJECT_DIR=$project_dir \
--build-arg PYTHON_VERSION=$py_version \
--target base \
--tag $docker_image &> logs/docker.log
status_code=$?
if [[ $status_code -ne 0 ]]; then
cat logs/docker.log
exit $status_code
fi
# Create the lockfiles for the requisite projects and log the output for debugging
docker run --rm \
-e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD \
-e CHANNEL=$CONDA_CHANNEL -e TOKEN=$CONDA_TOKEN \
$docker_image \
-c "/test/bootstrap-conda.sh 1>&2 && ~/miniconda/bin/conda env export -n test " \
> $project_lock_dir/environment-lock.yml \
2> $project_logs_dir/create-lock-conda.log
status_code=$?
echo "return code: $status_code" >> $project_logs_dir/create-lock-conda.log
if [[ $status_code -ne 0 ]]; then
cat $project_logs_dir/create-lock-conda.log
exit $status_code
fi
docker run --rm \
-e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD \
-e CHANNEL=$CONDA_CHANNEL -e TOKEN=$CONDA_TOKEN \
$docker_image \
-c "/test/bootstrap-pipenv.sh 1>&2 && cat Pipfile.lock" \
> $project_lock_dir/Pipfile.lock \
2> $project_logs_dir/create-lock-pipenv.log
status_code=$?
echo "return code: $status_code" >> $project_logs_dir/create-lock-pipenv.log
if [[ $status_code -ne 0 ]]; then
cat $project_logs_dir/create-lock-pipenv.log
exit $status_code
fi
docker run --rm \
-e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD \
-e CHANNEL=$CONDA_CHANNEL -e TOKEN=$CONDA_TOKEN \
$docker_image \
-c "/test/bootstrap-poetry.sh 1>&2 && cat poetry.lock" \
> $project_lock_dir/poetry.lock \
2> $project_logs_dir/create-lock-poetry.log
status_code=$?
echo "return code: $status_code" >> $project_logs_dir/create-lock-poetry.log
if [[ $status_code -ne 0 ]]; then
cat $project_logs_dir/create-lock-poetry.log
exit $status_code
fi
docker run --rm \
-e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD \
-e CHANNEL=$CONDA_CHANNEL -e TOKEN=$CONDA_TOKEN \
$docker_image \
-c "/test/bootstrap-pip-compile.sh 1>&2 && cat requirements.txt" \
> $project_lock_dir/requirements.txt \
2> $project_logs_dir/create-lock-pip.log
status_code=$?
echo "return code: $status_code" >> $project_logs_dir/create-lock-pip.log
if [[ $status_code -ne 0 ]]; then
cat $project_logs_dir/create-lock-pip.log
exit $status_code
fi
docker build $BASEDIR \
--build-arg PYPI_URL=$PYPI_URL \
--build-arg PROJECT_DIR=$project_dir \
--build-arg PYTHON_VERSION=$py_version \
--target locks \
--tag $docker_image_lock &> logs/docker-lock.log
status_code=$?
if [[ $status_code -ne 0 ]]; then
cat logs/docker-lock.log
exit $status_code
fi
for snek in conda conda-lock conda+pip mamba mamba-lock mamba+pip pip-compile pip-wheel-lock pip+pyenv pip+venv pipenv pipenv-lock pipenv-skip-lock poetry poetry-lock
do
echo $snek
# Run once for logs
docker run --rm \
-e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD \
-e CHANNEL=$CONDA_CHANNEL -e TOKEN=$CONDA_TOKEN \
$docker_image_lock -c "/test/bootstrap-${snek}.sh" &> $project_logs_dir/${snek}.log
status_code=$?
echo "return code: $status_code" >> $project_logs_dir/${snek}.log
if [[ $status_code -eq 0 ]]; then
for i in `seq 1 10`;
do
docker run --rm \
-e PYPI_USERNAME=$PYPI_USERNAME -e PYPI_PASSWORD=$PYPI_PASSWORD \
-e CHANNEL=$CONDA_CHANNEL -e TOKEN=$CONDA_TOKEN \
$docker_image_lock -c "/usr/bin/time --format "%e" --output=/test/time.out \
/test/bootstrap-${snek}.sh &> /dev/null && \
echo -n "${snek}," && cat /test/time.out" >> $project_logs_dir/results.txt
done
else
cat $project_logs_dir/${snek}.log
exit $status_code
fi
done