-
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·125 lines (98 loc) · 2.53 KB
/
test.sh
File metadata and controls
executable file
·125 lines (98 loc) · 2.53 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
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
set -Eeuxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/.."
source scripts/prep.sh
typescript () {
echo "Testing TypeScript..."
dir="clients/${PROJECT}/typescript"
(cd "$dir" && npm i && npm run build)
}
typescript_fetch () {
echo "Testing TypeScript Fetch..."
dir="clients/${PROJECT}/typescript-fetch"
(cd "$dir" && npm i && npm run build)
}
java () {
echo "Testing Java..."
dir="clients/${PROJECT}/java"
(cd "$dir" && mvn test-compile)
}
php() {
echo "Testing PHP..."
dir="clients/${PROJECT}/php"
(cd "$dir" && composer install && ./vendor/bin/phpunit)
}
python () {
echo "Testing Python..."
dir="clients/${PROJECT}/python"
(cd "$dir" && pip install -r requirements.txt && pip install -r test-requirements.txt && pytest --cov="$PYTHON_PACKAGE_NAME")
}
ruby () {
echo "Testing Ruby..."
dir="clients/${PROJECT}/ruby"
(cd "$dir" && rm "${RUBY_PROJECT_NAME}-${GEM_VERSION}.gem" || true && bundle install --path vendor/bundle && bundle exec rspec && gem build "${RUBY_PROJECT_NAME}.gemspec" && gem install "${RUBY_PROJECT_NAME}-${GEM_VERSION}.gem")
}
golang () {
echo "Testing Golang..."
dir="clients/${PROJECT}/go"
if [ -f "$dir/README.md" ]; then
# assuming swagger 3 in this case
(cd "${dir}" && command go mod tidy -compat=1.17 && command go build -o "$(mktemp)" .)
else
# assuming swagger 2
(cd "${dir}" && command go mod tidy -compat=1.17)
(cd "${dir}/client" && command go build -o "$(mktemp)" .)
(cd "${dir}/models" && command go build -o "$(mktemp)" .)
fi
}
csharp () {
echo "Testing C#..."
dir="clients/${PROJECT}/dotnet"
(cd "${dir}" && \
VERSION="" command dotnet build -c Release && \
VERSION="" command dotnet test -c Release)
}
dartpub () {
echo "Testing Dart..."
dir="clients/${PROJECT}/dart"
(cd "$dir" && command dart pub get)
(cd "$dir" && command dart test .)
}
rust () {
echo "Testing Rust..."
dir="clients/${PROJECT}/rust"
(cd "$dir" && cargo test)
}
elixir () {
echo "Testing Elixir..."
dir="clients/${PROJECT}/elixir"
export MIX_ENV=prod
(cd "${dir}"; mix local.rebar --force)
(cd "${dir}"; mix local.hex --force)
(cd "${dir}"; mix deps.get)
(cd "${dir}"; mix deps.compile)
(cd "${dir}"; mix compile)
(cd "${dir}"; mix test)
}
if [ -z "$1" ]; then
elixir
typescript
typescript_fetch
rust
golang
java
php
python
ruby
dartpub
# TODO: https://github.com/ory/sdk/issues/434
# csharp
else
if [ "$1" == "dart" ]; then
dartpub
elif [ "$1" == "dotnet" ]; then
csharp
else
$1
fi
fi