diff options
-rw-r--r-- | .drone.jsonnet | 310 | ||||
-rw-r--r-- | .drone.yml | 563 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 25 | ||||
-rw-r--r-- | .github/workflows/ci_eslint.yml | 25 | ||||
-rw-r--r-- | .github/workflows/ci_linters.yml | 14 | ||||
-rw-r--r-- | .github/workflows/ci_luacheck.yml | 16 | ||||
-rw-r--r-- | .github/workflows/ci_rspamd.yml | 99 | ||||
-rw-r--r-- | .github/workflows/ci_tidyall.yml | 23 |
8 files changed, 202 insertions, 873 deletions
diff --git a/.drone.jsonnet b/.drone.jsonnet deleted file mode 100644 index 8d4119706..000000000 --- a/.drone.jsonnet +++ /dev/null @@ -1,310 +0,0 @@ -local docker_pipeline = { - kind: 'pipeline', - type: 'docker', -}; - -local default_trigger_events_ex_pr = [ - 'push', - 'tag', - 'custom', -]; - -local default_trigger = { - trigger: { - event: default_trigger_events_ex_pr + ['pull_request'], - }, -}; - -local platform(arch) = { - platform: { - os: 'linux', - arch: arch, - }, -}; - -local coveralls_attribs = { - branch: [ - 'master', - ], - event: [ - 'push', - 'tag', - ], -}; - -local close_coveralls_trigger = { - trigger: coveralls_attribs { status: ['success', 'failure'] }, -}; - -local coveralls_when = { - when: coveralls_attribs, -}; - -local notify_pipeline = { - name: 'notify', - depends_on: [ - 'default-amd64', - 'default-arm64', - 'default-noarch', - ], - steps: [ - { - name: 'notify', - image: 'drillster/drone-email', - pull: 'if-not-exists', - settings: { - from: 'noreply@rspamd.com', - host: { - from_secret: 'email_host', - }, - username: { - from_secret: 'email_username', - }, - password: { - from_secret: 'email_password', - }, - }, - }, - ], - trigger: { - event: default_trigger_events_ex_pr, - status: [ - 'failure', - ], - }, -} + docker_pipeline; - -local pipeline(arch) = { - local rspamd_volumes = { - volumes: [ - { - name: 'rspamd', - path: '/rspamd', - }, - ], - }, - local hyperscan_altroot = if (arch) == 'amd64' then '' else '-DHYPERSCAN_ROOT_DIR=/vectorscan', - depends_on: [ - ], - name: 'default-' + arch, - steps: [ - { - name: 'prepare', - image: 'ubuntu:22.04', - pull: 'if-not-exists', - commands: [ - 'install -d -o nobody -g nogroup /rspamd/build /rspamd/install /rspamd/fedora/build /rspamd/fedora/install', - ], - } + rspamd_volumes, - { - name: 'build', - image: 'rspamd/ci:ubuntu-build', - pull: 'always', - depends_on: [ - 'prepare', - ], - commands: [ - 'test "$(id -un)" = nobody', - 'cd /rspamd/build', - 'cmake -DCMAKE_INSTALL_PREFIX=/rspamd/install -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DENABLE_HYPERSCAN=ON ' + hyperscan_altroot + ' -GNinja $DRONE_WORKSPACE\n', - 'ncpu=$(getconf _NPROCESSORS_ONLN)', - 'ninja -j $ncpu install', - 'ninja -j $ncpu rspamd-test', - 'ninja -j $ncpu rspamd-test-cxx', - ], - } + rspamd_volumes, - { - name: 'build-clang', - image: 'rspamd/ci:fedora-build', - pull: 'always', - depends_on: [ - 'prepare', - ], - commands: [ - 'test "$(id -un)" = nobody', - 'cd /rspamd/fedora/build', - "export LDFLAGS='-fuse-ld=lld'", - 'export ASAN_OPTIONS=detect_leaks=0', - 'cmake -DCMAKE_INSTALL_PREFIX=/rspamd/fedora/install -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_CLANG_PLUGIN=ON -DENABLE_FULL_DEBUG=ON -DENABLE_HYPERSCAN=ON ' + hyperscan_altroot + ' -DSANITIZE=address $DRONE_WORKSPACE\n', - 'ncpu=$(getconf _NPROCESSORS_ONLN)', - 'make -j $ncpu install', - 'make -j $ncpu rspamd-test', - 'make -j $ncpu rspamd-test-cxx', - ], - } + rspamd_volumes, - { - name: 'rspamd-test', - image: 'rspamd/ci:ubuntu-test', - pull: 'always', - depends_on: [ - 'build', - ], - commands: [ - 'test "$(id -un)" = nobody', - 'ulimit -c unlimited', - 'cd /rspamd/build/test', - 'set +e', - 'env RSPAMD_LUA_EXPENSIVE_TESTS=1 ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?', - 'set -e', - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test.core ./rspamd-test; exit $EXIT_CODE; fi; if [ $EXIT_CODE -ne 0 ]; then exit $EXIT_CODE; fi\n", - 'luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun', - 'set +e', - './rspamd-test-cxx -s; EXIT_CODE=$?', - 'set -e', - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test-cxx.core ./rspamd-test-cxx; exit $EXIT_CODE; fi\n", - 'exit $EXIT_CODE', - ], - } + rspamd_volumes, - { - name: 'test-fedora-clang', - image: 'rspamd/ci:fedora-test', - pull: 'always', - depends_on: [ - 'build-clang', - ], - commands: [ - 'test "$(id -un)" = nobody', - 'ulimit -c 2097152', - 'ulimit -s unlimited', - 'export ASAN_OPTIONS="detect_leaks=0:print_stacktrace=1:disable_coredump=0"', - 'export UBSAN_OPTIONS="print_stacktrace=1:print_summary=0:log_path=/tmp/ubsan"', - 'cd /rspamd/fedora/build/test', - 'set +e', - 'env RSPAMD_LUA_EXPENSIVE_TESTS=1 ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?', - 'set -e', - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'bt' -c /var/tmp/*.rspamd-test.core ./rspamd-test; fi\n", - 'set +e', - './rspamd-test-cxx -s; EXIT_CODE=$?', - 'set -e', - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test-cxx.core ./rspamd-test-cxx; exit $EXIT_CODE; fi\n", - 'cat /tmp/ubsan.* || true', - 'exit $EXIT_CODE', - ], - } + rspamd_volumes, - { - name: 'functional', - image: 'rspamd/ci:ubuntu-test-func', - pull: 'always', - depends_on: [ - 'build', - ], - commands: [ - 'cd /rspamd/build', - 'ulimit -c unlimited', - 'ulimit -s unlimited', - 'set +e', - 'RSPAMD_INSTALLROOT=/rspamd/install robot --removekeywords wuks --exclude isbroken $DRONE_WORKSPACE/test/functional/cases; EXIT_CODE=$?', - 'set -e', - 'if [ -n "$HTTP_PUT_AUTH" ]; then $DRONE_WORKSPACE/test/tools/http_put.py log.html report.html https://$DRONE_SYSTEM_HOSTNAME/testlogs/$DRONE_REPO/${DRONE_BUILD_NUMBER}-' + arch + '/; fi\n', - "core_files=$(find /var/tmp/ -name '*.core')", - "for core in $core_files; do exe=$(gdb --batch -ex 'info proc mappings' -c $core | tail -1 | awk '{print $5}'); gdb --batch -ex 'bt' -c $core $exe; echo '---'; done\n", - 'exit $EXIT_CODE', - ], - environment: { - HTTP_PUT_AUTH: { - from_secret: 'http_put_auth', - }, - }, - } + rspamd_volumes, - { - name: 'send-coverage', - image: 'rspamd/ci:ubuntu-test', - pull: 'if-not-exists', - depends_on: [ - 'functional', - 'rspamd-test', - ], - commands: [ - 'cd /rspamd/build', - '$DRONE_WORKSPACE/test/tools/gcov_coveralls.py --exclude test --prefix /rspamd/build --prefix $DRONE_WORKSPACE --out coverage.c.json', - 'luacov-coveralls -o coverage.functional.lua.json --dryrun', - '$DRONE_WORKSPACE/test/tools/merge_coveralls.py --parallel --root $DRONE_WORKSPACE --input coverage.c.json unit_test_lua.json coverage.functional.lua.json --token=$COVERALLS_REPO_TOKEN', - ], - environment: { - COVERALLS_REPO_TOKEN: { - from_secret: 'coveralls_repo_token', - }, - }, - } + coveralls_when + rspamd_volumes, - ], - volumes: [ - { - name: 'rspamd', - temp: {}, - }, - ], -} + platform(arch) + default_trigger + docker_pipeline; - -local close_coveralls = { - name: 'close_coveralls', - depends_on: [ - 'default-amd64', - 'default-arm64', - ], - steps: [ - { - name: 'close_coveralls', - image: 'rspamd/ci:ubuntu-test-func', - pull: 'always', - commands: [ - '$DRONE_WORKSPACE/test/tools/merge_coveralls.py --parallel-close --token=$COVERALLS_REPO_TOKEN', - ], - environment: { - COVERALLS_REPO_TOKEN: { - from_secret: 'coveralls_repo_token', - }, - }, - }, - ], -} + close_coveralls_trigger + docker_pipeline; - -local noarch_pipeline = { - name: 'default-noarch', - steps: [ - { - name: 'perl-tidyall', - image: 'rspamd/ci:perl-tidyall', - pull: 'if-not-exists', - failure: 'ignore', - commands: [ - 'tidyall --version', - 'perltidy --version | head -1', - 'tidyall --all --check-only --no-cache --data-dir /tmp/tidyall', - ], - }, - { - name: 'eslint', - image: 'node:18-alpine', - pull: 'if-not-exists', - failure: 'ignore', - commands: [ - 'npm install', - 'npm ls', - './node_modules/.bin/eslint ./', - './node_modules/.bin/stylelint ./**/*.css ./**/*.html ./**/*.js', - ], - }, - { - name: 'luacheck', - image: 'pipelinecomponents/luacheck', - pull: 'if-not-exists', - commands: [ - 'luacheck -q --no-color .', - ], - }, - ], -} + default_trigger + docker_pipeline; - -local signature = { - kind: 'signature', - hmac: '0000000000000000000000000000000000000000000000000000000000000000', -}; - -[ - pipeline('amd64'), - pipeline('arm64'), - close_coveralls, - noarch_pipeline, - notify_pipeline, - signature, -] diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index cad368960..000000000 --- a/.drone.yml +++ /dev/null @@ -1,563 +0,0 @@ ---- -{ - "depends_on": [ ], - "kind": "pipeline", - "name": "default-amd64", - "platform": { - "arch": "amd64", - "os": "linux" - }, - "steps": [ - { - "commands": [ - "install -d -o nobody -g nogroup /rspamd/build /rspamd/install /rspamd/fedora/build /rspamd/fedora/install" - ], - "image": "ubuntu:22.04", - "name": "prepare", - "pull": "if-not-exists", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "test \"$(id -un)\" = nobody", - "cd /rspamd/build", - "cmake -DCMAKE_INSTALL_PREFIX=/rspamd/install -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DENABLE_HYPERSCAN=ON -GNinja $DRONE_WORKSPACE\n", - "ncpu=$(getconf _NPROCESSORS_ONLN)", - "ninja -j $ncpu install", - "ninja -j $ncpu rspamd-test", - "ninja -j $ncpu rspamd-test-cxx" - ], - "depends_on": [ - "prepare" - ], - "image": "rspamd/ci:ubuntu-build", - "name": "build", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "test \"$(id -un)\" = nobody", - "cd /rspamd/fedora/build", - "export LDFLAGS='-fuse-ld=lld'", - "export ASAN_OPTIONS=detect_leaks=0", - "cmake -DCMAKE_INSTALL_PREFIX=/rspamd/fedora/install -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_CLANG_PLUGIN=ON -DENABLE_FULL_DEBUG=ON -DENABLE_HYPERSCAN=ON -DSANITIZE=address $DRONE_WORKSPACE\n", - "ncpu=$(getconf _NPROCESSORS_ONLN)", - "make -j $ncpu install", - "make -j $ncpu rspamd-test", - "make -j $ncpu rspamd-test-cxx" - ], - "depends_on": [ - "prepare" - ], - "image": "rspamd/ci:fedora-build", - "name": "build-clang", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "test \"$(id -un)\" = nobody", - "ulimit -c unlimited", - "cd /rspamd/build/test", - "set +e", - "env RSPAMD_LUA_EXPENSIVE_TESTS=1 ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?", - "set -e", - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test.core ./rspamd-test; exit $EXIT_CODE; fi; if [ $EXIT_CODE -ne 0 ]; then exit $EXIT_CODE; fi\n", - "luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun", - "set +e", - "./rspamd-test-cxx -s; EXIT_CODE=$?", - "set -e", - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test-cxx.core ./rspamd-test-cxx; exit $EXIT_CODE; fi\n", - "exit $EXIT_CODE" - ], - "depends_on": [ - "build" - ], - "image": "rspamd/ci:ubuntu-test", - "name": "rspamd-test", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "test \"$(id -un)\" = nobody", - "ulimit -c 2097152", - "ulimit -s unlimited", - "export ASAN_OPTIONS=\"detect_leaks=0:print_stacktrace=1:disable_coredump=0\"", - "export UBSAN_OPTIONS=\"print_stacktrace=1:print_summary=0:log_path=/tmp/ubsan\"", - "cd /rspamd/fedora/build/test", - "set +e", - "env RSPAMD_LUA_EXPENSIVE_TESTS=1 ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?", - "set -e", - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'bt' -c /var/tmp/*.rspamd-test.core ./rspamd-test; fi\n", - "set +e", - "./rspamd-test-cxx -s; EXIT_CODE=$?", - "set -e", - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test-cxx.core ./rspamd-test-cxx; exit $EXIT_CODE; fi\n", - "cat /tmp/ubsan.* || true", - "exit $EXIT_CODE" - ], - "depends_on": [ - "build-clang" - ], - "image": "rspamd/ci:fedora-test", - "name": "test-fedora-clang", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "cd /rspamd/build", - "ulimit -c unlimited", - "ulimit -s unlimited", - "set +e", - "RSPAMD_INSTALLROOT=/rspamd/install robot --removekeywords wuks --exclude isbroken $DRONE_WORKSPACE/test/functional/cases; EXIT_CODE=$?", - "set -e", - "if [ -n \"$HTTP_PUT_AUTH\" ]; then $DRONE_WORKSPACE/test/tools/http_put.py log.html report.html https://$DRONE_SYSTEM_HOSTNAME/testlogs/$DRONE_REPO/${DRONE_BUILD_NUMBER}-amd64/; fi\n", - "core_files=$(find /var/tmp/ -name '*.core')", - "for core in $core_files; do exe=$(gdb --batch -ex 'info proc mappings' -c $core | tail -1 | awk '{print $5}'); gdb --batch -ex 'bt' -c $core $exe; echo '---'; done\n", - "exit $EXIT_CODE" - ], - "depends_on": [ - "build" - ], - "environment": { - "HTTP_PUT_AUTH": { - "from_secret": "http_put_auth" - } - }, - "image": "rspamd/ci:ubuntu-test-func", - "name": "functional", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "cd /rspamd/build", - "$DRONE_WORKSPACE/test/tools/gcov_coveralls.py --exclude test --prefix /rspamd/build --prefix $DRONE_WORKSPACE --out coverage.c.json", - "luacov-coveralls -o coverage.functional.lua.json --dryrun", - "$DRONE_WORKSPACE/test/tools/merge_coveralls.py --parallel --root $DRONE_WORKSPACE --input coverage.c.json unit_test_lua.json coverage.functional.lua.json --token=$COVERALLS_REPO_TOKEN" - ], - "depends_on": [ - "functional", - "rspamd-test" - ], - "environment": { - "COVERALLS_REPO_TOKEN": { - "from_secret": "coveralls_repo_token" - } - }, - "image": "rspamd/ci:ubuntu-test", - "name": "send-coverage", - "pull": "if-not-exists", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ], - "when": { - "branch": [ - "master" - ], - "event": [ - "push", - "tag" - ] - } - } - ], - "trigger": { - "event": [ - "push", - "tag", - "custom", - "pull_request" - ] - }, - "type": "docker", - "volumes": [ - { - "name": "rspamd", - "temp": { } - } - ] -} ---- -{ - "depends_on": [ ], - "kind": "pipeline", - "name": "default-arm64", - "platform": { - "arch": "arm64", - "os": "linux" - }, - "steps": [ - { - "commands": [ - "install -d -o nobody -g nogroup /rspamd/build /rspamd/install /rspamd/fedora/build /rspamd/fedora/install" - ], - "image": "ubuntu:22.04", - "name": "prepare", - "pull": "if-not-exists", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "test \"$(id -un)\" = nobody", - "cd /rspamd/build", - "cmake -DCMAKE_INSTALL_PREFIX=/rspamd/install -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DENABLE_HYPERSCAN=ON -DHYPERSCAN_ROOT_DIR=/vectorscan -GNinja $DRONE_WORKSPACE\n", - "ncpu=$(getconf _NPROCESSORS_ONLN)", - "ninja -j $ncpu install", - "ninja -j $ncpu rspamd-test", - "ninja -j $ncpu rspamd-test-cxx" - ], - "depends_on": [ - "prepare" - ], - "image": "rspamd/ci:ubuntu-build", - "name": "build", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "test \"$(id -un)\" = nobody", - "cd /rspamd/fedora/build", - "export LDFLAGS='-fuse-ld=lld'", - "export ASAN_OPTIONS=detect_leaks=0", - "cmake -DCMAKE_INSTALL_PREFIX=/rspamd/fedora/install -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_CLANG_PLUGIN=ON -DENABLE_FULL_DEBUG=ON -DENABLE_HYPERSCAN=ON -DHYPERSCAN_ROOT_DIR=/vectorscan -DSANITIZE=address $DRONE_WORKSPACE\n", - "ncpu=$(getconf _NPROCESSORS_ONLN)", - "make -j $ncpu install", - "make -j $ncpu rspamd-test", - "make -j $ncpu rspamd-test-cxx" - ], - "depends_on": [ - "prepare" - ], - "image": "rspamd/ci:fedora-build", - "name": "build-clang", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "test \"$(id -un)\" = nobody", - "ulimit -c unlimited", - "cd /rspamd/build/test", - "set +e", - "env RSPAMD_LUA_EXPENSIVE_TESTS=1 ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?", - "set -e", - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test.core ./rspamd-test; exit $EXIT_CODE; fi; if [ $EXIT_CODE -ne 0 ]; then exit $EXIT_CODE; fi\n", - "luacov-coveralls -o /rspamd/build/unit_test_lua.json --dryrun", - "set +e", - "./rspamd-test-cxx -s; EXIT_CODE=$?", - "set -e", - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test-cxx.core ./rspamd-test-cxx; exit $EXIT_CODE; fi\n", - "exit $EXIT_CODE" - ], - "depends_on": [ - "build" - ], - "image": "rspamd/ci:ubuntu-test", - "name": "rspamd-test", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "test \"$(id -un)\" = nobody", - "ulimit -c 2097152", - "ulimit -s unlimited", - "export ASAN_OPTIONS=\"detect_leaks=0:print_stacktrace=1:disable_coredump=0\"", - "export UBSAN_OPTIONS=\"print_stacktrace=1:print_summary=0:log_path=/tmp/ubsan\"", - "cd /rspamd/fedora/build/test", - "set +e", - "env RSPAMD_LUA_EXPENSIVE_TESTS=1 ./rspamd-test -p /rspamd/lua; EXIT_CODE=$?", - "set -e", - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'bt' -c /var/tmp/*.rspamd-test.core ./rspamd-test; fi\n", - "set +e", - "./rspamd-test-cxx -s; EXIT_CODE=$?", - "set -e", - "if [ $EXIT_CODE -gt 128 ]; then gdb --batch -ex 'thread apply all bt full' -c /var/tmp/*.rspamd-test-cxx.core ./rspamd-test-cxx; exit $EXIT_CODE; fi\n", - "cat /tmp/ubsan.* || true", - "exit $EXIT_CODE" - ], - "depends_on": [ - "build-clang" - ], - "image": "rspamd/ci:fedora-test", - "name": "test-fedora-clang", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "cd /rspamd/build", - "ulimit -c unlimited", - "ulimit -s unlimited", - "set +e", - "RSPAMD_INSTALLROOT=/rspamd/install robot --removekeywords wuks --exclude isbroken $DRONE_WORKSPACE/test/functional/cases; EXIT_CODE=$?", - "set -e", - "if [ -n \"$HTTP_PUT_AUTH\" ]; then $DRONE_WORKSPACE/test/tools/http_put.py log.html report.html https://$DRONE_SYSTEM_HOSTNAME/testlogs/$DRONE_REPO/${DRONE_BUILD_NUMBER}-arm64/; fi\n", - "core_files=$(find /var/tmp/ -name '*.core')", - "for core in $core_files; do exe=$(gdb --batch -ex 'info proc mappings' -c $core | tail -1 | awk '{print $5}'); gdb --batch -ex 'bt' -c $core $exe; echo '---'; done\n", - "exit $EXIT_CODE" - ], - "depends_on": [ - "build" - ], - "environment": { - "HTTP_PUT_AUTH": { - "from_secret": "http_put_auth" - } - }, - "image": "rspamd/ci:ubuntu-test-func", - "name": "functional", - "pull": "always", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ] - }, - { - "commands": [ - "cd /rspamd/build", - "$DRONE_WORKSPACE/test/tools/gcov_coveralls.py --exclude test --prefix /rspamd/build --prefix $DRONE_WORKSPACE --out coverage.c.json", - "luacov-coveralls -o coverage.functional.lua.json --dryrun", - "$DRONE_WORKSPACE/test/tools/merge_coveralls.py --parallel --root $DRONE_WORKSPACE --input coverage.c.json unit_test_lua.json coverage.functional.lua.json --token=$COVERALLS_REPO_TOKEN" - ], - "depends_on": [ - "functional", - "rspamd-test" - ], - "environment": { - "COVERALLS_REPO_TOKEN": { - "from_secret": "coveralls_repo_token" - } - }, - "image": "rspamd/ci:ubuntu-test", - "name": "send-coverage", - "pull": "if-not-exists", - "volumes": [ - { - "name": "rspamd", - "path": "/rspamd" - } - ], - "when": { - "branch": [ - "master" - ], - "event": [ - "push", - "tag" - ] - } - } - ], - "trigger": { - "event": [ - "push", - "tag", - "custom", - "pull_request" - ] - }, - "type": "docker", - "volumes": [ - { - "name": "rspamd", - "temp": { } - } - ] -} ---- -{ - "depends_on": [ - "default-amd64", - "default-arm64" - ], - "kind": "pipeline", - "name": "close_coveralls", - "steps": [ - { - "commands": [ - "$DRONE_WORKSPACE/test/tools/merge_coveralls.py --parallel-close --token=$COVERALLS_REPO_TOKEN" - ], - "environment": { - "COVERALLS_REPO_TOKEN": { - "from_secret": "coveralls_repo_token" - } - }, - "image": "rspamd/ci:ubuntu-test-func", - "name": "close_coveralls", - "pull": "always" - } - ], - "trigger": { - "branch": [ - "master" - ], - "event": [ - "push", - "tag" - ], - "status": [ - "success", - "failure" - ] - }, - "type": "docker" -} ---- -{ - "kind": "pipeline", - "name": "default-noarch", - "steps": [ - { - "commands": [ - "tidyall --version", - "perltidy --version | head -1", - "tidyall --all --check-only --no-cache --data-dir /tmp/tidyall" - ], - "failure": "ignore", - "image": "rspamd/ci:perl-tidyall", - "name": "perl-tidyall", - "pull": "if-not-exists" - }, - { - "commands": [ - "npm install", - "npm ls", - "./node_modules/.bin/eslint ./", - "./node_modules/.bin/stylelint ./**/*.css ./**/*.html ./**/*.js" - ], - "failure": "ignore", - "image": "node:18-alpine", - "name": "eslint", - "pull": "if-not-exists" - }, - { - "commands": [ - "luacheck -q --no-color ." - ], - "image": "pipelinecomponents/luacheck", - "name": "luacheck", - "pull": "if-not-exists" - } - ], - "trigger": { - "event": [ - "push", - "tag", - "custom", - "pull_request" - ] - }, - "type": "docker" -} ---- -{ - "depends_on": [ - "default-amd64", - "default-arm64", - "default-noarch" - ], - "kind": "pipeline", - "name": "notify", - "steps": [ - { - "image": "drillster/drone-email", - "name": "notify", - "pull": "if-not-exists", - "settings": { - "from": "noreply@rspamd.com", - "host": { - "from_secret": "email_host" - }, - "password": { - "from_secret": "email_password" - }, - "username": { - "from_secret": "email_username" - } - } - } - ], - "trigger": { - "event": [ - "push", - "tag", - "custom" - ], - "status": [ - "failure" - ] - }, - "type": "docker" -} ---- -{ - "hmac": "2351718d9a562ea71ff344fb39fcf4ad5dae5b9694219b933c1b63a8b87d2aa5", - "kind": "signature" -} -... diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..6544bd3f0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: ci + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + linters: + uses: ./.github/workflows/ci_linters.yml + + fedora: + uses: ./.github/workflows/ci_rspamd.yml + with: + image: ghcr.io/fatalbanana/gha-images:fedora-ci + name: fedora-ci + + ubuntu: + uses: ./.github/workflows/ci_rspamd.yml + with: + image: ghcr.io/fatalbanana/gha-images:ubuntu-ci + name: ubuntu-ci diff --git a/.github/workflows/ci_eslint.yml b/.github/workflows/ci_eslint.yml new file mode 100644 index 000000000..e7220d468 --- /dev/null +++ b/.github/workflows/ci_eslint.yml @@ -0,0 +1,25 @@ +name: ci_eslint + +on: + workflow_call: + +jobs: + eslint: + runs-on: ubuntu-latest + container: + image: node:18-alpine + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Install dependencies + run: npm install + + - name: Show installed packages + run: npm ls + + - name: Run eslint + run: ./node_modules/.bin/eslint ./ + + - name: Run stylelint + run: ./node_modules/.bin/stylelint ./**/*.css ./**/*.html ./**/*.js diff --git a/.github/workflows/ci_linters.yml b/.github/workflows/ci_linters.yml new file mode 100644 index 000000000..6df1a4480 --- /dev/null +++ b/.github/workflows/ci_linters.yml @@ -0,0 +1,14 @@ +name: ci_linters + +on: + workflow_call: + +jobs: + eslint: + uses: ./.github/workflows/ci_eslint.yml + + luacheck: + uses: ./.github/workflows/ci_luacheck.yml + + tidyall: + uses: ./.github/workflows/ci_tidyall.yml diff --git a/.github/workflows/ci_luacheck.yml b/.github/workflows/ci_luacheck.yml new file mode 100644 index 000000000..d930fdae5 --- /dev/null +++ b/.github/workflows/ci_luacheck.yml @@ -0,0 +1,16 @@ +name: ci_luacheck + +on: + workflow_call: + +jobs: + luacheck: + runs-on: ubuntu-latest + container: + image: pipelinecomponents/luacheck + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Run luacheck + run: luacheck -q --no-color . diff --git a/.github/workflows/ci_rspamd.yml b/.github/workflows/ci_rspamd.yml new file mode 100644 index 000000000..7c32e1cdc --- /dev/null +++ b/.github/workflows/ci_rspamd.yml @@ -0,0 +1,99 @@ +name: rspamd_test + +on: + workflow_call: + inputs: + image: + required: true + type: string + name: + required: true + type: string + +env: + CTEST_OUTPUT_ON_FAILURE: 1 + JOB_WORKDIR: ${{ github.workspace }}/${{ github.job }}-${{ inputs.name }}-${{ github.run_number }} + RSPAMD_LUA_EXPENSIVE_TESTS: 1 + +jobs: + test: + runs-on: ["self-hosted", "linux", "${{ matrix.arch }}"] + strategy: + matrix: + arch: [ARM64, X64] + container: + image: ${{ inputs.image }} + steps: + - name: Create directories + run: | + sudo mkdir -p ${JOB_WORKDIR} + sudo chown -R build:build ${JOB_WORKDIR} + + - name: Check out the repo + run: | + cd ${JOB_WORKDIR} + git clone ${{ github.server_url }}/${{ github.repository }} --branch ${{ github.ref_name }} --single-branch src + + - name: Set variables on ARM64 + if: runner.arch == 'ARM64' + run: echo "HYPERSCAN_ALTROOT=-DHYPERSCAN_ROOT_DIR=/vectorscan" >> "$GITHUB_ENV" + + - name: Run cmake + run: | + mkdir ${JOB_WORKDIR}/build + cd ${JOB_WORKDIR}/build + cmake -DCMAKE_INSTALL_PREFIX=${JOB_WORKDIR}/install -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DENABLE_HYPERSCAN=ON ${{ env.HYPERSCAN_ALTROOT }} -GNinja ${JOB_WORKDIR}/src + + - name: Build rspamd + run: | + cd ${JOB_WORKDIR}/build + ncpu=$(getconf _NPROCESSORS_ONLN) + ninja -j $ncpu install + ninja -j $ncpu rspamd-test + ninja -j $ncpu rspamd-test-cxx + + - name: Run unit tests + if: "!(inputs.name == 'ubuntu-ci' && runner.arch == 'ARM64')" + run: | + cd ${JOB_WORKDIR}/build + ninja test + + - name: Apply Fedora specifics + if: inputs.name == 'fedora-ci' + run: | + sudo mv /usr/bin/miltertest /usr/bin/miltertest.is.broken.on.fedora || true + + - name: Run functional tests + run: | + cd ${JOB_WORKDIR}/build + ulimit -c unlimited + ulimit -s unlimited + set +e + RSPAMD_INSTALLROOT=${JOB_WORKDIR}/install robot --removekeywords wuks --exclude isbroken ${JOB_WORKDIR}/src/test/functional/cases; EXIT_CODE=$? + set -e + core_files=$(find /var/tmp/ -name '*.core') + for core in $core_files; do exe=$(gdb --batch -ex 'info proc mappings' -c $core | tail -1 | awk '{print $5}'); gdb --batch -ex 'bt' -c $core $exe; echo '---'; done + exit $EXIT_CODE + + # FIXME: upload test logs even on ARM + - name: Upload robot logs + if: runner.arch == 'X64' && (success() || failure()) + uses: actions/upload-artifact@v4 + with: + name: robotlog-${{ inputs.name }} + path: | + ${{ env.JOB_WORKDIR }}/build/*.*ml + retention-days: 1 + + - name: Upload rspamd logs + if: runner.arch == 'X64' && (success() || failure()) + uses: actions/upload-artifact@v4 + with: + name: rspamdlog-${{ inputs.name }} + path: ${{ env.JOB_WORKDIR }}/build/robot-save + retention-days: 1 + + - name: Cleanup working directory + if: always() + run: | + sudo rm -rf ${JOB_WORKDIR} diff --git a/.github/workflows/ci_tidyall.yml b/.github/workflows/ci_tidyall.yml new file mode 100644 index 000000000..af22d8c3a --- /dev/null +++ b/.github/workflows/ci_tidyall.yml @@ -0,0 +1,23 @@ +name: ci_tidyall + +on: + workflow_call: + +jobs: + tidyall: + runs-on: ubuntu-latest + container: + image: rspamd/ci:perl-tidyall + options: --user root + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Show tidyall version + run: tidyall --version + + - name: Show perltidy version + run: perltidy --version | head -1 + + - name: Run tidyall + run: tidyall --all --check-only --no-cache --data-dir /tmp/tidyall |