-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-build
executable file
·65 lines (50 loc) · 1.78 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
#!/usr/bin/env bash
# see https://github.com/OpenAPITools/openapi-generator/tree/v7.8.0/modules/openapi-generator/src/main/resources/ruby-client
set -e
DIR=$(cd `dirname $0` && pwd)
WORKING_DIR="/app/ruby"
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}/lib/dropbox-sign/api/"*.rb
rm -f "${DIR}/lib/dropbox-sign/models/"*.rb
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 Ruby dependencies ...\n"
bash "${DIR}/bin/ruby" bundle
printf "Formatting code ...\n"
bash "${DIR}/bin/ruby" bundle exec rubocop --autocorrect-all --display-only-fail-level-offenses lib spec examples
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 "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
# 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}/lib/" -type f -exec chmod 644 {} \;
fi
printf "Running tests ...\n"
bash "${DIR}/bin/ruby" bundle exec rspec
printf "Success!\n"