Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Tests

on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: '37 13 * * 0'

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
# - 3.0
- 2.7
- 2.6

env:
EXPECTED_GPG_VERSION: "2.3"
GPG_VERSION: "latest"
RNP_VERSION: "v0.11.0"

steps:
- name: Set up environment
run: |

# To install and cache our dependencies we need an absolute path
# that does not change, is writable, and resides within
# GITHUB_WORKSPACE.
# On macOS GITHUB_WORKSPACE includes the github runner version,
# so it does not remain constant.
# This causes problems with, for example, pkgconfig files
# referencing paths that no longer exist.
export DEPS_BUILD_DIR="${{ github.workspace }}/build"
export DEPS_PREFIX="${{ github.workspace }}/opt"
export CACHE_DIR="${DEPS_PREFIX}"
export BOTAN_PREFIX="${DEPS_PREFIX}/botan"
export JSONC_PREFIX="${DEPS_PREFIX}/json-c"
export RNP_PREFIX="${DEPS_PREFIX}/rnp"
export GPG_PREFIX="${DEPS_PREFIX}/gpg"
export PATH="${RNP_PREFIX}/bin:${GPG_PREFIX}/bin:${PATH}"

# Many of these are supported only in few GPG components, hence bunch of
# harmless warnings typically shows up.
export GPG_CONFIGURE_OPTS="
--disable-doc \
--enable-pinentry-curses \
--disable-pinentry-emacs \
--disable-pinentry-gtk2 \
--disable-pinentry-gnome3 \
--disable-pinentry-qt \
--disable-pinentry-qt4 \
--disable-pinentry-qt5 \
--disable-pinentry-tqt \
--disable-pinentry-fltk \
--prefix=${GPG_PREFIX} \
--with-libgpg-error-prefix=${GPG_PREFIX} \
--with-libassuan-prefix=${GPG_PREFIX} \
--with-libgpg-error-prefix=${GPG_PREFIX} \
--with-libgcrypt-prefix=${GPG_PREFIX} \
--with-libassuan-prefix=${GPG_PREFIX} \
--with-ksba-prefix=${GPG_PREFIX} \
--with-npth-prefix=${GPG_PREFIX}"


# Be aware of differences between LD_LIBRARY_PATH and LD_RUN_PATH.
# - http://osr507doc.sco.com/en/tools/ccs_linkedit_dynamic_dirsearch.html
# - https://www.hpc.dtu.dk/?page_id=1180
#
# You should be careful when attempting to replicate following in your
# setup, because setting LD_LIBRARY_PATH is often a bad idea. Nevertheless,
# it is okay here in Travis, and actually any attempt to change these led me
# to linking failures. Side note: I am not a Linux expert, and you may be
# more lucky.
#
# I'd be happy to get rid of LD_LIBRARY_PATH eventually in some future
# pull request.
export LD_LIBRARY_PATH="${BOTAN_PREFIX}/lib:${JSONC_PREFIX}/lib:${RNP_PREFIX}/lib"
export LD_RUN_PATH="${GPG_PREFIX}/lib"

for i in \
CACHE_DIR \
DEPS_BUILD_DIR \
DEPS_PREFIX \
BOTAN_PREFIX \
JSONC_PREFIX \
RNP_PREFIX \
GPG_PREFIX \
PATH \
LD_LIBRARY_PATH \
LD_RUN_PATH \
; do \
echo "${i}=${!i}" >> $GITHUB_ENV; \
done

- uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: true

- name: Prepare cache key
run: |
echo "YEAR_MONTH=$(date +%Y%m)" >> "${GITHUB_ENV}"

- name: Cache
id: cache
uses: actions/cache@v2
with:
path: ${{ env.CACHE_DIR }}
key: ${{ github.workflow }}-${{ runner.os }}-${{ env.RNP_VERSION }}-${{ env.GPG_VERSION }}-gpg-${{ env.EXPECTED_GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }}-${{ env.YEAR_MONTH }}

- name: Build cache
if: steps.cache.outputs.cache-hit != 'true'
run: |
mkdir -p "${DEPS_PREFIX}"
pushd ci/gpg
./install_gpg_all.sh \
--suite-version "${GPG_VERSION}" \
--build-dir "${DEPS_BUILD_DIR}/gpg" \
--sudo --ldconfig \
--configure-opts "${GPG_CONFIGURE_OPTS}"
popd
pushd ci
./install_botan.sh
./install_json_c.sh
./install_rnp.sh
popd

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
env:
--env: ImageOS=ubuntu18

- name: Before script
run: |
bundle exec rake pgp_keys:generate
bundle exec rake pgp_keys:list

- name: Run tests
run: bundle exec rspec --format documentation --profile 200
94 changes: 0 additions & 94 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
ifdef::env-github[]
image:https://img.shields.io/gem/v/enmail.svg[
Gem Version, link="https://rubygems.org/gems/enmail"]
image:https://img.shields.io/travis/riboseinc/enmail/master.svg[
Build Status, link="https://travis-ci.com/riboseinc/enmail/branches"]
image:https://github.com/riboseinc/enmail/actions/workflows/tests.yml/badge.svg[
Build Status, link="https://github.com/riboseinc/enmail/actions/workflows/tests.yml"]
image:https://img.shields.io/codecov/c/github/riboseinc/enmail.svg[
Test Coverage, link="https://codecov.io/gh/riboseinc/enmail"]
image:https://img.shields.io/codeclimate/maintainability/riboseinc/enmail.svg[
Expand Down
45 changes: 45 additions & 0 deletions ci/botan-modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
aead
aes
auto_rng
bigint
blowfish
camellia
cast128
cbc
cfb
crc24
curve25519
des
dl_algo
dl_group
dsa
eax
ecc_key
ecdh
ecdsa
ed25519
elgamal
eme_pkcs1
emsa_pkcs1
emsa_raw
ffi
hash
hmac
hmac_drbg
idea
kdf
md5
ocb
pgp_s2k
rfc3394
rmd160
rsa
sha1
sha2_32
sha2_64
sha3
sm2
sm3
sm4
sp800_56a
twofish
36 changes: 25 additions & 11 deletions ci/install_botan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,35 @@

set -eux

: "${CORES:=2}"
: "${MAKE_PARALLEL:=2}"
: "${MAKE:=make}"
: "${BOTAN_MODULES=$(<./botan-modules tr '\n' ',')}"

botan_build="${DEPS_BUILD_DIR}/botan"
# Copied from rnp:ci/lib/cacheable_install_functions.inc.sh
install_botan() {
# botan
local botan_build=${LOCAL_BUILDS}/botan
if [[ ! -e "${BOTAN_INSTALL}/lib/libbotan-2.so" ]] && \
[[ ! -e "${BOTAN_INSTALL}/lib/libbotan-2.dylib" ]] && \
[[ ! -e "${BOTAN_INSTALL}/lib/libbotan-2.a" ]]; then

if [ ! -e "${BOTAN_PREFIX}/lib/libbotan-2.so" ] && \
[ ! -e "${BOTAN_PREFIX}/lib/libbotan-2.dylib" ]; then

if [ -d "${botan_build}" ]; then
if [[ -d "${botan_build}" ]]; then
rm -rf "${botan_build}"
fi

git clone --depth 1 https://github.com/randombit/botan "${botan_build}"
git clone --depth 1 --branch "${RECOMMENDED_BOTAN_VERSION}" https://github.com/randombit/botan "${botan_build}"
pushd "${botan_build}"
./configure.py --prefix="${BOTAN_PREFIX}" --with-debug-info --cxxflags="-fno-omit-frame-pointer"
${MAKE} -j${CORES} install
popd
fi

./configure.py --prefix="${BOTAN_INSTALL}" --with-debug-info --cxxflags="-fno-omit-frame-pointer" \
--without-documentation --without-openssl --build-targets=shared \
--minimized-build --enable-modules="$BOTAN_MODULES"
${MAKE} -j"${MAKE_PARALLEL}" install
popd
fi
}

export LOCAL_BUILDS="${DEPS_BUILD_DIR}"
export BOTAN_INSTALL="${BOTAN_PREFIX}"
export RECOMMENDED_BOTAN_VERSION="${BOTAN_VERSION:-2.17.3}"

install_botan
Loading