-
Notifications
You must be signed in to change notification settings - Fork 12
164 lines (151 loc) · 5.18 KB
/
build-gradle.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Build ANET
on:
push:
branches:
- '**'
tags:
- '**'
pull_request:
branches:
- main
env:
NODE_OPTIONS: '--max-old-space-size=8192'
DB_DRIVER: postgresql
jobs:
build:
name: Build with Gradle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/build-cache
- run: ./gradlew check -x test
- run: ./gradlew prettierCheck
- run: ./gradlew yarn_run_lint
- run: ./gradlew jar
test-init:
needs: build
name: Test ANET init
runs-on: ubuntu-latest
env:
ANET_ADMIN_ORG_NAME: "ACME Administrators Inc."
ANET_ADMIN_POS_NAME: "The ANET admin"
ANET_ADMIN_FULL_NAME: "DOE, John"
ANET_ADMIN_DOMAIN_USERNAME: "johndoe"
ANET_CONFIG: "anet-test.yml"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/build-cache
- run: ./gradlew -PtestEnv dockerCreateDB dockerStartDB
- run: |
echo "testMode: true" |
cat - anet.yml > ${ANET_CONFIG}
- run: ./gradlew -PtestEnv dbWait
# This step should fail:
- name: Run ANET init on empty database
id: init-on-empty-db
run: ./gradlew -PtestEnv dbInit
continue-on-error: true
- run: exit 1
if: ${{ steps.init-on-empty-db.outcome != 'failure' }}
# This step should succeed:
- name: Run ANET init on clean database
id: init-on-clean-db
run: ./gradlew -PtestEnv dbMigrate dbInit
# This step should fail:
- name: Run ANET init on filled database
id: init-on-filled-db
run: ./gradlew -PtestEnv dbInit
continue-on-error: true
- run: exit 1
if: ${{ steps.init-on-filled-db.outcome != 'failure' }}
test-server:
needs: build
name: Server tests; ${{ matrix.dictionary }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dictionary: [anet-dictionary.yml, testDictionaries/no-custom-fields.yml]
env:
ANET_DICTIONARY_NAME: ${{ matrix.dictionary }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/build-cache
- run: |
rm -rf client/build/test-results
mkdir -p client/build/test-results
- run: ./gradlew -PtestEnv dockerCreateDB dockerStartDB
- run: ./gradlew -PtestEnv dockerConfigureKeycloak dockerStartKeycloak
- run: ./gradlew -PtestEnv dockerCreateFakeSmtpServer dockerStartFakeSmtpServer
- run: ./gradlew -PtestEnv dbWait dbMigrate dbLoad
- run: ./gradlew -PtestEnv test jacocoTestReport
- run: ./gradlew yarn_run_server-junit-merge
- name: Strip slashes from dictionary name
id: strip-slashes
run: echo "dictionary=${ANET_DICTIONARY_NAME//\//_}" >> $GITHUB_OUTPUT
if: always()
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: server-test-results for ${{ steps.strip-slashes.outputs.dictionary }}
path: client/build/test-results/server-test-results.xml
if: always()
test-client:
needs: build
name: Client tests; ${{ matrix.client-tests }}, ${{ matrix.dictionary }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dictionary: [anet-dictionary.yml]
client-tests: [jest, wdio-junit, e2e-junit]
include:
- dictionary: testDictionaries/no-custom-fields.yml
client-tests: wdio-noCF-junit
env:
ANET_DICTIONARY_NAME: ${{ matrix.dictionary }}
CLIENT_TESTS: ${{ matrix.client-tests }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/build-cache
- run: |
rm -rf client/build/test-results
mkdir -p client/build/test-results
- run: ./gradlew -PtestEnv dockerCreateDB dockerStartDB
- run: ./gradlew -PtestEnv dockerConfigureKeycloak dockerStartKeycloak
- run: ./gradlew -PtestEnv dockerCreateFakeSmtpServer dockerStartFakeSmtpServer
- run: ./gradlew -PtestEnv dbWait dbMigrate dbLoad
- run: |
./gradlew -PtestEnv run &
sleep 15
- uses: olegtarasov/get-tag@2.1.3
id: tagName
- name: Set local identifier for BrowserStack
id: browserstack-local
run: echo "identifier=github-${GITHUB_RUN_ID}-${DB_DRIVER}-${CLIENT_TESTS}" >> $GITHUB_OUTPUT
- run: ./gradlew yarn_run_test-${CLIENT_TESTS}
env:
GIT_TAG_NAME: ${{ steps.tagName.outputs.tag }}
BROWSERSTACK_LOCAL_IDENTIFIER: ${{ steps.browserstack-local.outputs.identifier }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
BROWSERSTACK_USER: ${{ secrets.BROWSERSTACK_USER }}
- run: head -1000 logs/clientLog.log
if: always()
- name: Strip slashes from dictionary name
id: strip-slashes
run: echo "dictionary=${ANET_DICTIONARY_NAME//\//_}" >> $GITHUB_OUTPUT
if: always()
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.client-tests }}-test-results for ${{ steps.strip-slashes.outputs.dictionary }}
path: client/build/test-results/${{ matrix.client-tests }}-test-results.xml
if: always()