-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (59 loc) · 1.72 KB
/
validate-generated-code.yml
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
name: Validate generated code
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
validate-generated-code:
name: Validate generated code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
cache-dependency-path: "**/package-lock.json"
- name: Install login-service dependencies
run: ./gradlew login-service:npm_ci
- name: Validate generated code
shell: bash {0}
run: |
./gradlew api-internal:bootRun --args="--server.port=8081 --gropius.core.createIndicesOnStartup=false" --no-daemon &
gradlew_pid=$!
schema_endpoint="http://localhost:8081/sdl"
c=0
until curl -s -f -o /dev/null $schema_endpoint
do
((c++))
if ((c > 120)); then
echo "Failed to get graphql schema: timeout"
exit 1
fi
echo "Waiting for server"
sleep 2
done
cd login-service
echo "Validating login-service generated code"
if ! npm run generate-model; then
echo "Failed to generate model"
exit 1
fi
git status
git diff
if [[ `git status --porcelain` ]]; then
echo "Outdated generated code in login-service"
exit 1
else
echo "login-service up to date"
fi
kill $gradlew_pid