b7940ba360
* Not up-to-date jsdelivr takes some days or weeks to get latest erlang versions, compare https://builds.hex.pm/builds/otp/arm64/ubuntu-24.04/builds.txt https://cdn.jsdelivr.net/hex/builds/otp/arm64/ubuntu-24.04/builds.txt * Unnecessary As builds.hex.pm is already geodistributed, there's no need to add mirror Reference: https://www.hex.pm/docs/mirrors * Problematic in parallel jobs The ci.yml workflow is split in separate jobs that run in parallel, and all of them must use the exact same erlang version. When using mirrors, different erlang versions may be used... and then the compiled files require more recompilation, which fail ===> Compiling /home/runner/work/ejabberd/ejabberd/c_src/epam.c ===> /home/runner/work/ejabberd/ejabberd/c_src/epam.c:18:10: fatal error: security/pam_appl.h: No such file or directory 18 | #include <security/pam_appl.h> | ^~~~~~~~~~~~~~~~~~~~~ Instead of removing mirrors, an alternative solution would be to specify exact OTP version: "28.3.2", but then we would need to update all those strings in ci.yml for every erlang release.
418 lines
11 KiB
YAML
418 lines
11 KiB
YAML
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: ['28']
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v6
|
|
|
|
- uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: ${{ matrix.otp }}
|
|
|
|
- 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.*')}}
|
|
|
|
- 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: ['28']
|
|
|
|
steps:
|
|
|
|
- uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: ${{ matrix.otp }}
|
|
|
|
- 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 testeunit
|
|
- 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: ['28']
|
|
|
|
steps:
|
|
|
|
- uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: ${{ matrix.otp }}
|
|
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
if: matrix.otp < '28'
|
|
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 == '28'
|
|
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: ['28']
|
|
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 }}
|
|
|
|
- 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
|
|
continue-on-error: true
|
|
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
|
|
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: ['28']
|
|
|
|
steps:
|
|
|
|
- uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: ${{ matrix.otp }}
|
|
|
|
- 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
|