Squashed 'external/toxcore/c-toxcore/' content from commit 67badf69
git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 67badf69416a74e74f6d7eb51dd96f37282b8455
This commit is contained in:
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1 @@
|
||||
/.github/ @TokTok/admins
|
9
.github/dependabot.yml
vendored
Normal file
9
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: gitsubmodule
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "11:00"
|
||||
open-pull-requests-limit: 2
|
27
.github/scripts/autotools-linux
vendored
Executable file
27
.github/scripts/autotools-linux
vendored
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
NPROC=$(nproc)
|
||||
|
||||
. ".github/scripts/flags-$CC.sh"
|
||||
|
||||
add_ld_flag -Wl,-z,defs
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
add_config_flag --with-nacl-libs="$CACHEDIR/lib/amd64"
|
||||
add_config_flag --with-nacl-headers="$CACHEDIR/include/amd64"
|
||||
add_config_flag --disable-ipv6
|
||||
add_config_flag --enable-nacl
|
||||
add_config_flag --enable-daemon
|
||||
add_config_flag --with-log-level=TRACE
|
||||
|
||||
autoreconf -fi
|
||||
mkdir -p _build
|
||||
cd _build # pushd
|
||||
../configure "${CONFIG_FLAGS[@]}" || (cat config.log && false)
|
||||
make "-j$NPROC" -k CFLAGS="$C_FLAGS" LDFLAGS="$LD_FLAGS"
|
||||
make -j50 -k distcheck DISTCHECK_CONFIGURE_FLAGS="${CONFIG_FLAGS[*]}" || (cat tox-*/_build/build/test-suite.log && false)
|
||||
cd - # popd
|
65
.github/scripts/cmake-android
vendored
Executable file
65
.github/scripts/cmake-android
vendored
Executable file
@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
# Set up environment
|
||||
NDK=$ANDROID_NDK_HOME
|
||||
|
||||
ABI=${1:-"armeabi-v7a"}
|
||||
|
||||
case $ABI in
|
||||
armeabi-v7a)
|
||||
TARGET=armv7a-linux-androideabi
|
||||
NDK_API=16
|
||||
;;
|
||||
arm64-v8a)
|
||||
TARGET=aarch64-linux-android
|
||||
NDK_API=21
|
||||
;;
|
||||
x86)
|
||||
TARGET=i686-linux-android
|
||||
NDK_API=16
|
||||
;;
|
||||
x86_64)
|
||||
TARGET=x86_64-linux-android
|
||||
NDK_API=21
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
rm -rf _android_prefix
|
||||
mkdir -p _android_prefix
|
||||
PREFIX=$PWD/_android_prefix
|
||||
|
||||
TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
|
||||
SYSROOT=$TOOLCHAIN/sysroot
|
||||
|
||||
export CC="$TOOLCHAIN/bin/$TARGET$NDK_API"-clang
|
||||
export LDFLAGS=-static-libstdc++
|
||||
export PKG_CONFIG_PATH="$PREFIX"/lib/pkgconfig
|
||||
|
||||
# Build libsodium
|
||||
if [ ! -d libsodium ]; then
|
||||
git clone --branch=1.0.18 https://github.com/jedisct1/libsodium.git
|
||||
fi
|
||||
cd libsodium
|
||||
git clean -ffdx
|
||||
autoreconf -fi
|
||||
./configure --prefix="$PREFIX" --host="$TARGET" --with-sysroot="$SYSROOT" --disable-shared
|
||||
make -j"$(nproc)" install
|
||||
cd ..
|
||||
|
||||
# Build c-toxcore
|
||||
rm -rf _build
|
||||
mkdir -p _build
|
||||
cd _build
|
||||
cmake .. \
|
||||
-DBUILD_TOXAV=OFF \
|
||||
-DBOOTSTRAP_DAEMON=OFF \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$NDK/build/cmake/android.toolchain.cmake" \
|
||||
-DANDROID_ABI="$ABI" \
|
||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX"
|
||||
cmake --build .
|
52
.github/scripts/cmake-freebsd-stage2
vendored
Executable file
52
.github/scripts/cmake-freebsd-stage2
vendored
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2018-2021 nurupo
|
||||
|
||||
# Toxcore building
|
||||
|
||||
set -eux
|
||||
|
||||
if [ "$PWD" != "/work" ]; then
|
||||
cd ..
|
||||
mv c-toxcore /
|
||||
mkdir c-toxcore
|
||||
cd /work
|
||||
fi
|
||||
|
||||
. cmake-freebsd-run.sh
|
||||
|
||||
# === Get VM ready to build the code ===
|
||||
|
||||
gunzip "$IMAGE_NAME.gz"
|
||||
|
||||
start_vm
|
||||
|
||||
# Copy over toxcore code from host to qemu
|
||||
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -P "$SSH_PORT" -r /c-toxcore root@localhost:~
|
||||
|
||||
RUN ls -lh
|
||||
|
||||
cd /c-toxcore
|
||||
. ".github/scripts/flags-clang.sh"
|
||||
|
||||
add_ld_flag -Wl,-z,defs
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
RUN 'cmake -B_build -Hc-toxcore \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="_install" \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DNON_HERMETIC_TESTS=ON \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DTEST_TIMEOUT_SECONDS=90 \
|
||||
-DUSE_IPV6=OFF \
|
||||
-DAUTOTEST=ON'
|
||||
|
||||
# We created the VM with the same number of cores as the host, so the host-ran `nproc` here is fine
|
||||
RUN 'gmake "-j$NPROC" -k install -C_build'
|
||||
RUN 'gmake "-j$NPROC" test ARGS="-j50" -C_build || true'
|
45
.github/scripts/cmake-osx
vendored
Executable file
45
.github/scripts/cmake-osx
vendored
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
NPROC=$(sysctl -n hw.physicalcpu)
|
||||
|
||||
# Workaround for bug in Homebrew where it only finds an old Ruby version.
|
||||
brew update
|
||||
|
||||
brew install \
|
||||
libconfig \
|
||||
libsodium \
|
||||
libvpx \
|
||||
opus
|
||||
|
||||
. ".github/scripts/flags-clang.sh"
|
||||
|
||||
add_ld_flag -undefined error
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
# Allow _Static_assert. Supported C11 extensions are fine, since we have several
|
||||
# C99-only compilers we test against anyway. Anything that passes all the
|
||||
# compilers we use is fine.
|
||||
add_c_flag -Wno-c11-extensions
|
||||
|
||||
cmake -B_build -H. \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DNON_HERMETIC_TESTS=ON \
|
||||
-DTEST_TIMEOUT_SECONDS=120 \
|
||||
-DUSE_IPV6=OFF \
|
||||
-DAUTOTEST=ON
|
||||
|
||||
cd _build # pushd
|
||||
make "-j$NPROC" -k install
|
||||
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 ||
|
||||
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6
|
||||
cd - # popd
|
7
.github/scripts/cmake-win32
vendored
Executable file
7
.github/scripts/cmake-win32
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
i686=true
|
||||
x86_64=false
|
||||
WINDOWS_ARCH=win32
|
||||
|
||||
. .github/scripts/cmake-windows.sh
|
7
.github/scripts/cmake-win64
vendored
Executable file
7
.github/scripts/cmake-win64
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
i686=false
|
||||
x86_64=true
|
||||
WINDOWS_ARCH=win64
|
||||
|
||||
. .github/scripts/cmake-windows.sh
|
29
.github/scripts/cmake-windows.sh
vendored
Normal file
29
.github/scripts/cmake-windows.sh
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
NPROC=$(nproc)
|
||||
|
||||
. ".github/scripts/flags-gcc.sh"
|
||||
|
||||
# Allows wine to display source code file names and line numbers on crash in
|
||||
# its backtrace.
|
||||
add_flag -gdwarf-2
|
||||
|
||||
# Fix invalid register for .seh_savexmm error
|
||||
add_flag -fno-asynchronous-unwind-tables
|
||||
|
||||
docker run \
|
||||
-e ALLOW_TEST_FAILURE=true \
|
||||
-e ENABLE_ARCH_i686="$i686" \
|
||||
-e ENABLE_ARCH_x86_64="$x86_64" \
|
||||
-e ENABLE_TEST=true \
|
||||
-e EXTRA_CMAKE_FLAGS="-DBOOTSTRAP_DAEMON=OFF -DMIN_LOGGER_LEVEL=DEBUG -DTEST_TIMEOUT_SECONDS=90 -DAUTOTEST=ON" \
|
||||
-e CMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-e CMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-e CMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-e CMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-v "$PWD:/toxcore" \
|
||||
-v "$PWD/result:/prefix" \
|
||||
--rm \
|
||||
"toxchat/windows:$WINDOWS_ARCH"
|
61
.github/scripts/coverage-linux
vendored
Executable file
61
.github/scripts/coverage-linux
vendored
Executable file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
NPROC=$(nproc)
|
||||
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libgtest-dev \
|
||||
libopus-dev \
|
||||
libsodium-dev \
|
||||
libvpx-dev \
|
||||
llvm-11 \
|
||||
ninja-build
|
||||
git clone --depth=1 https://github.com/ralight/mallocfail /tmp/mallocfail
|
||||
cd /tmp/mallocfail # pushd
|
||||
make
|
||||
sudo make install
|
||||
cd - # popd
|
||||
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
|
||||
sudo install other/docker/coverage/run_mallocfail /usr/local/bin/run_mallocfail
|
||||
(cd other/proxy && go build)
|
||||
other/proxy/proxy &
|
||||
|
||||
. ".github/scripts/flags-coverage.sh"
|
||||
|
||||
cmake -B_build -H. -GNinja \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
|
||||
-DENABLE_SHARED=OFF \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DNON_HERMETIC_TESTS=OFF \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DTEST_TIMEOUT_SECONDS=120 \
|
||||
-DUSE_IPV6=OFF \
|
||||
-DAUTOTEST=ON \
|
||||
-DPROXY_TEST=ON
|
||||
|
||||
cmake --build _build --parallel "$NPROC" --target install -- -k 0
|
||||
|
||||
cd _build # pushd
|
||||
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 ||
|
||||
ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6
|
||||
|
||||
export PYTHONUNBUFFERED=1
|
||||
run_mallocfail --ctest=2 --jobs=8
|
||||
cd - # popd
|
||||
|
||||
#coveralls \
|
||||
# --exclude auto_tests \
|
||||
# --exclude other \
|
||||
# --exclude testing \
|
||||
# --gcov-options '\-lp'
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) -x "llvm-cov-11 gcov"
|
71
.github/scripts/flags-clang.sh
vendored
Normal file
71
.github/scripts/flags-clang.sh
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
. .github/scripts/flags.sh
|
||||
|
||||
# Add all warning flags we can.
|
||||
add_flag -Wall
|
||||
add_flag -Wextra
|
||||
add_flag -Weverything
|
||||
|
||||
# Disable specific warning flags for both C and C++.
|
||||
|
||||
# Very verbose, not very useful. This warns about things like int -> uint
|
||||
# conversions that change sign without a cast and narrowing conversions.
|
||||
add_flag -Wno-conversion
|
||||
# TODO(iphydf): Check enum values when received from the user, then assume
|
||||
# correctness and remove this suppression.
|
||||
add_flag -Wno-covered-switch-default
|
||||
# We use C99, so declarations can come after statements.
|
||||
add_flag -Wno-declaration-after-statement
|
||||
# Due to clang's tolower() macro being recursive
|
||||
# https://github.com/TokTok/c-toxcore/pull/481
|
||||
add_flag -Wno-disabled-macro-expansion
|
||||
# We don't put __attribute__ on the public API.
|
||||
add_flag -Wno-documentation-deprecated-sync
|
||||
# Bootstrap daemon does this.
|
||||
add_flag -Wno-format-nonliteral
|
||||
# struct Foo foo = {0}; is a common idiom. Missing braces means we'd need to
|
||||
# write {{{0}}} in some cases, which is ugly and a maintenance burden.
|
||||
add_flag -Wno-missing-braces
|
||||
add_flag -Wno-missing-field-initializers
|
||||
# We don't use this attribute. It appears in the non-NDEBUG stderr logger.
|
||||
add_flag -Wno-missing-noreturn
|
||||
# Useful sometimes, but we accept padding in structs for clarity.
|
||||
# Reordering fields to avoid padding will reduce readability.
|
||||
add_flag -Wno-padded
|
||||
# This warns on things like _XOPEN_SOURCE, which we currently need (we
|
||||
# probably won't need these in the future).
|
||||
add_flag -Wno-reserved-id-macro
|
||||
# TODO(iphydf): Clean these up. They are likely not bugs, but still
|
||||
# potential issues and probably confusing.
|
||||
add_flag -Wno-sign-compare
|
||||
# __attribute__((nonnull)) causes this warning on defensive null checks.
|
||||
add_flag -Wno-tautological-pointer-compare
|
||||
# Our use of mutexes results in a false positive, see 1bbe446.
|
||||
add_flag -Wno-thread-safety-analysis
|
||||
# File transfer code has this.
|
||||
add_flag -Wno-type-limits
|
||||
# Callbacks often don't use all their parameters.
|
||||
add_flag -Wno-unused-parameter
|
||||
# cimple does this better
|
||||
add_flag -Wno-unused-function
|
||||
# libvpx uses __attribute__((unused)) for "potentially unused" static
|
||||
# functions to avoid unused static function warnings.
|
||||
add_flag -Wno-used-but-marked-unused
|
||||
# We use variable length arrays a lot.
|
||||
add_flag -Wno-vla
|
||||
# Disable warnings about unknown Doxygen commands
|
||||
add_flag -Wno-documentation-unknown-command
|
||||
|
||||
# Disable specific warning flags for C++.
|
||||
|
||||
# Comma at end of enum is supported everywhere we run.
|
||||
add_cxx_flag -Wno-c++98-compat-pedantic
|
||||
# TODO(iphydf): Stop using flexible array members.
|
||||
add_cxx_flag -Wno-c99-extensions
|
||||
# We're C-compatible, so use C style casts.
|
||||
add_cxx_flag -Wno-old-style-cast
|
||||
|
||||
# Downgrade to warning so we still see it.
|
||||
add_flag -Wno-error=unreachable-code
|
||||
add_flag -Wno-error=unused-variable
|
27
.github/scripts/flags-coverage.sh
vendored
Normal file
27
.github/scripts/flags-coverage.sh
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
. .github/scripts/flags-clang.sh
|
||||
|
||||
add_ld_flag -Wl,-z,defs
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
# Coverage flags.
|
||||
add_flag --coverage
|
||||
|
||||
# Optimisation, but keep stack traces useful.
|
||||
add_c_flag -fno-inline -fno-omit-frame-pointer
|
||||
|
||||
# Show useful stack traces on crash.
|
||||
add_flag -fsanitize=undefined -fno-sanitize-recover=all
|
||||
|
||||
# In test code (_test.cc and libgtest), throw away all debug information.
|
||||
# We only care about stack frames inside toxcore (which is C). Without this,
|
||||
# mallocfail will spend a lot of time finding all the ways in which gtest can
|
||||
# fail to allocate memory, which is not interesting to us.
|
||||
add_cxx_flag -g0
|
||||
|
||||
# Continue executing code in error paths so we can see it cleanly exit (and the
|
||||
# test code itself may abort).
|
||||
add_flag -DABORT_ON_LOG_ERROR=false
|
63
.github/scripts/flags-gcc.sh
vendored
Normal file
63
.github/scripts/flags-gcc.sh
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
. .github/scripts/flags.sh
|
||||
|
||||
# Add all warning flags we can.
|
||||
add_flag -Wall
|
||||
add_flag -Wextra
|
||||
|
||||
# Some additional warning flags not enabled by any of the above.
|
||||
add_flag -Wbool-compare
|
||||
add_flag -Wcast-align
|
||||
add_flag -Wcast-qual
|
||||
add_flag -Wchar-subscripts
|
||||
add_flag -Wdouble-promotion
|
||||
add_flag -Wduplicated-cond
|
||||
add_flag -Wempty-body
|
||||
add_flag -Wenum-compare
|
||||
add_flag -Wfloat-equal
|
||||
add_flag -Wformat=2
|
||||
add_flag -Wframe-address
|
||||
add_flag -Wframe-larger-than=9000
|
||||
add_flag -Wignored-attributes
|
||||
add_flag -Wignored-qualifiers
|
||||
add_flag -Winit-self
|
||||
add_flag -Winline
|
||||
add_flag -Wlarger-than=530000
|
||||
add_flag -Wmaybe-uninitialized
|
||||
add_flag -Wmemset-transposed-args
|
||||
add_flag -Wmisleading-indentation
|
||||
add_flag -Wmissing-declarations
|
||||
add_flag -Wnonnull
|
||||
add_flag -Wnull-dereference
|
||||
add_flag -Wodr
|
||||
add_flag -Wredundant-decls
|
||||
add_flag -Wreturn-type
|
||||
add_flag -Wshadow
|
||||
add_flag -Wsuggest-attribute=format
|
||||
add_flag -Wundef
|
||||
add_flag -Wunsafe-loop-optimizations
|
||||
add_flag -Wunused-but-set-parameter
|
||||
add_flag -Wunused-but-set-variable
|
||||
add_flag -Wunused-label
|
||||
add_flag -Wunused-local-typedefs
|
||||
add_flag -Wunused-value
|
||||
|
||||
# Disable specific warning flags for both C and C++.
|
||||
|
||||
# struct Foo foo = {0}; is a common idiom.
|
||||
add_flag -Wno-missing-field-initializers
|
||||
# TODO(iphydf): Clean these up. They are likely not bugs, but still
|
||||
# potential issues and probably confusing.
|
||||
add_flag -Wno-sign-compare
|
||||
# File transfer code has this.
|
||||
add_flag -Wno-type-limits
|
||||
# Callbacks often don't use all their parameters.
|
||||
add_flag -Wno-unused-parameter
|
||||
# cimple does this better
|
||||
add_flag -Wno-unused-function
|
||||
# struct Foo foo = {0}; is a common idiom. Missing braces means we'd need to
|
||||
# write {{{0}}} in some cases, which is ugly and a maintenance burden.
|
||||
add_flag -Wno-missing-braces
|
||||
# __attribute__((nonnull)) causes this warning on defensive null checks.
|
||||
add_flag -Wno-nonnull-compare
|
35
.github/scripts/flags.sh
vendored
Normal file
35
.github/scripts/flags.sh
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
add_config_flag() { CONFIG_FLAGS+=("$@"); }
|
||||
add_c_flag() { C_FLAGS="$C_FLAGS $@"; }
|
||||
add_cxx_flag() { CXX_FLAGS="$CXX_FLAGS $@"; }
|
||||
add_ld_flag() { LD_FLAGS="$LD_FLAGS $@"; }
|
||||
add_flag() {
|
||||
add_c_flag "$@"
|
||||
add_cxx_flag "$@"
|
||||
}
|
||||
|
||||
# Our own flags which we can insert in the correct place. We don't use CFLAGS
|
||||
# and friends here (we unset them below), because they influence config tests
|
||||
# such as ./configure and cmake tests. Our warning flags break those tests, so
|
||||
# we can't add them globally here.
|
||||
CONFIG_FLAGS=()
|
||||
C_FLAGS=""
|
||||
CXX_FLAGS=""
|
||||
LD_FLAGS=""
|
||||
|
||||
unset CFLAGS
|
||||
unset CXXFLAGS
|
||||
unset CPPFLAGS
|
||||
unset LDFLAGS
|
||||
|
||||
# Optimisation flags.
|
||||
add_flag -O3 -march=native
|
||||
|
||||
# Warn on non-ISO C.
|
||||
add_c_flag -pedantic
|
||||
add_c_flag -std=c99
|
||||
add_cxx_flag -std=c++11
|
||||
|
||||
add_flag -g3
|
||||
add_flag -ftrapv
|
7
.github/scripts/sonar-build
vendored
Executable file
7
.github/scripts/sonar-build
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
. ".github/scripts/flags-gcc.sh"
|
||||
|
||||
cmake --build _build --parallel "$(nproc)" --target install -- -k 0
|
32
.github/scripts/sonar-prepare
vendored
Executable file
32
.github/scripts/sonar-prepare
vendored
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libconfig-dev \
|
||||
libopus-dev \
|
||||
libsodium-dev \
|
||||
libvpx-dev \
|
||||
ninja-build
|
||||
|
||||
. ".github/scripts/flags-gcc.sh"
|
||||
|
||||
add_ld_flag -Wl,-z,defs
|
||||
|
||||
# Make compilation error on a warning
|
||||
add_flag -Werror
|
||||
|
||||
cmake -B_build -H. -GNinja \
|
||||
-DCMAKE_C_FLAGS="$C_FLAGS" \
|
||||
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$LD_FLAGS" \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
|
||||
-DMIN_LOGGER_LEVEL=TRACE \
|
||||
-DMUST_BUILD_TOXAV=ON \
|
||||
-DNON_HERMETIC_TESTS=OFF \
|
||||
-DSTRICT_ABI=ON \
|
||||
-DTEST_TIMEOUT_SECONDS=120 \
|
||||
-DUSE_IPV6=OFF \
|
||||
-DAUTOTEST=ON \
|
||||
-DENABLE_SHARED=OFF
|
77
.github/scripts/tox-bootstrapd-docker
vendored
Executable file
77
.github/scripts/tox-bootstrapd-docker
vendored
Executable file
@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -exu
|
||||
|
||||
LOCAL="${1:-}"
|
||||
|
||||
readarray -t FILES <<<"$(git ls-files)"
|
||||
|
||||
tar c "${FILES[@]}" | docker build -f other/bootstrap_daemon/docker/Dockerfile -t toxchat/bootstrap-node -
|
||||
docker tag toxchat/bootstrap-node:latest toxchat/bootstrap-node:"$(other/print-version)"
|
||||
|
||||
sudo useradd \
|
||||
--home-dir /var/lib/tox-bootstrapd \
|
||||
--create-home \
|
||||
--system \
|
||||
--shell /sbin/nologin \
|
||||
--comment "Account to run Tox's DHT bootstrap daemon" \
|
||||
--user-group tox-bootstrapd
|
||||
sudo chmod 700 /var/lib/tox-bootstrapd
|
||||
docker run -d --name tox-bootstrapd \
|
||||
--user "$(id -u tox-bootstrapd):$(id -g tox-bootstrapd)" \
|
||||
-v /var/lib/tox-bootstrapd/:/var/lib/tox-bootstrapd/ \
|
||||
--ulimit nofile=32768:32768 \
|
||||
-p 443:443 \
|
||||
-p 3389:3389 \
|
||||
-p 33445:33445 \
|
||||
-p 33445:33445/udp \
|
||||
toxchat/bootstrap-node
|
||||
|
||||
sudo ls -lbh /var/lib/tox-bootstrapd
|
||||
|
||||
if sudo [ ! -f /var/lib/tox-bootstrapd/keys ]; then
|
||||
echo "Error: File /var/lib/tox-bootstrapd/keys doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$LOCAL" != "local" ]; then
|
||||
COUNTER=0
|
||||
COUNTER_END=120
|
||||
while [ "$COUNTER" -lt "$COUNTER_END" ]; do
|
||||
if docker logs tox-bootstrapd | grep -q "Connected to another bootstrap node successfully"; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
COUNTER=$(($COUNTER + 1))
|
||||
done
|
||||
|
||||
docker logs tox-bootstrapd
|
||||
|
||||
if [ "$COUNTER" = "$COUNTER_END" ]; then
|
||||
echo "Error: Didn't connect to any nodes"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
docker logs tox-bootstrapd
|
||||
fi
|
||||
|
||||
# Wait a bit before testing if the container is still running
|
||||
sleep 30
|
||||
|
||||
docker ps -a
|
||||
|
||||
if [ "$(docker inspect -f {{.State.Running}} tox-bootstrapd)" != "true" ]; then
|
||||
echo "Error: Container is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat /proc/"$(pidof tox-bootstrapd)"/limits
|
||||
if ! grep -P '^Max open files(\s+)32768(\s+)32768(\s+)files' /proc/"$(pidof tox-bootstrapd)"/limits; then
|
||||
echo "Error: ulimit is not set to the expected value"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! other/fun/bootstrap_node_info.py ipv4 localhost 33445; then
|
||||
echo "Error: Unable to get bootstrap node info"
|
||||
exit 1
|
||||
fi
|
70
.github/settings.yml
vendored
Normal file
70
.github/settings.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
_extends: .github
|
||||
|
||||
repository:
|
||||
name: c-toxcore
|
||||
description: The future of online communications.
|
||||
homepage: https://tox.chat/
|
||||
topics: toxcore, network, p2p, security, encryption, cryptography
|
||||
|
||||
branches:
|
||||
- name: "master"
|
||||
protection:
|
||||
required_status_checks:
|
||||
contexts:
|
||||
- "bazel-asan"
|
||||
- "bazel-dbg"
|
||||
- "bazel-opt"
|
||||
- "bazel-tsan"
|
||||
- "build-compcert"
|
||||
- "build-macos"
|
||||
- "build-nacl"
|
||||
- "build-tcc"
|
||||
- "build-win32"
|
||||
- "build-win64"
|
||||
- "CodeFactor"
|
||||
- "common / buildifier"
|
||||
- "coverage-linux"
|
||||
- "ci/circleci: asan"
|
||||
- "ci/circleci: clang-analyze"
|
||||
- "ci/circleci: clang-tidy"
|
||||
- "ci/circleci: cpplint"
|
||||
- "ci/circleci: infer"
|
||||
- "ci/circleci: msan"
|
||||
- "ci/circleci: static-analysis"
|
||||
- "ci/circleci: tsan"
|
||||
- "ci/circleci: ubsan"
|
||||
- "cimple"
|
||||
- "code-review/reviewable"
|
||||
- "continuous-integration/appveyor/pr"
|
||||
- "docker-bootstrap-node"
|
||||
- "docker-bootstrap-node-websocket"
|
||||
- "docker-toxcore-js"
|
||||
- "mypy"
|
||||
- "sonar-scan"
|
||||
|
||||
# Labels specific to c-toxcore.
|
||||
labels:
|
||||
- name: "bootstrap"
|
||||
color: "#01707f"
|
||||
description: "Bootstrap"
|
||||
|
||||
- name: "crypto"
|
||||
color: "#1d76db"
|
||||
description: "Crypto"
|
||||
|
||||
- name: "file transfers"
|
||||
color: "#e02abf"
|
||||
description: "File Transfers"
|
||||
|
||||
- name: "messenger"
|
||||
color: "#d93f0b"
|
||||
description: "Messenger"
|
||||
|
||||
- name: "network"
|
||||
color: "#d4c5f9"
|
||||
description: "Network"
|
||||
|
||||
- name: "toxav"
|
||||
color: "#0052cc"
|
||||
description: "Audio/video"
|
37
.github/workflows/cflite_batch.yml
vendored
Normal file
37
.github/workflows/cflite_batch.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
# Derived from: https://google.github.io/clusterfuzzlite/running-clusterfuzzlite/github-actions/
|
||||
|
||||
name: ClusterFuzzLite batch fuzzing
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 6,8 * * *' # Run twice a day at low activity times
|
||||
workflow_dispatch: # Manual trigger for testing
|
||||
permissions: read-all
|
||||
jobs:
|
||||
BatchFuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sanitizer:
|
||||
- address
|
||||
- undefined
|
||||
- memory
|
||||
steps:
|
||||
- name: Build Fuzzers (${{ matrix.sanitizer }})
|
||||
id: build
|
||||
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
|
||||
with:
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
- name: Run Fuzzers (${{ matrix.sanitizer }})
|
||||
id: run
|
||||
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fuzz-seconds: 3600 # 60min
|
||||
mode: 'batch'
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
# Optional but recommended: For storing certain artifacts from fuzzing.
|
||||
# See later section on "Git repo for storage".
|
||||
storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/TokTok/toktok-fuzzer.git
|
||||
storage-repo-branch: master # Optional. Defaults to "main"
|
||||
storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
|
50
.github/workflows/cflite_cron.yml
vendored
Normal file
50
.github/workflows/cflite_cron.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
# Derived from: https://google.github.io/clusterfuzzlite/running-clusterfuzzlite/github-actions/
|
||||
|
||||
name: ClusterFuzzLite cron tasks
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # Once a day, after fuzzing run
|
||||
workflow_dispatch: # Manual trigger for testing
|
||||
|
||||
permissions: read-all
|
||||
jobs:
|
||||
Pruning:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
id: build
|
||||
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
|
||||
- name: Run Fuzzers
|
||||
id: run
|
||||
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fuzz-seconds: 600
|
||||
mode: 'prune'
|
||||
# Optional but recommended.
|
||||
# See later section on "Git repo for storage".
|
||||
storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/TokTok/toktok-fuzzer.git
|
||||
storage-repo-branch: master # Optional. Defaults to "main"
|
||||
storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
|
||||
Coverage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
id: build
|
||||
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
|
||||
with:
|
||||
sanitizer: coverage
|
||||
- name: Run Fuzzers
|
||||
id: run
|
||||
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fuzz-seconds: 600
|
||||
mode: 'coverage'
|
||||
sanitizer: 'coverage'
|
||||
# Optional but recommended.
|
||||
# See later section on "Git repo for storage".
|
||||
storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/TokTok/toktok-fuzzer.git
|
||||
storage-repo-branch: master # Optional. Defaults to "main"
|
||||
storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
|
||||
|
212
.github/workflows/ci.yml
vendored
Normal file
212
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,212 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
# Cancel old PR builds when pushing new commits.
|
||||
concurrency:
|
||||
group: build-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
common:
|
||||
uses: TokTok/ci-tools/.github/workflows/common-ci.yml@master
|
||||
|
||||
mypy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up Python 3.9
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.9
|
||||
- name: Install mypy
|
||||
run: pip install mypy
|
||||
- name: Run mypy
|
||||
run: |
|
||||
(find . -name "*.py" -and -not -name "conanfile.py"; grep -lR '^#!.*python') \
|
||||
| xargs -n1 -P8 mypy --strict
|
||||
|
||||
doxygen:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Docker Build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: other/docker/doxygen/Dockerfile
|
||||
|
||||
tokstyle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Docker Build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: other/docker/tokstyle/Dockerfile
|
||||
|
||||
misra:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Docker Build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: other/docker/misra/Dockerfile
|
||||
|
||||
cimplefmt:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Run cimplefmt
|
||||
run: other/docker/cimplefmt/run -u $(find tox* -name "*.[ch]")
|
||||
|
||||
build-nacl:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Docker Build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: other/docker/autotools/Dockerfile
|
||||
|
||||
build-win32:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Cross compilation
|
||||
run: .github/scripts/cmake-win32 script
|
||||
|
||||
build-win64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Cross compilation
|
||||
run: .github/scripts/cmake-win64 script
|
||||
|
||||
build-freebsd:
|
||||
runs-on: ubuntu-latest
|
||||
container: toxchat/freebsd
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build on FreeBSD
|
||||
run: .github/scripts/cmake-freebsd-stage2
|
||||
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build and test
|
||||
run: .github/scripts/cmake-osx
|
||||
|
||||
coverage-linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build, test, and upload coverage
|
||||
run: .github/scripts/coverage-linux
|
||||
|
||||
build-tcc:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install dependencies
|
||||
run:
|
||||
sudo apt-get install -y --no-install-recommends
|
||||
tcc
|
||||
libconfig-dev
|
||||
libopus-dev
|
||||
libsodium-dev
|
||||
libvpx-dev
|
||||
- name: Build with TCC
|
||||
run:
|
||||
tcc
|
||||
-Dinline=static
|
||||
-o send_message_test
|
||||
-Wall -Werror
|
||||
-bench -g
|
||||
auto_tests/auto_test_support.c
|
||||
auto_tests/send_message_test.c
|
||||
testing/misc_tools.c
|
||||
toxav/*.c
|
||||
toxcore/*.c
|
||||
toxcore/*/*.c
|
||||
toxencryptsave/*.c
|
||||
third_party/cmp/*.c
|
||||
$(pkg-config --cflags --libs libsodium opus vpx)
|
||||
- name: Run the test
|
||||
run: "./send_message_test | grep 'tox clients connected'"
|
||||
- name: Build amalgamation file with TCC
|
||||
run:
|
||||
other/make_single_file
|
||||
auto_tests/auto_test_support.c
|
||||
auto_tests/send_message_test.c
|
||||
testing/misc_tools.c |
|
||||
tcc -
|
||||
-o send_message_test
|
||||
-Wall -Werror
|
||||
-bench -g
|
||||
$(pkg-config --cflags --libs libsodium opus vpx)
|
||||
- name: Run the test again
|
||||
run: "./send_message_test | grep 'tox clients connected'"
|
||||
|
||||
build-compcert:
|
||||
runs-on: ubuntu-latest
|
||||
container: toxchat/compcert
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Build with CompCert
|
||||
run:
|
||||
ccomp
|
||||
-o send_message_test
|
||||
-Wall -Werror
|
||||
-Wno-c11-extensions
|
||||
-Wno-unknown-pragmas
|
||||
-Wno-unused-variable
|
||||
-fstruct-passing -fno-unprototyped -g
|
||||
auto_tests/auto_test_support.c
|
||||
auto_tests/send_message_test.c
|
||||
testing/misc_tools.c
|
||||
toxav/*.c
|
||||
toxcore/*.c
|
||||
toxcore/*/*.c
|
||||
toxencryptsave/*.c
|
||||
third_party/cmp/*.c
|
||||
-D__COMPCERT__ -DDISABLE_VLA -Dinline=
|
||||
-lpthread $(pkg-config --cflags --libs libsodium opus vpx)
|
||||
- name: Run the test
|
||||
run: "./send_message_test | grep 'tox clients connected'"
|
||||
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- run: .github/scripts/cmake-android armeabi-v7a
|
||||
- run: .github/scripts/cmake-android arm64-v8a
|
||||
- run: .github/scripts/cmake-android x86
|
||||
- run: .github/scripts/cmake-android x86_64
|
51
.github/workflows/coverity-scan.yml
vendored
Normal file
51
.github/workflows/coverity-scan.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: coverity-scan
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # Once a day
|
||||
|
||||
jobs:
|
||||
latest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install libraries
|
||||
run:
|
||||
sudo apt-get update &&
|
||||
sudo apt-get install -y --no-install-recommends
|
||||
libopus-dev
|
||||
libsodium-dev
|
||||
libvpx-dev
|
||||
|
||||
- name: Download Coverity Build Tool
|
||||
run: |
|
||||
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=TokTok/c-toxcore" -O cov-analysis-linux64.tar.gz
|
||||
mkdir cov-analysis-linux64
|
||||
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
||||
|
||||
- name: Run autoreconf
|
||||
run: autoreconf -fi
|
||||
|
||||
- name: Configure
|
||||
run: ./configure
|
||||
|
||||
- name: Build with cov-build
|
||||
run: cov-analysis-linux64/bin/cov-build --dir cov-int make
|
||||
|
||||
- name: Submit the result to Coverity Scan
|
||||
run:
|
||||
tar czvf c-toxcore.tgz cov-int &&
|
||||
curl
|
||||
--form project=TokTok/c-toxcore
|
||||
--form token=$TOKEN
|
||||
--form email=iphydf@gmail.com
|
||||
--form file=@c-toxcore.tgz
|
||||
--form version="$(git rev-list --count HEAD)"
|
||||
--form description="CI build of $(git rev-parse --abbrev-ref HEAD) branch"
|
||||
https://scan.coverity.com/builds
|
||||
env:
|
||||
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
|
187
.github/workflows/docker.yml
vendored
Normal file
187
.github/workflows/docker.yml
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
name: docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
docker-bootstrap-node:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Docker Build
|
||||
run: .github/scripts/tox-bootstrapd-docker local
|
||||
- name: Push latest image to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
run: docker push toxchat/bootstrap-node:latest
|
||||
- name: Push versioned image to DockerHub
|
||||
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
|
||||
run: docker push toxchat/bootstrap-node:"$(other/print-version)"
|
||||
|
||||
docker-bootstrap-node-websocket:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [docker-bootstrap-node]
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: "{{defaultContext}}:other/bootstrap_daemon/websocket"
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: toxchat/bootstrap-node:latest-websocket
|
||||
cache-from: type=registry,ref=toxchat/bootstrap-node:latest-websocket
|
||||
cache-to: type=inline
|
||||
|
||||
docker-clusterfuzz:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: "."
|
||||
file: .clusterfuzzlite/Dockerfile
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: toxchat/c-toxcore:clusterfuzz
|
||||
cache-from: type=registry,ref=toxchat/c-toxcore:clusterfuzz
|
||||
cache-to: type=inline
|
||||
|
||||
docker-fuzzer:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: testing/Dockerfile
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: toxchat/c-toxcore:fuzzer
|
||||
cache-from: type=registry,ref=toxchat/c-toxcore:fuzzer
|
||||
cache-to: type=inline
|
||||
|
||||
docker-toxcore-js:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: other/emscripten/Dockerfile
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: toxchat/c-toxcore:wasm
|
||||
cache-from: type=registry,ref=toxchat/c-toxcore:wasm
|
||||
cache-to: type=inline
|
||||
|
||||
docker-esp32:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
driver: docker
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build toxchat/c-toxcore:sources
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: other/docker/sources/Dockerfile
|
||||
tags: toxchat/c-toxcore:sources
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
file: other/docker/esp32/Dockerfile
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: toxchat/c-toxcore:esp32
|
||||
cache-from: type=registry,ref=toxchat/c-toxcore:esp32
|
||||
cache-to: type=inline
|
||||
|
||||
docker-win32:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: "{{defaultContext}}:other/docker/windows"
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: toxchat/windows:win32
|
||||
cache-from: type=registry,ref=toxchat/windows:win32
|
||||
cache-to: type=inline
|
||||
build-args: |
|
||||
SUPPORT_ARCH_i686=true
|
||||
SUPPORT_ARCH_x86_64=false
|
||||
SUPPORT_TEST=true
|
||||
|
||||
docker-win64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: "{{defaultContext}}:other/docker/windows"
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
tags: toxchat/windows:win64
|
||||
cache-from: type=registry,ref=toxchat/windows:win64
|
||||
cache-to: type=inline
|
||||
build-args: |
|
||||
SUPPORT_ARCH_i686=false
|
||||
SUPPORT_ARCH_x86_64=true
|
||||
SUPPORT_TEST=true
|
51
.github/workflows/sonar-scan.yml
vendored
Normal file
51
.github/workflows/sonar-scan.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: sonar-scan
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
sonar-scan:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SONAR_SCANNER_VERSION: 4.4.0.2170
|
||||
SONAR_SERVER_URL: "https://sonarcloud.io"
|
||||
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
submodules: recursive
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Download and set up sonar-scanner
|
||||
env:
|
||||
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
|
||||
run: |
|
||||
mkdir -p $HOME/.sonar
|
||||
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
|
||||
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
|
||||
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
|
||||
- name: Download and set up build-wrapper
|
||||
env:
|
||||
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
|
||||
run: |
|
||||
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
|
||||
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
|
||||
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
|
||||
- name: Install dependencies and prepare build
|
||||
run: |
|
||||
.github/scripts/sonar-prepare
|
||||
- name: Run build-wrapper
|
||||
run: |
|
||||
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} .github/scripts/sonar-build
|
||||
- name: Run sonar-scanner
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
run: 'sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"'
|
Reference in New Issue
Block a user