Merge pull request #2123 from profanity-im/ci

ci: Cleanup and improve CI jobs
This commit is contained in:
Michael Vetter
2026-03-20 15:09:31 +01:00
committed by GitHub
17 changed files with 158 additions and 205 deletions

View File

@@ -1,49 +0,0 @@
image: openbsd/7.0
packages:
- gcc-11.2.0p0
- cmake
- gmake
- cmocka
- libtool
- automake-1.16.3
- pkgconf
- readline
- python-3.8.12
- autoconf-2.69p3
- autoconf-archive
- curl
- gpgme
- glib2
- gtk+2
- libotr
- libassuan
- libgpg-error
- libgcrypt
- libsignal-protocol-c
- sqlite3
sources:
- https://github.com/strophe/libstrophe.git#0.11.0
- https://github.com/profanity-im/profanity
environment:
LANG: en_US.UTF-8
tasks:
- symlink: |
doas ln -sf /usr/local/bin/python3 /usr/local/bin/python
doas ln -sf /usr/local/bin/python3-config /usr/local/bin/python-config
doas ln -sf /usr/local/bin/pydoc3 /usr/local/bin/pydoc
- build: |
export AUTOCONF_VERSION=2.69
export AUTOMAKE_VERSION=1.16
cd ~/libstrophe
./bootstrap.sh
./configure
make
doas make install
cd ~/profanity
./ci-build.sh

10
.gitattributes vendored Normal file
View File

@@ -0,0 +1,10 @@
# Pattern Attribute
.clang-format export-ignore
.codespellrc export-ignore
.git-blame-ignore-revs export-ignore
.github/* export-ignore
CONTRIBUTING.md export-ignore
RELEASE_GUIDE.md export-ignore
ci/* export-ignore
prof.supp export-ignore
scripts/* export-ignore

View File

@@ -8,6 +8,7 @@ on:
jobs:
cygwin-build:
name: build only
runs-on: windows-latest
env:
CYGWIN: winsymlinks:nativestrict

View File

@@ -1,4 +1,4 @@
name: CI
name: Linux
on:
push:
@@ -11,67 +11,46 @@ concurrency:
cancel-in-progress: true
jobs:
linux:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flavor: [debian, fedora, ubuntu]
include:
- flavor: debian
buildsystem: autotools
tests: unit
omemo: signal
script: ./ci/ci-build.sh
- flavor: fedora
buildsystem: autotools
tests: unit
omemo: signal
script: ./ci/ci-build.sh
- flavor: ubuntu
buildsystem: autotools
tests: unit
omemo: signal
script: ./ci/ci-build.sh
- flavor: debian
buildsystem: meson
tests: unit
omemo: signal
script: ./ci/ci-meson-build.sh
omemo_env: libsignal
- flavor: debian
buildsystem: meson
tests: unit
omemo: libomemo
script: ./ci/ci-meson-build.sh
omemo_env: libomemo-c
name: Linux
steps:
- uses: actions/checkout@v2
- name: Run tests
run: |
docker build -f Dockerfile.${{ matrix.flavor }} -t profanity .
docker run profanity ./ci-build.sh
linux-meson:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [debian]
name: Linux-meson
name: ${{ matrix.flavor }} | ${{ matrix.buildsystem }} | ${{ matrix.tests }} | ${{ matrix.omemo }}
steps:
- uses: actions/checkout@v2
- name: Run tests
env:
OMEMO_BACKEND: libomemo-c
OMEMO_BACKEND: ${{ matrix.omemo_env }}
run: |
docker build -f Dockerfile.${{ matrix.flavor }} -t profanity .
docker run -e OMEMO_BACKEND profanity ./ci-meson-build.sh
code-style:
runs-on: ubuntu-22.04
name: Check coding style
continue-on-error: true
steps:
- uses: actions/checkout@v2
# if this check fails, you have to update the number of auto types known and the list of auto types in the check below
- name: Check auto types are up-to-date
run: |
[[ "$(find src -type f -name '*.[ch]' -exec awk '/^#define auto_[\W]*/ {print $2}' '{}' \; | sort -u | wc -l)" == "9" ]] || exit -1
- name: Check auto types are initialized
run: |
grep -P 'auto_(char|gchar|gcharv|gerror|guchar|jid|sqlite|gfd|FILE)[\w *]*;$' -r src && exit -1 || true
- name: Run clang-format
uses: jidicula/clang-format-action@v4.16.0
with:
clang-format-version: '21'
check-path: 'src'
spell-check:
runs-on: ubuntu-22.04
name: Check spelling
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends codespell
- name: Check spelling
run: |
codespell
docker build -f ci/Dockerfile.${{ matrix.flavor }} -t profanity .
docker run ${OMEMO_BACKEND:+ -e OMEMO_BACKEND} profanity ${{ matrix.script }}

45
.github/workflows/style.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Style
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
code-style:
runs-on: ubuntu-22.04
name: coding style
continue-on-error: true
steps:
- uses: actions/checkout@v2
# if this check fails, you have to update the number of auto types known and the list of auto types in the check below
- name: Check auto types are up-to-date
run: |
[[ "$(find src -type f -name '*.[ch]' -exec awk '/^#define auto_[\W]*/ {print $2}' '{}' \; | sort -u | wc -l)" == "9" ]] || exit -1
- name: Check auto types are initialized
run: |
grep -P 'auto_(char|gchar|gcharv|gerror|guchar|jid|sqlite|gfd|FILE)[\w *]*;$' -r src && exit -1 || true
- name: Run clang-format
uses: jidicula/clang-format-action@v4.16.0
with:
clang-format-version: '21'
check-path: 'src'
spell-check:
runs-on: ubuntu-22.04
name: spellcheck
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends codespell
- name: Check spelling
run: |
codespell

View File

@@ -1,22 +0,0 @@
brew 'autoconf'
brew 'autoconf-archive'
brew 'automake'
brew 'check'
brew 'cmocka'
brew 'curl'
brew 'expat'
brew 'glib'
brew 'gnutls'
brew 'gpgme'
brew 'gtk+'
brew 'libffi'
brew 'libotr'
brew 'libsignal-protocol-c'
brew 'libstrophe'
brew 'libtool'
brew 'ncurses'
brew 'openssl'
brew 'ossp-uuid'
brew 'pkg-config'
brew 'readline'
brew 'sqlite'

View File

@@ -48,7 +48,7 @@ meson setup build_run -Domemo=enabled -Domemo-backend=libomemo-c
3. Run: `./build_run/profanity`
We also have a [build section](https://profanity-im.github.io/guide/latest/build.html) in our user guide.
You might also take a look at the `Dockerfile.*` in the root directory.
You might also take a look at the `Dockerfile.*` in the `ci` directory.
## Submitting patches
We recommend for people to always work on a dedicated git branch for each fix or feature.
@@ -114,6 +114,18 @@ See-also: https://xmpp.org/extensions/xep-0384.html
Co-authored-by: Another Dev <dev@example.com>
```
### Developer Certificate of Origin (DCO)
To ensure that all contributions are legally cleared for inclusion in the project, **all commits must be signed-off**.
By signing off your commits, you certify that you have the right to submit the code under the project's license (GPL-3.0-or-later). This is a standard industry practice to protect both the project and its contributors.
#### How to Sign-Off Your Commits
Simply add the `-s` flag when committing:
```bash
git commit -s -m "Message"
```
This will append a `Signed-off-by: Your Name <your.email@example.com>` line to the end of your commit message.
### GitHub
We would like to encourage people to use GitHub to create pull requests.
It makes it easy for us to review the patches, track WIP branches, organize branches with labels and milestones,
@@ -180,7 +192,7 @@ snippet to `.git/hooks/pre-push`:
```shell
#!/bin/sh
set -e
./ci-build.sh
./ci/ci-build.sh
```
This will run the same tests that the CI runs and refuse the push if it fails.
@@ -202,7 +214,7 @@ In cases where you want to disable automatic formatting for a specific block of
## Verification & Testing
### Running unit tests
Run `make check` to run the unit tests with your current configuration or `./ci-build.sh` to check with different switches passed to configure.
Run `make check` to run the unit tests with your current configuration or `./ci/ci-build.sh` to check with different switches passed to configure.
### Writing unit tests
We use the [cmocka](https://cmocka.org/) testing framework for unit tests.

View File

@@ -17,7 +17,6 @@ RUN pacman -Syu --noconfirm && pacman -S --needed --noconfirm \
gpgme \
gtk2 \
libgcrypt \
libmicrohttpd \
libnotify \
libsignal-protocol-c \
libomemo-c \
@@ -34,7 +33,7 @@ RUN pacman -Syu --noconfirm && pacman -S --needed --noconfirm \
gdk-pixbuf2 \
qrencode
RUN mkdir -p /usr/src/{stabber,profanity}
RUN mkdir -p /usr/src/profanity
RUN useradd -mb /usr/src --shell=/bin/false aur && usermod -L aur
USER aur
@@ -54,14 +53,5 @@ USER root
RUN pacman -U --noconfirm libstrophe-git/libstrophe-git-*.pkg.tar.zst
WORKDIR /usr/src
#RUN git clone https://github.com/boothj5/stabber
#WORKDIR /usr/src/stabber
#RUN ./bootstrap.sh
#RUN ./configure --prefix=/usr --disable-dependency-tracking
#RUN make
#RUN make install
WORKDIR /usr/src/profanity
COPY . /usr/src/profanity

View File

@@ -39,14 +39,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN mkdir -p /usr/src/{stabber,libstrophe,profanity}
WORKDIR /usr/src
#RUN git clone https://github.com/boothj5/stabber
RUN git clone -c http.sslverify=false https://github.com/profanity-im/stabber
RUN git clone -c http.sslverify=false https://github.com/strophe/libstrophe
#WORKDIR /usr/src/stabber
#RUN ./bootstrap.sh
#RUN ./configure --prefix=/usr --disable-dependency-tracking
#RUN make
#RUN make install
WORKDIR /usr/src/stabber
RUN ./bootstrap.sh
RUN ./configure --prefix=/usr --disable-dependency-tracking
RUN make
RUN make install
WORKDIR /usr/src/libstrophe
RUN ./bootstrap.sh

View File

@@ -1,15 +1,12 @@
# Build the latest Fedora image
FROM fedora:latest
# expect - for functional tests
# libmicrohttpd - for stabber
# glibc-locale - to have en_US locale
RUN dnf install -y \
autoconf \
autoconf-archive \
automake \
awk \
expect-devel \
gcc \
git \
glib2-devel \
@@ -21,7 +18,6 @@ RUN dnf install -y \
expat-devel \
libgcrypt-devel \
gpgme-devel \
libmicrohttpd-devel \
libnotify-devel \
libotr-devel \
libsignal-protocol-c-devel \
@@ -47,15 +43,6 @@ ENV LC_ALL en_US.UTF-8
RUN mkdir -p /usr/src
WORKDIR /usr/src
#RUN mkdir -p /usr/src/stabber
#RUN git clone https://github.com/boothj5/stabber
#WORKDIR /usr/src/stabber
#RUN ./bootstrap.sh
#RUN ./configure --prefix=/usr --disable-dependency-tracking
#RUN make
#RUN make install
WORKDIR /usr/src
RUN mkdir -p /usr/src/libstrophe
RUN git clone -c http.sslverify=false https://github.com/strophe/libstrophe
WORKDIR /usr/src/libstrophe

View File

@@ -1,14 +1,11 @@
# Build the latest openSUSE Tumbleweed image
FROM opensuse/tumbleweed
# expect - for functional tests
# libmicrohttpd - for stabber
# glibc-locale - to have en_US locale
RUN zypper --non-interactive in --no-recommends \
autoconf \
autoconf-archive \
automake \
expect-devel \
gcc \
git \
glib2-devel \
@@ -21,7 +18,6 @@ RUN zypper --non-interactive in --no-recommends \
libgcrypt-devel \
libgpgme-devel \
libstrophe-devel \
libmicrohttpd-devel \
libnotify-devel \
libotr-devel \
libsignal-protocol-c-devel \
@@ -46,14 +42,6 @@ ENV LC_ALL en_US.UTF-8
RUN mkdir -p /usr/src
WORKDIR /usr/src
#RUN mkdir -p /usr/src/stabber
#RUN git clone git://github.com/boothj5/stabber.git
#WORKDIR /usr/src/stabber
#RUN ./bootstrap.sh
#RUN ./configure --prefix=/usr --disable-dependency-tracking
#RUN make
#RUN make install
RUN mkdir -p /usr/src/profanity
WORKDIR /usr/src/profanity
COPY . /usr/src/profanity

View File

@@ -6,7 +6,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
autoconf-archive \
automake \
expect \
gcc \
git \
libcmocka-dev \
@@ -15,7 +14,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libglib2.0-dev \
libgpgme11-dev \
libgtk2.0-dev \
libmicrohttpd-dev \
libncursesw5-dev \
libnotify-dev \
libotr5-dev \
@@ -34,19 +32,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libgdk-pixbuf-2.0-dev \
libqrencode-dev
RUN mkdir -p /usr/src/{stabber,libstrophe,profanity}
RUN mkdir -p /usr/src/{libstrophe,profanity}
WORKDIR /usr/src
#RUN git clone https://github.com/boothj5/stabber
RUN git clone -c http.sslverify=false https://github.com/strophe/libstrophe
# TODO: Re-enable once libmicrohttpd-dev has been updated.
#WORKDIR /usr/src/stabber
#RUN ./bootstrap.sh
#RUN ./configure --prefix=/usr --disable-dependency-tracking
#RUN make
#RUN make install
WORKDIR /usr/src/libstrophe
RUN ./bootstrap.sh
RUN ./configure --prefix=/usr

View File

@@ -3,8 +3,12 @@
log_content()
{
echo
echo "Content of $1:"
cat "$1"
if [ -f "$1" ]; then
echo "Content of $1:"
cat "$1"
else
echo "Log file $1 not found."
fi
}
error_handler()
@@ -121,18 +125,14 @@ esac
case "$ARCH" in
linux*)
echo
echo "--> Building with ./configure ${tests[0]} --enable-valgrind $*"
echo "--> Building with ./configure ${tests[0]} --enable-valgrind --disable-functional-tests $*"
echo
# shellcheck disable=SC2086
./configure ${tests[0]} --enable-valgrind $*
./configure ${tests[0]} --enable-valgrind --disable-functional-tests $*
$MAKE CC="${CC}"
if grep '^ID=' /etc/os-release | grep -q -e debian; then
$MAKE check-valgrind
else
$MAKE check-valgrind || log_content ./test-suite-memcheck.log
fi
$MAKE check-valgrind
$MAKE distclean
;;
esac
@@ -140,14 +140,14 @@ esac
for features in "${tests[@]}"
do
echo
echo "--> Building with ./configure ${features} $*"
echo "--> Building with ./configure ${features} --disable-functional-tests $*"
echo
# shellcheck disable=SC2086
./configure $features $*
./configure $features --disable-functional-tests $*
$MAKE CC="${CC}"
$MAKE check
$MAKE check-unit
./profanity -v
$MAKE clean

View File

@@ -9,10 +9,12 @@ error_handler()
echo
echo "Error ${ERR_CODE} with command '${BASH_COMMAND}' on line ${BASH_LINENO[0]}. Exiting."
# Meson logs are stored in the build directory
if [ -f "build/meson-logs/testlog.txt" ]; then
echo "--- Meson Test Log ---"
cat build/meson-logs/testlog.txt
fi
for log in build_run/meson-logs/testlog.txt build_valgrind/meson-logs/testlog.txt; do
if [ -f "$log" ]; then
echo "--- Meson Test Log ($log) ---"
cat "$log"
fi
done
exit ${ERR_CODE}
}
@@ -47,7 +49,7 @@ if [[ "$(uname | tr '[:upper:]' '[:lower:]')" == linux* ]]; then
meson setup build_valgrind ${tests[0]} ${BACKEND_OPT} -Dtests=true -Db_sanitize=address,undefined
meson compile -C build_valgrind
meson test -C build_valgrind --print-errorlogs --wrap=valgrind || echo "Valgrind issues detected"
meson test -C build_valgrind "unit tests" --print-errorlogs --wrap=valgrind || echo "Valgrind issues detected"
rm -rf build_valgrind
fi
@@ -64,7 +66,7 @@ do
meson setup build_run ${features} ${BACKEND_OPT} -Dtests=true
meson compile -C build_run
meson test -C build_run --print-errorlogs
meson test -C build_run "unit tests" --print-errorlogs
./build_run/profanity -v
done

View File

@@ -73,6 +73,8 @@ AC_ARG_ENABLE([gdk-pixbuf],
[AS_HELP_STRING([--enable-gdk-pixbuf], [enable GDK Pixbuf support to scale avatars before uploading])])
AC_ARG_ENABLE([omemo-qrcode],
[AS_HELP_STRING([--enable-omemo-qrcode], [enable ability to display omemo qr code])])
AC_ARG_ENABLE([functional-tests],
[AS_HELP_STRING([--enable-functional-tests], [enable functional tests (default auto)])])
m4_include([m4/ax_valgrind_check.m4])
AX_VALGRIND_DFLT([drd], [off])
@@ -389,11 +391,18 @@ PKG_CHECK_MODULES([cmocka], [cmocka], [],
[AC_MSG_NOTICE([cmocka is not found, will not be able to run tests])])
AM_CONDITIONAL([HAVE_STABBER], [false])
AC_CHECK_LIB([stabber], [stbbr_start], [AM_CONDITIONAL([HAVE_STABBER], [true])],
[AC_MSG_NOTICE([libstabber not found, will not be able to run functional tests])])
AM_CONDITIONAL([HAVE_UTIL], [false])
AC_CHECK_LIB([util], [forkpty], [AM_CONDITIONAL([HAVE_UTIL], [true])],
[AC_MSG_NOTICE([libutil not found, will not be able to run functional tests])])
if test "x$enable_functional_tests" != xno; then
AC_CHECK_LIB([stabber], [stbbr_start], [AM_CONDITIONAL([HAVE_STABBER], [true])],
[AS_IF([test "x$enable_functional_tests" = xyes],
[AC_MSG_ERROR([libstabber not found, but functional tests were explicitly enabled])],
[AC_MSG_NOTICE([libstabber not found, will not be able to run functional tests])])])
AC_CHECK_LIB([util], [forkpty], [AM_CONDITIONAL([HAVE_UTIL], [true])],
[AS_IF([test "x$enable_functional_tests" = xyes],
[AC_MSG_ERROR([libutil not found, but functional tests were explicitly enabled])],
[AC_MSG_NOTICE([libutil not found, will not be able to run functional tests])])])
fi
## Default parameters
AM_CFLAGS="$AM_CFLAGS -Wall -Wno-deprecated-declarations -std=gnu99 -ggdb3"

View File

@@ -2652,3 +2652,12 @@
fun:calloc
fun:_dl_allocate_tls
}
# glibc/avx2 false positives
{
g_utf8_collate_key_invalid_read_avx2
Memcheck:Addr32
fun:__wcpncpy_avx2
fun:wcsxfrm_l
fun:g_utf8_collate_key
}

View File

@@ -86,6 +86,7 @@ _pendingPresence_free(ProfPendingPresence* presence)
if (presence->last_activity)
g_date_time_unref(presence->last_activity);
free(presence->barejid);
resource_destroy(presence->resource);
free(presence);
}
@@ -685,6 +686,7 @@ roster_process_pending_presence(void)
for (iter = roster_pending_presence; iter != NULL; iter = iter->next) {
ProfPendingPresence* presence = iter->data;
roster_update_presence(presence->barejid, presence->resource, presence->last_activity);
presence->resource = NULL;
}
g_slist_free_full(roster_pending_presence, (GDestroyNotify)_pendingPresence_free);