-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun-build
executable file
·66 lines (51 loc) · 1.84 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
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
# see https://github.com/OpenAPITools/openapi-generator/tree/v7.8.0/modules/openapi-generator/src/main/resources/python
set -e
DIR=$(cd `dirname $0` && pwd)
WORKING_DIR="/app/python"
if [[ -n "$GITHUB_ACTIONS" ]]; then
printf "\nLogging in to docker.com ...\n"
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
fi
# cleanup
rm -f "${DIR}/dropbox_sign/api/"*.py
rm -f "${DIR}/dropbox_sign/models/"*.py
docker run --rm \
-v "${DIR}/:/local" \
openapitools/openapi-generator-cli:v7.8.0 generate \
-i "/local/openapi-sdk.yaml" \
-c "/local/openapi-config.yaml" \
-t "/local/templates" \
-o "/local/"
printf "Install Python dependencies ...\n"
bash "${DIR}/bin/python" pip install -r requirements.txt
bash "${DIR}/bin/python" pip install -r test-requirements.txt
printf "Formatting code ...\n"
bash "${DIR}/bin/python" python -m black dropbox_sign examples tests
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
# 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"