25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Update Github Action workflows: Ubuntu 18 is deprecated and 22 is added

CI:
- Update Ubuntu to 20.04, the lowest available starting in April 2023 [1]
- Don't test 19.3, as it isn't available in Ubuntu 20.04
- Use OTP 25 for Shellcheck, Coveralls, ECIL page
- Use erlef instead of ErlGang, supports better old erlangs in new ubuntus
- Remove support for rebar2 testing, as that's done in Runtime

CI-19.3:
- Add a temporary workflow for testing ejabberd with OTP 19.3

Container and Runtime:
- Update Ubuntu to latest (22.04)

[1] https://github.com/actions/runner-images/issues/6002
https://github.com/ErlGang/setup-erlang
https://github.com/erlef/setup-beam
This commit is contained in:
Badlop 2022-09-02 11:28:02 +02:00
parent f624b14636
commit 9a3ba9d76f
4 changed files with 251 additions and 57 deletions

229
.github/workflows/ci-19.3.yml vendored Normal file
View File

@ -0,0 +1,229 @@
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 '{}' ';'

View File

@ -25,18 +25,8 @@ jobs:
strategy:
fail-fast: false
matrix:
otp: ['19.3', '24', '25.0']
include:
- otp: '19.3'
rebar: 2
os: ubuntu-18.04
- otp: '24'
rebar: 3
os: ubuntu-20.04
- otp: '25.0'
rebar: 3
os: ubuntu-20.04
runs-on: ${{ matrix.os }}
otp: ['20.0', '21.3', '24.3', '25']
runs-on: ubuntu-20.04
services:
redis:
image: redis
@ -48,7 +38,7 @@ jobs:
- uses: actions/checkout@v3
- name: Test shell scripts
if: matrix.otp == 24
if: matrix.otp == 25
run: |
shellcheck test/ejabberd_SUITE_data/gencerts.sh
shellcheck tools/captcha.sh
@ -56,17 +46,17 @@ jobs:
shellcheck -x ejabberdctl.template
- name: Get specific Erlang/OTP
uses: ErlGang/setup-erlang@master
if: matrix.otp != 24
if: matrix.otp != 25
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
- name: Get a compatible Rebar
if: matrix.rebar == 2
- name: Get a compatible Rebar3
if: matrix.otp <= '21.3'
run: |
rm rebar
wget https://github.com/processone/ejabberd/raw/21.12/rebar
chmod +x rebar
rm rebar3
wget https://github.com/processone/ejabberd/raw/21.12/rebar3
chmod +x rebar3
- name: Prepare databases
run: |
@ -120,14 +110,11 @@ jobs:
uses: actions/cache@v3
with:
path: |
deps/
dialyzer/
ebin/
~/.cache/rebar3/
key: ${{matrix.otp}}-${{matrix.rebar}}-${{hashFiles('rebar.config')}}
key: ${{matrix.otp}}-${{hashFiles('rebar.config')}}
- name: Download test logs
if: matrix.otp == 24 && github.repository == 'processone/ejabberd'
if: matrix.otp == 25 && github.repository == 'processone/ejabberd'
continue-on-error: true
run: |
mkdir -p _build/test
@ -138,8 +125,7 @@ jobs:
- name: Compile
run: |
./autogen.sh
[[ ${{ matrix.rebar }} = 2 ]] && REBAR=rebar || REBAR=`which rebar3`
./configure --with-rebar=$REBAR \
./configure --with-rebar=./rebar3 \
--prefix=/tmp/ejabberd \
--enable-all \
--disable-elixir \
@ -152,13 +138,9 @@ jobs:
- run: make hooks
- run: make options
- run: make xref
- run: |
make dialyzer
[ ${{ matrix.rebar }} = 3 ] && true \
|| { cat dialyzer/error.log ; test ! -s dialyzer/error.log ; }
- run: make dialyzer
- name: Check Production Release
if: matrix.rebar == 3
run: |
make rel
RE=_build/prod/rel/ejabberd
@ -170,7 +152,6 @@ jobs:
grep -q "is stopped in" $RE/logs/ejabberd.log
- name: Check Development Release
if: matrix.rebar == 3
run: |
make dev
RE=_build/dev/rel/ejabberd
@ -181,12 +162,7 @@ jobs:
cat $RE/logs/ejabberd.log
grep -q "is stopped in" $RE/logs/ejabberd.log
- name: Run tests (OTP 19.3)
if: matrix.otp == '19.3'
id: ct2
run: make test
- name: Run tests
if: matrix.otp != '19.3'
id: ct
run: |
(cd priv && ln -sf ../sql)
@ -195,8 +171,8 @@ jobs:
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
./rebar3 ct --name $NODENAME --label "$LABEL"
./rebar3 cover
- name: Check results
if: always() && (steps.ct.outcome != 'skipped' || steps.ct2.outcome != 'skipped')
@ -217,11 +193,11 @@ jobs:
find logs/ -name exunit.log -exec cat '{}' ';'
- name: Send to coveralls
if: matrix.otp == 24
if: matrix.otp == 25
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DIAGNOSTIC=1 rebar3 as test coveralls send
DIAGNOSTIC=1 ./rebar3 as test coveralls send
curl -v -k https://coveralls.io/webhook \
--header "Content-Type: application/json" \
--data '{"repo_name":"$GITHUB_REPOSITORY",

View File

@ -17,7 +17,7 @@ env:
jobs:
container:
name: Container
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
permissions:
packages: write
steps:

View File

@ -31,20 +31,9 @@ jobs:
strategy:
fail-fast: false
matrix:
otp: ['19.3', '21.3', '22.0', '24.3', '25']
otp: ['19.3', '20.3', '24.3', '25']
rebar: ['rebar', 'rebar3']
include:
- otp: '19.3'
os: ubuntu-18.04
- otp: '21.3'
os: ubuntu-20.04
- otp: '22.0'
os: ubuntu-20.04
- otp: '24.3'
os: ubuntu-20.04
- otp: '25'
os: ubuntu-20.04
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
container:
image: erlang:${{ matrix.otp }}
@ -132,7 +121,7 @@ jobs:
elixir: '1.11.4'
- otp: '25.0'
elixir: '1.12.3'
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps: