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

View File

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

View File

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