Skip to content

Great invitations #1269

Great invitations

Great invitations #1269

Workflow file for this run

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@v4
with:
path: |
~/.cache/rebar3/
_build/default/lib/
key: ci-${{ matrix.otp }}-${{hashFiles('rebar.config')}}
- name: Compile
run: |
./autogen.sh
./configure --with-rebar=./rebar3 \
--prefix=/tmp/ejabberd \
--enable-all \
--disable-elixir
sed -i 's|, syntax_tools||g' src/ejabberd.app.src.script
make
tar -cvf /tmp/compiled.tar .
- uses: actions/upload-artifact@v5
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@v6
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@v6
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/[email protected]
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@v6
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@v5
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@v6
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, logs, check
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, logs, check
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