From af70c3d660f066220d221c7fe24e3dde96e4d865 Mon Sep 17 00:00:00 2001 From: iphydf Date: Fri, 26 Nov 2021 22:21:18 +0000 Subject: [PATCH 1/3] chore: Remove travis; add cirrus ci. We still need a GitHub workflow to test the "make" build. For now, we only test toktok-stack and the bazel build. --- .cirrus.yml | 13 ++++++++++ .github/settings.yml | 5 ++-- .travis.yml | 60 -------------------------------------------- src/api.c | 2 +- 4 files changed, 16 insertions(+), 64 deletions(-) create mode 100644 .cirrus.yml delete mode 100644 .travis.yml diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 0000000..80b3883 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,13 @@ +--- +cirrus-ci_task: + container: + image: toxchat/toktok-stack:0.0.13 + cpu: 2 + memory: 2G + configure_script: + - /src/workspace/tools/inject-repo toxic + test_all_script: + - bazel test -k + --remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST + --config=release + //toxic/... diff --git a/.github/settings.yml b/.github/settings.yml index 5ce3d66..9074d0f 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -11,7 +11,6 @@ branches: protection: required_status_checks: contexts: - - Codacy/PR Quality Review - - CodeFactor - - Travis CI - Pull Request + - cirrus-ci + - Codacy Static Code Analysis - code-review/reviewable diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1019832..0000000 --- a/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -language: python -python: nightly -dist: xenial -os: linux - -jobs: - include: - - env: JOB=linux - - addons: - apt: - packages: - - libalut-dev - - libconfig-dev - - libnotify-dev - - libopenal-dev - - libopus-dev - - libqrencode-dev - - libvpx-dev - - cache: - directories: - - $HOME/cache - - install: - # Where to find libraries. - - export LD_LIBRARY_PATH=$HOME/cache/usr/lib - - export PKG_CONFIG_PATH=$HOME/cache/usr/lib/pkgconfig - # c-sodium - - git clone --depth=1 --branch=stable https://github.com/jedisct1/libsodium ../libsodium - - test -f $HOME/cache/usr/lib/libsodium.so || (cd ../libsodium && ./configure --prefix=$HOME/cache/usr && make install -j$(nproc)) - # c-toxcore - - git clone --depth=1 https://github.com/TokTok/c-toxcore ../c-toxcore - - test -f $HOME/cache/usr/lib/libtoxcore.so || (cd ../c-toxcore && cmake -B_build -H. -DCMAKE_INSTALL_PREFIX:PATH=$HOME/cache/usr && make -C_build install -j$(nproc)) - - script: - - make ENABLE_PYTHON=1 -j$(nproc) - - - env: JOB=macos - os: macos - language: c - - cache: - directories: - - $HOME/cache - - install: - - brew install - freealut - libconfig - libqrencode - libsodium - openal-soft - - export LDFLAGS="-L/usr/local/Cellar/openal-soft/1.21.0/lib" - - git clone --depth=1 https://github.com/TokTok/c-toxcore ../c-toxcore - - test -f /usr/local/lib/libtoxcore.dylib || (cd ../c-toxcore && cmake -B_build -H. && make -C_build install -j$(nproc)) - - script: - - make ENABLE_PYTHON=1 DISABLE_DESKTOP_NOTIFY=1 DISABLE_X11=1 DISABLE_AV=1 DISABLE_SOUND_NOTIFY=1 -j$(nproc) diff --git a/src/api.c b/src/api.c index 866dcba..c2c2b4a 100644 --- a/src/api.c +++ b/src/api.c @@ -106,7 +106,7 @@ void api_send(const char *msg) self_window = get_active_window(); - strncpy((char *) self_window->chatwin->line, msg, sizeof(self_window->chatwin->line)); + snprintf((char *) self_window->chatwin->line, sizeof(self_window->chatwin->line), "%s", msg); add_line_to_hist(self_window->chatwin); int id = line_info_add(self_window, true, name, NULL, OUT_MSG, 0, 0, "%s", msg); cqueue_add(self_window->chatwin->cqueue, msg, strlen(msg), OUT_MSG, id); From f39da4d7f2ae93706e0532d9740d52a99bec3f20 Mon Sep 17 00:00:00 2001 From: iphydf Date: Fri, 26 Nov 2021 23:57:39 +0000 Subject: [PATCH 2/3] chore: Add a bazel test that calls toxic with `--help`. This way we at least know it doesn't crash on load. Some code runs. We'll want some real tests at some point, but this ensures *something* works. --- BUILD.bazel | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index c1dc631..050b168 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -39,3 +39,9 @@ cc_binary( "//tools/config:osx": [], }), ) + +sh_test( + name = "toxic_test", + srcs = [":toxic"], + args = ["--help"], +) From 64794e14cd792ab0c5cdc7d2730c9e1605bc1c28 Mon Sep 17 00:00:00 2001 From: iphydf Date: Mon, 6 Dec 2021 00:35:41 +0000 Subject: [PATCH 3/3] chore: Use toktok-stack 0.0.23 for cirrus builds. --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 80b3883..6488909 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,13 +1,13 @@ --- cirrus-ci_task: container: - image: toxchat/toktok-stack:0.0.13 + image: toxchat/toktok-stack:0.0.23-third_party cpu: 2 memory: 2G configure_script: - /src/workspace/tools/inject-repo toxic test_all_script: - - bazel test -k + - cd /src/workspace && bazel test -k --remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST --config=release //toxic/...