File: ci.yml

package info (click to toggle)
ejabberd 26.02-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,396 kB
  • sloc: erlang: 122,646; sh: 4,258; sql: 3,633; perl: 869; makefile: 559; javascript: 216; python: 48
file content (432 lines) | stat: -rw-r--r-- 11,906 bytes parent folder | download
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
name: CI

on:
  push:
    paths-ignore:
    - '.devcontainer/**'
    - 'lib/**'
    - 'man/**'
    - 'priv/**'
    - '**.md'
  pull_request:
    paths-ignore:
    - '.devcontainer/**'
    - 'lib/**'
    - 'man/**'
    - 'priv/**'
    - '**.md'

env:
  DEV: _build/dev/rel/ejabberd

jobs:

  ############################################################### Compile #####

  compile:
    runs-on: ubuntu-24.04-arm
    strategy:
      matrix:
        otp: ['27']

    steps:

    - uses: actions/checkout@v6

    - uses: erlef/setup-beam@v1
      with:
        otp-version: ${{ matrix.otp }}
        hexpm-mirrors: |
          https://cdn.jsdelivr.net/hex
          https://builds.hex.pm

    - uses: awalsh128/cache-apt-pkgs-action@latest
      with:
        packages: libexpat1-dev libgd-dev libpam0g-dev
                  libsqlite3-dev libwebp-dev libyaml-dev

    - name: Cache rebar3
      uses: actions/cache@v5
      with:
        path: |
          ~/.cache/rebar3/
          _build/default/lib/
        key: ci-${{ matrix.otp }}-${{hashFiles('rebar.config')}}

    - name: Compile
      uses: ./.github/actions/manage-ejabberd
      with:
        for: prod
        do: compile
        tool: rebar3
        configure: --disable-elixir

    - name: Compress compiled.tar
      run: |
        tar -cvf /tmp/compiled.tar .

    - uses: actions/upload-artifact@v6
      with:
        name: compiled-${{ matrix.otp }}
        path: /tmp/compiled.tar
        retention-days: 1

  ########################################################## Static Tests #####

  static:
    needs: compile
    runs-on: ubuntu-24.04-arm
    strategy:
      matrix:
        otp: ['27']

    steps:

    - uses: erlef/setup-beam@v1
      with:
        otp-version: ${{ matrix.otp }}
        hexpm-mirrors: |
          https://cdn.jsdelivr.net/hex
          https://builds.hex.pm

    - uses: actions/download-artifact@v7
      with:
        name: compiled-${{ matrix.otp }}
    - run: tar -xf compiled.tar

    - name: Test shell scripts
      run: |
        shellcheck ejabberd.init.template
        shellcheck -x ejabberdctl.template
        shellcheck .vscode/relive.sh
        shellcheck rel/setup-dev.sh
        shellcheck rel/setup-relive.sh
        shellcheck test/ejabberd_SUITE_data/gencerts.sh
        shellcheck tools/captcha.sh
        shellcheck tools/emacs-indent.sh
        shellcheck tools/generate-doap.sh
        shellcheck tools/prepare-tr.sh
        shellcheck tools/rebar3-format.sh

    - run: make hooks
    - run: make options
    - run: make xref
    - run: make dialyzer
    - run: make test-eunit
    - run: make elvis
      if: matrix.otp > '25'

    - run: make install -s

  ######################################################### Dynamic Tests #####

  dynamic:
    needs: compile
    runs-on: ubuntu-24.04-arm
    strategy:
      matrix:
        otp: ['27']

    steps:

    - uses: erlef/setup-beam@v1
      with:
        otp-version: ${{ matrix.otp }}
        hexpm-mirrors: |
          https://cdn.jsdelivr.net/hex
          https://builds.hex.pm

    - uses: awalsh128/cache-apt-pkgs-action@latest
      if: matrix.otp < '27'
      with:
        packages: libexpat1-dev libgd-dev libpam0g-dev
                  libsqlite3-dev libwebp-dev libyaml-dev

    - uses: actions/download-artifact@v7
      with:
        name: compiled-${{ matrix.otp }}
    - run: tar -xf compiled.tar

    - name: Check production release
      uses: ./.github/actions/manage-ejabberd
      with:
        for: prod
        do: deploy, start, stop, check

    - name: Start development release
      uses: ./.github/actions/manage-ejabberd
      with:
        for: dev
        do: deploy, no_tls, start, register
        username: user123

    - name: Run XMPP Interoperability Tests against CI server
      if: matrix.otp == '27'
      continue-on-error: true
      uses: XMPP-Interop-Testing/xmpp-interop-tests-action@v1.7.2
      with:
        domain: 'localhost'
        adminAccountUsername: 'user123'
        adminAccountPassword: 's0mePass'
        disabledSpecifications: RFC6121,XEP-0030,XEP-0045,XEP-0054,XEP-0060,
                                XEP-0080,XEP-0115,XEP-0118,XEP-0215,XEP-0347,
                                XEP-0363,XEP-0384,XEP-0421

    - name: Stop development release
      if: always()
      uses: ./.github/actions/manage-ejabberd
      with:
        for: dev
        do: stop, check

    - name: View production logs
      if: always()
      uses: ./.github/actions/manage-ejabberd
      with:
        for: prod
        do: logs

    - name: View development logs
      if: always()
      uses: ./.github/actions/manage-ejabberd
      with:
        for: dev
        do: logs

  ##################################################### Common Test Suite #####

  ct:
    needs: compile
    runs-on: ubuntu-24.04-arm
    strategy:
      matrix:
        otp: ['27']
        backend: [agnostic, extauth, ldap, mnesia, mysql, pgsql, redis, sqlite]
        schema: [single, multi]
        exclude:
        - backend: agnostic
          schema: single
        - backend: extauth
          schema: single
        - backend: ldap
          schema: single
        - backend: mnesia
          schema: single
        - backend: redis
          schema: single

    steps:

    - uses: erlef/setup-beam@v1
      with:
        otp-version: ${{ matrix.otp }}
        hexpm-mirrors: |
          https://cdn.jsdelivr.net/hex
          https://builds.hex.pm

    - uses: actions/download-artifact@v7
      with:
        name: compiled-${{ matrix.otp }}
    - run: tar -xf compiled.tar

    - name: Prepare database
      uses: ./.github/actions/manage-database
      with:
        for: ${{ matrix.backend }}
        do: install, start, user, create

    - name: Setup multihost SQL schema
      if: matrix.schema == 'multi'
      run: |
        sed -i 's|multihost_schema, false|multihost_schema, true|g' \
            test/suite.erl

    - name: Run tests
      id: ct
      run: CT_BACKENDS=${{ matrix.backend }} make test

    - name: Send to coveralls
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        DIAGNOSTIC=1 ./rebar3 as test coveralls send

    - name: Check results
      if: always() && (steps.ct.outcome != 'skipped')
      id: ctresults
      run: |
        [[ -d _build ]] && ln -s _build/test/logs/last/ logs || true
        ln `find logs/ -name suite.log` logs/suite.log
        grep 'TEST COMPLETE' logs/suite.log
        grep -q 'TEST COMPLETE,.* 0 failed' logs/suite.log
        test $(find logs/ -empty -name error.log)

    - name: View logs
      if: always()
      run: |
        echo "::group::ejabberd.log"
        find logs/ -name ejabberd.log -exec cat '{}' ';'
        echo "::endgroup::"
        echo "::group::error.log"
        find logs/ -name error.log -exec cat '{}' ';'
        echo "::endgroup::"
        echo "::group::exunit.log"
        find logs/ -name exunit.log -exec cat '{}' ';'
        echo "::endgroup::"
        echo "::group::suite.log (only failures)"
        cat logs/suite.log | awk \
          'BEGIN{RS="\n=case";FS="\n"} /=result\s*failed/ {print "=case" $0}'
        echo "::endgroup::"
        echo "::group::suite.log (complete)"
        cat logs/suite.log
        echo "::endgroup::"

    - name: Upload CT logs
      if: failure()
      uses: actions/upload-artifact@v6
      with:
        name: ct-logs-${{ matrix.otp }}-${{ matrix.backend }}-${{ matrix.schema }}
        path: _build/test/logs
        retention-days: 14

  ############################################################# Coveralls #####

  cover:
    needs: ct
    if: always()
    runs-on: ubuntu-24.04-arm
    steps:
    - name: Finish parallel upload to coveralls
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        curl -v -k https://coveralls.io/webhook \
             --header "Content-Type: application/json" \
             --data '{"repo_name":"$GITHUB_REPOSITORY",
                      "repo_token":"$GITHUB_TOKEN",
                      "payload":{"build_num":$GITHUB_RUN_ID,
                                 "status":"done"}}'

  ################################################################ Schema #####

  schema:
    needs: compile
    runs-on: ubuntu-24.04-arm
    strategy:
      matrix:
        otp: ['27']

    steps:

    - uses: erlef/setup-beam@v1
      with:
        otp-version: ${{ matrix.otp }}
        hexpm-mirrors: |
          https://cdn.jsdelivr.net/hex
          https://builds.hex.pm

    - uses: actions/download-artifact@v7
      with:
        name: compiled-${{ matrix.otp }}
    - run: tar -xf compiled.tar

    ###################################### multi-changed ##

    - name: Prepare databases
      uses: ./.github/actions/manage-database
      with:
        for: mysql, pgsql
        do: install, start, user, create

    - name: Prepare configuration
      run: |
        CT_BACKENDS=mysql,pgsql ./rebar3 ct \
            --suite=test/ejabberd_SUITE --group=configtest_single
        make dev
        cp test/ejabberd_SUITE_data/ejabberd.yml ${{ env.DEV }}/conf/
        cp _build/test/logs/last/*.yml ${{ env.DEV }}/database/
        echo "define_macro: [CONFIGTEST_CONFIG: {modules: {mod_muc: {}}}]" \
             > ${{ env.DEV }}/database/configtest.yml
        cp _build/test/logs/last/*.pem ${{ env.DEV }}/conf/
        cp _build/test/logs/last/*.pem ${{ env.DEV }}/database/

    - name: Run ejabberd
      uses: ./.github/actions/manage-ejabberd
      with:
        for: dev
        do: start, update_sql, stop, check, logs
        username: user2

    - name: Dump multihost databases
      uses: ./.github/actions/manage-database
      with:
        for: mysql, pgsql
        do: dump
        dump-suffix: multi-changed

    ######################################### multi-auto ##

    - name: Prepare databases
      uses: ./.github/actions/manage-database
      with:
        for: mysql, pgsql
        do: drop, create

    - name: Configure multihost schema
      run: |
        sed -i 's|MULTIHOST_SCHEMA|true|g' ${{ env.DEV }}/conf/ejabberd.yml

    - name: Run ejabberd for multihost
      uses: ./.github/actions/manage-ejabberd
      with:
        for: dev
        do: start, stop, check, logs
        username: user2

    - name: Dump multihost databases
      uses: ./.github/actions/manage-database
      with:
        for: mysql, pgsql
        do: dump
        dump-suffix: multi-auto

    ############################################ compare ##

    - name: View SQL schemas (mysql)
      run: |
        perl test/ejabberd_SUITE_data/sql_sort.pl \
             <mysql-multi-auto.sql >mysql-multi2.sql
        perl test/ejabberd_SUITE_data/sql_sort.pl \
             <mysql-multi-changed.sql >mysql-changed2.sql
        echo "::group::differences multi-auto > multi-changed"
        diff -u mysql-multi2.sql mysql-changed2.sql || echo ok
        echo "::endgroup::"
        echo "::group::multi-auto.sql"
        cat mysql-multi-auto.sql
        echo "::endgroup::"
        echo "::group::multi-changed.sql"
        cat mysql-multi-changed.sql
        echo "::endgroup::"

    - name: View SQL schemas (pgsql)
      run: |
        perl test/ejabberd_SUITE_data/sql_sort.pl \
             <pgsql-multi-auto.sql >pgsql-multi2.sql
        perl test/ejabberd_SUITE_data/sql_sort.pl \
             <pgsql-multi-changed.sql >pgsql-changed2.sql
        echo "::group::differences (multi-auto > multi-changed)"
        diff -u pgsql-multi2.sql pgsql-changed2.sql || echo ok
        echo "::endgroup::"
        echo "::group::multi-auto.sql"
        cat pgsql-multi-auto.sql
        echo "::endgroup::"
        echo "::group::multi-changed.sql"
        cat pgsql-multi-changed.sql
        echo "::endgroup::"

    - name: View ejabberd logs
      if: always()
      uses: ./.github/actions/manage-ejabberd
      with:
        for: dev
        do: logs