forked from hellosign/dropbox-sign-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-build
executable file
·53 lines (41 loc) · 1.47 KB
/
run-build
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
#!/usr/bin/env bash
# see https://github.com/OpenAPITools/openapi-generator/tree/8b3cad0692b6c58f827c0a9b35f1ad733547504b/modules/openapi-generator/src/main/resources/python
set -e
DIR=$(cd `dirname $0` && pwd)
WORKING_DIR="/app/python"
docker run --rm \
-v "${DIR}/:/local" \
openapitools/openapi-generator-cli:v5.3.0 generate \
-i "/local/openapi-sdk.yaml" \
-c "/local/openapi-config.yaml" \
-t "/local/templates" \
-o "/local/"
printf "\nInstalling composer dependencies ...\n"
mkdir -p "${DIR}/vendor"
bash "${DIR}/bin/php" composer install
printf "\n"
printf "Adding examples to Docs ...\n"
bash "${DIR}/bin/php" ./bin/generate-examples.php
printf "Install Python dependencies ...\n"
bash "${DIR}/bin/python" pip install -r requirements.txt
# avoid docker messing with permissions
if [[ -z "$GITHUB_ACTIONS" ]]; then
chmod 644 "${DIR}/README.md"
find "${DIR}/docs/" -type f -exec chmod 644 {} \;
find "${DIR}/examples/" -type f -exec chmod 644 {} \;
find "${DIR}/test_fixtures/" -type f -exec chmod 644 {} \;
find "${DIR}/dropbox_sign/" -type f -exec chmod 644 {} \;
fi
printf "Replacing strings ...\n"
docker run --rm \
-v "${DIR}:${WORKING_DIR}" \
-w "${WORKING_DIR}" \
perl bash ./bin/replace
printf "Scanning for prohibited keywords ...\n"
docker run --rm \
-v "${DIR}:${WORKING_DIR}" \
-w "${WORKING_DIR}" \
perl bash ./bin/scan_for
printf "Running tests ...\n"
bash "${DIR}/bin/python" python -m unittest discover tests
printf "Success!\n"