name: CI (19.3) on: push: paths-ignore: - '.devcontainer/**' - 'examples/**' - 'lib/**' - 'man/**' - 'priv/**' - '**.md' pull_request: paths-ignore: - '.devcontainer/**' - 'examples/**' - 'lib/**' - 'man/**' - 'priv/**' - '**.md' jobs: tests: name: Tests strategy: fail-fast: false matrix: otp: ['19.3'] runs-on: ubuntu-18.04 services: redis: image: redis ports: - 6379:6379 steps: - uses: actions/checkout@v3 - name: Get specific Erlang/OTP uses: erlef/setup-beam@v1 with: otp-version: ${{ matrix.otp }} - name: Get a compatible Rebar3 run: | rm rebar3 wget https://github.com/processone/ejabberd/raw/21.12/rebar3 chmod +x rebar3 - name: Prepare databases run: | sudo systemctl start mysql.service sudo systemctl start postgresql.service mysql -u root -proot -e "CREATE USER 'ejabberd_test'@'localhost' IDENTIFIED BY 'ejabberd_test';" mysql -u root -proot -e "CREATE DATABASE ejabberd_test;" mysql -u root -proot -e "GRANT ALL ON ejabberd_test.* TO 'ejabberd_test'@'localhost';" mysql -u root -proot ejabberd_test < sql/mysql.sql pg_isready sudo -u postgres psql -c "CREATE USER ejabberd_test WITH PASSWORD 'ejabberd_test';" sudo -u postgres psql -c "CREATE DATABASE ejabberd_test;" sudo -u postgres psql ejabberd_test -f sql/pg.sql sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE ejabberd_test TO ejabberd_test;" sudo -u postgres psql ejabberd_test -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ejabberd_test;" sudo -u postgres psql ejabberd_test -c "GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO ejabberd_test;" - name: Prepare libraries run: | sudo apt-get -qq update sudo apt-get -y purge libgd3 nginx sudo apt-get -qq install libexpat1-dev libgd-dev libpam0g-dev \ libsqlite3-dev libwebp-dev libyaml-dev - name: Prepare rebar run: | echo '{xref_ignores, [{eldap_filter_yecc, return_error, 2} ]}.' >>rebar.config echo '{xref_checks, [deprecated_function_calls, deprecated_functions, locals_not_used, undefined_function_calls, undefined_functions]}. % Disabled: exports_not_used,' >>rebar.config echo '{dialyzer, [{get_warnings, true}, {plt_extra_apps, [cache_tab, eimp, epam, esip, ezlib, fast_tls, fast_xml, fast_yaml, mqtree, p1_acme, p1_mysql, p1_oauth2, p1_pgsql, p1_utils, pkix, sqlite3, stringprep, stun, xmpp, yconf]} ]}.' >>rebar.config echo '{ct_extra_params, "-verbosity 20"}.' >>rebar.config echo "{ct_opts, [{verbosity, 20}, {keep_logs, 20}]}." >>rebar.config - name: Remove syntax_tools from release run: sed -i 's|, syntax_tools||g' src/ejabberd.app.src.script - name: Cache rebar uses: actions/cache@v3 with: path: | ~/.cache/rebar3/ key: ${{matrix.otp}}-${{hashFiles('rebar.config')}} - name: Compile run: | ./autogen.sh ./configure --with-rebar=./rebar3 \ --prefix=/tmp/ejabberd \ --enable-all \ --disable-elixir \ --disable-mssql \ --disable-odbc make update make - run: make install -s - run: make hooks - run: make options - run: make xref - run: make dialyzer - name: Check Production Release run: | make rel RE=_build/prod/rel/ejabberd $RE/bin/ejabberdctl start $RE/bin/ejabberdctl started $RE/bin/ejabberdctl stop $RE/bin/ejabberdctl stopped cat $RE/logs/ejabberd.log grep -q "is stopped in" $RE/logs/ejabberd.log - name: Check Development Release run: | make dev RE=_build/dev/rel/ejabberd $RE/bin/ejabberdctl start $RE/bin/ejabberdctl started $RE/bin/ejabberdctl stop $RE/bin/ejabberdctl stopped cat $RE/logs/ejabberd.log grep -q "is stopped in" $RE/logs/ejabberd.log - name: Run tests id: ct run: | (cd priv && ln -sf ../sql) COMMIT=`echo $GITHUB_SHA | cut -c 1-7` DATE=`date +%s` REF_NAME=`echo $GITHUB_REF_NAME | tr "/" "_"` NODENAME=$DATE@$GITHUB_RUN_NUMBER-$GITHUB_ACTOR-$REF_NAME-$COMMIT LABEL=`git show -s --format=%s | cut -c 1-30` ./rebar3 ct --name $NODENAME --label "$LABEL" ./rebar3 cover - name: Check results if: always() && (steps.ct.outcome != 'skipped' || steps.ct2.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 failures if: failure() && steps.ctresults.outcome == 'failure' run: | cat logs/suite.log | awk \ 'BEGIN{RS="\n=case";FS="\n"} /=result\s*failed/ {print "=case" $0}' find logs/ -name error.log -exec cat '{}' ';' find logs/ -name exunit.log -exec cat '{}' ';' - name: Upload test logs if: always() && steps.ct.outcome == 'failure' && github.repository == 'processone/ejabberd' uses: peaceiris/actions-gh-pages@v3 with: publish_dir: _build/test exclude_assets: '.github,lib,plugins' external_repository: processone/ecil deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} keep_files: true - name: View ECIL address if: always() && steps.ct.outcome == 'failure' && github.repository == 'processone/ejabberd' run: | CTRUN=`ls -la _build/test/logs/last | sed 's|.*-> ||'` echo "::notice::View CT results: https://processone.github.io/ecil/logs/$CTRUN/" - name: Prepare new schema run: | [[ -d logs ]] && rm -rf logs [[ -d _build/test/logs ]] && rm -rf _build/test/logs || true mysql -u root -proot -e "DROP DATABASE ejabberd_test;" sudo -u postgres psql -c "DROP DATABASE ejabberd_test;" mysql -u root -proot -e "CREATE DATABASE ejabberd_test;" mysql -u root -proot -e "GRANT ALL ON ejabberd_test.* TO 'ejabberd_test'@'localhost';" mysql -u root -proot ejabberd_test < sql/mysql.new.sql sudo -u postgres psql -c "CREATE DATABASE ejabberd_test;" sudo -u postgres psql ejabberd_test -f sql/pg.new.sql sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE ejabberd_test TO ejabberd_test;" sudo -u postgres psql ejabberd_test -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ejabberd_test;" sudo -u postgres psql ejabberd_test -c "GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO ejabberd_test;" sed -i 's|new_schema, false|new_schema, true|g' test/suite.erl - run: CT_BACKENDS=mysql,pgsql make test id: ctnewschema - name: Check results if: always() && steps.ctnewschema.outcome != 'skipped' 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 failures if: failure() && steps.ctnewschema.outcome != 'skipped' run: | cat logs/suite.log | awk \ 'BEGIN{RS="\n=case";FS="\n"} /=result\s*failed/ {print "=case" $0}' find logs/ -name error.log -exec cat '{}' ';' find logs/ -name exunit.log -exec cat '{}' ';'