forked from pulp/pulp_python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.sh
More file actions
executable file
·115 lines (91 loc) · 3.38 KB
/
Copy pathscript.sh
File metadata and controls
executable file
·115 lines (91 loc) · 3.38 KB
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
#!/usr/bin/env bash
# coding=utf-8
# WARNING: DO NOT EDIT!
#
# This file was generated by plugin_template, and is managed by it. Please use
# './plugin-template --github pulp_python' to update this file.
#
# For more info visit https://github.com/pulp/plugin_template
# make sure this script runs at the repo root
cd "$(dirname "$(realpath -e "$0")")"/../../..
REPO_ROOT="$PWD"
set -mveuo pipefail
source .github/workflows/scripts/utils.sh
export POST_SCRIPT=$PWD/.github/workflows/scripts/post_script.sh
export POST_DOCS_TEST=$PWD/.github/workflows/scripts/post_docs_test.sh
export FUNC_TEST_SCRIPT=$PWD/.github/workflows/scripts/func_test_script.sh
# Needed for both starting the service and building the docs.
# Gets set in .github/settings.yml, but doesn't seem to inherited by
# this script.
export DJANGO_SETTINGS_MODULE=pulpcore.app.settings
export PULP_SETTINGS=$PWD/.ci/ansible/settings/settings.py
if [[ "$TEST" = "docs" || "$TEST" = "publish" ]]; then
cd docs
make PULP_URL="http://pulp" html
cd ..
echo "Validating OpenAPI schema..."
cat $PWD/.ci/scripts/schema.py | cmd_stdin_prefix bash -c "cat > /tmp/schema.py"
cmd_prefix bash -c "python3 /tmp/schema.py"
cmd_prefix bash -c "pulpcore-manager spectacular --file pulp_schema.yml --validate"
if [ -f $POST_DOCS_TEST ]; then
source $POST_DOCS_TEST
fi
exit
fi
if [[ "$TEST" == "plugin-from-pypi" ]]; then
COMPONENT_VERSION=$(http https://pypi.org/pypi/pulp-python/json | jq -r '.info.version')
git checkout ${COMPONENT_VERSION} -- pulp_python/tests/
fi
cd ../pulp-openapi-generator
./generate.sh pulpcore python
pip install ./pulpcore-client
./generate.sh pulp_python python
pip install ./pulp_python-client
cd $REPO_ROOT
if [[ "$TEST" = 'bindings' || "$TEST" = 'publish' ]]; then
python $REPO_ROOT/.ci/assets/bindings/test_bindings.py
cd ../pulp-openapi-generator
if [ ! -f $REPO_ROOT/.ci/assets/bindings/test_bindings.rb ]
then
exit
fi
rm -rf ./pulpcore-client
./generate.sh pulpcore ruby 0
cd pulpcore-client
gem build pulpcore_client
gem install --both ./pulpcore_client-0.gem
cd ..
rm -rf ./pulp_python-client
./generate.sh pulp_python ruby 0
cd pulp_python-client
gem build pulp_python_client
gem install --both ./pulp_python_client-0.gem
cd ..
ruby $REPO_ROOT/.ci/assets/bindings/test_bindings.rb
exit
fi
cat unittest_requirements.txt | cmd_stdin_prefix bash -c "cat > /tmp/unittest_requirements.txt"
cmd_prefix pip3 install -r /tmp/unittest_requirements.txt
# check for any uncommitted migrations
echo "Checking for uncommitted migrations..."
cmd_prefix bash -c "django-admin makemigrations --check --dry-run"
# Run unit tests.
cmd_prefix bash -c "PULP_DATABASES__default__USER=postgres django-admin test --noinput /usr/local/lib/python3.6/site-packages/pulp_python/tests/unit/"
# Run functional tests
export PYTHONPATH=$REPO_ROOT:$REPO_ROOT/../pulpcore${PYTHONPATH:+:${PYTHONPATH}}
if [[ "$TEST" == "performance" ]]; then
if [[ -z ${PERFORMANCE_TEST+x} ]]; then
pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_python.tests.performance
else
pytest -vv -r sx --color=yes --pyargs --capture=no --durations=0 pulp_python.tests.performance.test_$PERFORMANCE_TEST
fi
exit
fi
if [ -f $FUNC_TEST_SCRIPT ]; then
source $FUNC_TEST_SCRIPT
else
pytest -v -r sx --color=yes --pyargs pulp_python.tests.functional
fi
if [ -f $POST_SCRIPT ]; then
source $POST_SCRIPT
fi