From 67dfafddc12639c08ab71d4d4fdedc46cec1a465 Mon Sep 17 00:00:00 2001 From: TJ Saunders Date: Sat, 26 Jun 2021 08:45:18 -0700 Subject: [PATCH] Move from Travis to GitHub Actions for our CI needs. --- .github/workflows/ci.yml | 136 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 41 ------------ README.md | 2 +- fsio.c | 4 +- t/Makefile.in | 8 +-- 5 files changed, 143 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..514948a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,136 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + compiler: + - gcc + - clang + + container: ubuntu:18.04 + + steps: + - name: Install git + run: | + apt-get update -qq + apt-get install -y git + + - name: Checkout ProFTPD + run: | + git clone --depth 1 https://github.com/proftpd/proftpd.git proftpd + + - name: Checkout module source code + uses: actions/checkout@v2 + with: + path: proftpd/contrib/mod_vroot + + - name: Whitespace check + run: | + cd proftpd/contrib/mod_vroot + if [[ -n $(git diff --check HEAD^) ]]; then + echo "You must remove whitespace before submitting a pull request" + echo "" + git diff --check HEAD^ + exit 1 + fi + + - name: Install packages + run: | + # Need to add other repos for e.g. libsodium + apt-get update -qq + # for builds + apt-get install -y git make + # for unit tests + apt-get install -y check libsubunit-dev + + # module dependencies, if any + + # for integration/regression test + # for test code coverage + apt-get install -y lcov ruby + gem install coveralls-lcov + # for HTML validation + apt-get install -y tidy + # for clang + apt-get install -y clang + # for debugging + clang --version + gcc --version + + - name: Prepare code coverage + run: | + lcov --directory proftpd --zerocounters + + - name: Build with static modules + env: + CC: ${{ matrix.compiler }} + run: | + cd proftpd + ./configure LIBS="-lm -lsubunit -lrt -pthread" --enable-devel=coverage --enable-tests --with-modules=mod_vroot + make + + - name: Run unit tests + env: + CC: ${{ matrix.compiler }} + run: | + cd proftpd/contrib/mod_vroot + make TEST_VERBOSE=1 check + + - name: Install with static modules + run: | + cd proftpd + make install + + - name: Build with shared modules + env: + CC: ${{ matrix.compiler }} + run: | + cd proftpd + make clean + ./configure LIBS="-lm -lsubunit -lrt -pthread" --enable-devel --enable-dso --with-shared=mod_vroot + make + + - name: Install with shared modules + run: | + cd proftpd + make install + + # https://github.com/google/sanitizers/wiki/AddressSanitizer + # https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer + # https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html + # + # NOTE: Using MemorySanitizer is desirable, but currently unusable since + # libcheck is not instrumented, resulting in unsuppressible false + # positives. + - name: Run unit tests under asan+lsan+ubsan + env: + ASAN_OPTIONS: abort_on_error=1,check_initialization_order=true,debug=true,detect_invalid_pointer_pairs=2,detect_leaks=1,detect_stack_use_after_return=true,strict_string_checks=true,verbosity=0 + CC: ${{ matrix.compiler }} + CFLAGS: -fsanitize=address,undefined + LDFLAGS: -fsanitize=address,undefined --coverage + if: ${{ matrix.compiler == 'clang' }} + run: | + cd proftpd + make clean + ./configure LIBS="-lm -lsubunit -lrt -pthread" --enable-devel --enable-tests --with-modules=mod_vroot + make + cd contrib/mod_vroot + export ASAN_SYMBOLIZER_PATH=$(readlink -f $(which llvm-symbolizer-10)) + make TEST_VERBOSE=1 check + + - name: Check HTML docs + run: | + cd proftpd/contrib/mod_vroot + echo "Processing mod_vroot.html" + tidy -errors -omit -q mod_vroot.html | exit 0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0da2a4b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -env: TRAVIS_CI=true -language: c - -compiler: - - gcc - - clang - -install: - - sudo apt-get update -qq - # for unit tests - - sudo apt-get install -y check - - sudo apt-get install -y libsubunit-dev - # for static code analysis - # - sudo apt-get install -y cppcheck - # - sudo apt-get install -y rats - # for test code coverage - - sudo apt-get install -y lcov - - gem install coveralls-lcov - -before_script: - - cd ${TRAVIS_BUILD_DIR} - - lcov --directory . --zerocounters - -script: - # - find . -type f -name "*.c" -print | grep -v t\/ | xargs cppcheck 2>&1 - # - find . -type f -name "*.c" -print | grep -v t\/ | xargs rats --language=c - - git clone --depth 10 https://github.com/proftpd/proftpd.git - - mkdir -p proftpd/contrib/mod_vroot/ - - cp *.[ch] proftpd/contrib/mod_vroot/ - - cp mod_vroot.* proftpd/contrib/mod_vroot/ - - cp Makefile.in proftpd/contrib/mod_vroot/ - - cp config* proftpd/contrib/mod_vroot/ - - cp install-sh proftpd/contrib/mod_vroot/ - - cp -R t/ proftpd/contrib/mod_vroot/t/ - - cd proftpd - - ./configure LIBS='-lm -lsubunit -lrt -pthread' --enable-devel=coverage --enable-dso --enable-tests --with-shared=mod_vroot - - make - - make clean - - ./configure LIBS='-lm -lsubunit -lrt -pthread' --enable-devel=coverage --enable-tests --with-modules=mod_vroot - - make - - cd contrib/mod_vroot && make TEST_VERBOSE=1 check && cd ../../ diff --git a/README.md b/README.md index 94620dd..30f4e97 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ proftpd-mod_vroot Status ------ -[![Build Status](https://travis-ci.org/Castaglia/proftpd-mod_vroot.svg?branch=master)](https://travis-ci.org/Castaglia/proftpd-mod_vroot) +[![GitHub Actions CI Status](https://github.com/Castaglia/proftpd-mod_vroot/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Castaglia/proftpd-mod_vroot/actions/workflows/ci.yml) [![License](https://img.shields.io/badge/license-GPL-brightgreen.svg)](https://img.shields.io/badge/license-GPL-brightgreen.svg) Synopsis diff --git a/fsio.c b/fsio.c index 94fac65..325852b 100644 --- a/fsio.c +++ b/fsio.c @@ -1,6 +1,6 @@ /* * ProFTPD: mod_vroot FSIO API - * Copyright (c) 2002-2017 TJ Saunders + * Copyright (c) 2002-2021 TJ Saunders * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -893,7 +893,7 @@ struct dirent *vroot_fsio_readdir(pr_fs_t *fs, void *dirh) { } else { if (vroot_dir_idx < 0 || - vroot_dir_idx >= vroot_dir_aliases->nelts) { + (unsigned int) vroot_dir_idx >= vroot_dir_aliases->nelts) { return NULL; } diff --git a/t/Makefile.in b/t/Makefile.in index 9143a64..9269b5c 100644 --- a/t/Makefile.in +++ b/t/Makefile.in @@ -11,8 +11,8 @@ include $(top_srcdir)/Make.rules # Necessary redefinitions INCLUDES=-I. -I.. -I$(module_srcdir)/include -I../../.. -I../../../include @INCLUDES@ -CPPFLAGS= $(ADDL_CPPFLAGS) -DHAVE_CONFIG_H $(DEFAULT_PATHS) $(PLATFORM) $(INCLUDES) -LDFLAGS=-L$(top_srcdir)/lib @LIBDIRS@ +TEST_CPPFLAGS=$(ADDL_CPPFLAGS) -DHAVE_CONFIG_H $(DEFAULT_PATHS) $(PLATFORM) $(INCLUDES) +TEST_LDFLAGS=-L$(top_srcdir)/lib @LIBDIRS@ EXEEXT=@EXEEXT@ @@ -56,10 +56,10 @@ TEST_API_OBJS=\ dummy: api/.c.o: - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< + $(CC) $(CPPFLAGS) $(TEST_CPPFLAGS) $(CFLAGS) -c $< api-tests$(EXEEXT): $(TEST_API_OBJS) $(TEST_API_DEPS) - $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) -o $@ $(TEST_API_DEPS) $(TEST_API_OBJS) $(TEST_API_LIBS) $(LIBS) + $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(TEST_LDFLAGS) -o $@ $(TEST_API_DEPS) $(TEST_API_OBJS) $(TEST_API_LIBS) $(LIBS) ./$@ clean: