Skip to content

Commit

Permalink
Merge pull request #24 from Castaglia/github-ci-workflow
Browse files Browse the repository at this point in the history
Move from Travis to GitHub Actions for our CI needs.
  • Loading branch information
Castaglia authored Jun 26, 2021
2 parents 7c3227f + 67dfafd commit e842a90
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 48 deletions.
136 changes: 136 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions fsio.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions t/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e842a90

Please sign in to comment.