Skip to content

Commit

Permalink
Merge 72830db into 1bc8208
Browse files Browse the repository at this point in the history
  • Loading branch information
nima authored Jan 10, 2017
2 parents 1bc8208 + 72830db commit 636aa8b
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 111 deletions.
50 changes: 33 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: c #. Not really, it's actually bash
language: bash

sudo: required

branches:
only:
Expand All @@ -18,25 +20,39 @@ env:
- PATH="${PATH}:${HOME}/bin"
matrix:
- CONTEXT=installer MODULE=-
- CONTEXT=execute MODULE=core
- CONTEXT=execute MODULE=cpf
- CONTEXT=execute MODULE=dns
- CONTEXT=execute MODULE=git
- CONTEXT=execute MODULE=gpg
- CONTEXT=execute MODULE=help
- CONTEXT=execute MODULE=hgd
- CONTEXT=execute MODULE=net
- CONTEXT=execute MODULE=remote
- CONTEXT=execute MODULE=tunnel
# CONTEXT=execute MODULE=tutorial
- CONTEXT=execute MODULE=util
- CONTEXT=execute MODULE=vault
- CONTEXT=execute MODULE=xplm
- CONTEXT=execute MODULE=core
- CONTEXT=coverage MODULE=core
- CONTEXT=execute MODULE=cpf
- CONTEXT=coverage MODULE=cpf
- CONTEXT=execute MODULE=dns
- CONTEXT=execute MODULE=git
- CONTEXT=execute MODULE=gpg
- CONTEXT=execute MODULE=help
- CONTEXT=coverage MODULE=help
- CONTEXT=execute MODULE=hgd
- CONTEXT=execute MODULE=net
- CONTEXT=execute MODULE=remote
# CONTEXT=execute MODULE=tunnel
# CONTEXT=execute MODULE=tutorial
- CONTEXT=execute MODULE=util
- CONTEXT=execute MODULE=vault
# CONTEXT=execute MODULE=xplm

matrix:
allow_failures:
- env: CONTEXT=execute MODULE=tunnel
- env: CONTEXT=execute MODULE=xplm
- env: CONTEXT=coverage MODULE=dns
- env: CONTEXT=coverage MODULE=git
- env: CONTEXT=coverage MODULE=gpg
- env: CONTEXT=coverage MODULE=hgd
- env: CONTEXT=coverage MODULE=net
- env: CONTEXT=coverage MODULE=remote
- env: CONTEXT=coverage MODULE=tunnel
- env: CONTEXT=execute MODULE=tunnel
- env: CONTEXT=coverage MODULE=tutorial
- env: CONTEXT=coverage MODULE=util
- env: CONTEXT=coverage MODULE=vault
- env: CONTEXT=coverage MODULE=xplm
- env: CONTEXT=execute MODULE=xplm

before_install:
- sudo apt-get update -qq
Expand Down
66 changes: 5 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,11 @@
[![views](https://sourcegraph.com/api/repos/github.com/schtunt/simbol/counters/views.png)](https://sourcegraph.com/github.com/schtunt/simbol)
[![authors](https://sourcegraph.com/api/repos/github.com/schtunt/simbol/badges/authors.png)](https://sourcegraph.com/github.com/schtunt/simbol)
[![status](https://sourcegraph.com/api/repos/github.com/schtunt/simbol/badges/status.png)](https://sourcegraph.com/github.com/schtunt/simbol)

# `gh-pages` README
You are probably looking for this [README](https://github.com/schtunt/simbol/blob/gh-pages/README.md), or the corresponding [homepage](https://schtunt.github.io/simbol/).

---
# README
Please note that this README doesn't cover what `simbol` is (that is covered in the [homepage](https://schtunt.github.io/simbol/)), but focuses instead on the current status of simbol development.

## Development Status
<!--
We use moons to illustrate code-complete status.
:new_moon:
:waxing_crescent_moon:
:first_quarter_moon:
:waxing_gibbous_moon:
:full_moon:
:waning_gibbous_moon:
:last_quarter_moon:
:waning_crescent_moon:
:new_moon:
-->

Here are the currently developing/developed simbol modules:

| Core Module | Code-Complete | Description |
| ------------- | ----------------------- | ------------------------------------------------------------------- |
| unit | :waning_gibbous_moon: | Core Unit-Testing module |
| util | :full_moon: | Core utilities module |
| help | :full_moon: | Core help module |
| hgd | :waning_gibbous_moon: | Core HGD (Host-Group Directive) module |
| net | :full_moon: | Core networking module |
| gpg | :full_moon: | Core GNUPG module |
| vault | :full_moon: | Core vault and secrets management module |
| remote | :waning_gibbous_moon: | The simbol remote access/execution module (ssh, ssh/sudo, tmux, etc.) |
| git | :full_moon: | Auxiliary Git helper module |
| dns | :full_moon: | Core DNS module |
| tunnel | :full_moon: | Secure shell tunnelling wrapper |
| rb | :waning_gibbous_moon: | Interface to Ruby sandbox via `xplm` |
| py | :waning_gibbous_moon: | Interface to Python sandbox via `xplm` |
| pl | :waning_gibbous_moon: | Interface to Perl sandbox via `xplm` (via `rbenv`, `pyenv`, and `plenv' |
| xplm | :waning_gibbous_moon: | Interface to Ruby, Python, and Perl sandboxes |
| tutorial | :waning_crescent_moon: | The simbol module aims to serve as a tutorial for new simbol users |

And here is their relationship with one-another; i.e., the dependecy graph of the core primary simbol modules:
![Module Dependencies](https://dl.dropboxusercontent.com/u/68796871/projects/Site/dependencies.png)

The following set of modules are generally only useful under special-circumstances, and so are disabled by default:

| Alpha Modules | Code-Complete | Description |
| ------------- | ----------------------- | ------------------------------------------------------------------- |
| ng | :last_quarter_moon: | Core Netgroup module |
| ldap | :last_quarter_moon: | The simbol LDAP module |
| pagerduty | :new_moon: | PagerDuty CLI interface |
The Simbol README is maintained in the [GitHub Pages README](https://github.com/schtunt/simbol/blob/gh-pages/README.md), or the corresponding [homepage](https://schtunt.github.io/simbol/) branch.

---

# Build Status
Here are the current build statuses of the various GitHub branches of simbol:

| Branch | Status |
|------------|--------|
| `master` | [![Build Status](https://travis-ci.org/schtunt/simbol.png?branch=master)](https://travis-ci.org/schtunt/simbol/branches) |
| `develop` | [![Build Status](https://travis-ci.org/schtunt/simbol.png?branch=develop)](https://travis-ci.org/schtunt/simbol/branches) |
| Branch | `travis.io` | `coveralls.io` | `codecov.io` |
|------------|-------------|----------------|--------------|
| `master` | [![Build Status](https://travis-ci.org/schtunt/simbol.png?branch=master)](https://travis-ci.org/schtunt/simbol/branches) | [![Coverage Status](https://coveralls.io/repos/github/schtunt/simbol/badge.svg?branch=master)](https://coveralls.io/github/schtunt/simbol?branch=master) | [![codecov](https://codecov.io/gh/schtunt/simbol/branch/master/graph/badge.svg)](https://codecov.io/gh/schtunt/simbol) |
| `develop` | [![Build Status](https://travis-ci.org/schtunt/simbol.png?branch=develop)](https://travis-ci.org/schtunt/simbol/branches) | [![Coverage Status](https://coveralls.io/repos/github/schtunt/simbol/badge.svg?branch=develop)](https://coveralls.io/github/schtunt/simbol?branch=develop) | [![codecov](https://codecov.io/gh/schtunt/simbol/branch/develop/graph/badge.svg)](https://codecov.io/gh/schtunt/simbol) |
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
codecov:
token: 8a343020-d6dd-4726-aa64-7e0c1ac5ad22
5 changes: 3 additions & 2 deletions module/unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ moduleScaffold() {
oneTimeSetUp() {
: ${module?}

cpf "%{@comment:unitSetUp...}"
cpf "%{@comment:unitSetUp...}\n"
local -i e=${CODE_SUCCESS?}

declare -gi tid=0
Expand Down Expand Up @@ -238,7 +238,8 @@ function testCoverage() {
if [ $count -gt 0 ]; then
local -a fns=(
$(grep -oE "${regex}" ${modulepath} |
sed -e "s/^function :\{0,2\}${module}:\([^.()]\+\)\(\.[a-z]\+\)\?()/\1/")
sed -e "s/^function :\{0,2\}${module}:\([^.()]\+\)\(\.[a-z]\+\)\?()/\1/"
)
)
for fn in ${fns[@]}; do
local utf="test${profile^}${modulecaps}${fn^}${context^}"
Expand Down
138 changes: 107 additions & 31 deletions share/unit/citm
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,16 @@
#.
#. See the short code below to figure out how those are used.

function run() {
echo "$ ${@}"
"${@}"
return $e
}

declare -g -A PACKAGES=(
[ALL]=make,coreutils,bash,sed,gawk,git,haveged
[gpg,vault,remote]=gnupg2,pwgen,xclip
[net]=iproute,net-tools,netcat,socat
[dns,remote]=dnsutils
[remote]=tmux,socat
[ALL]='make,coreutils,bash,sed,gawk,git,haveged'
[KCOV]='build-essential,pkg-config,python,libcurl4-openssl-dev,libelf-dev,libdw-dev,cmake'
[gpg,vault,remote]='gnupg2,pwgen,xclip'
[net]='iproute,net-tools,netcat,socat'
[dns,remote]='dnsutils'
[remote]='tmux,socat'
)

function apt_get_install_for() {
function citm:apt_get_install_for() {
local module="${1}"

local mcsv
Expand All @@ -43,26 +38,82 @@ function apt_get_install_for() {

local -a packages
IFS=, read -a packages <<< "${pkgcsv}"
run sudo apt-get install ${packages[@]}
citm:run sudo apt-get install -y ${packages[@]}
}

function citm:run() {
local -i e=9

echo "$ ${@}"
"${@}"
e=$?
echo "# exit status: $e"

return $e
}

function citm:kcov() {
local -i e=9

case "$#:$1" in
1:install)
citm:apt_get_install_for KCOV
e=$?

if [ $e -eq 0 ]; then
echo "$ citm:kcov install"
wget -q https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
tar xzf master.tar.gz
mkdir kcov-master/build
pushd kcov-master/build >/dev/null
cmake ..
make
sudo make install
e=$?
popd >/dev/null
rm -rf kcov-master master.tar.gz
fi

echo "# citm:kcov install exit status: $e"
;;
*:run)
shift
echo "$ citm:kcov run ${*}"
mkdir coverage
kcov coverage "$@"
e=$?
echo "# citm:kcov run exit status: $e"
;;
1:report)
echo "$ citm:kcov report codedov.io/bash"
bash <(curl -s https://codecov.io/bash)
e=$?
echo "# citm:kcov report exit status: $e"
;;
esac

return $e
}

declare -g EXIT=9
echo "#. travis[$1].${CONTEXT?}(${MODULE?}) -=["
echo "#. citm[$1].${CONTEXT?}(${MODULE?}) -=["
if [ $# -eq 1 ]; then
case $1 in
before_install)
EXIT=0
run sudo install -d /var/tmp -m 1777 ;((EXIT|=$?))
run sudo install -m 0644\

citm:run sudo install -d /var/tmp -m 1777 ;((EXIT|=$?))
citm:run sudo install -m 0644\
share/unit/files/apt.conf\
/etc/apt/apt.conf.d/99SiteUnitTest ;((EXIT|=$?))

apt_get_install_for ${MODULE} ;((EXIT|=$?))
citm:apt_get_install_for ${MODULE} ;((EXIT|=$?))
;;

install)
EXIT=0
run make install ;((EXIT|=$?))

citm:run make install ;((EXIT|=$?))
;;

before_script)
Expand All @@ -71,37 +122,62 @@ if [ $# -eq 1 ]; then

script)
EXIT=0

case ${CONTEXT}:${MODULE} in
installer:-)
run make uninstall ;((EXIT|=$?)) #. Test uninstall
run make install ;((EXIT|=$?)) #. Test reinstall
run make purge ;((EXIT|=$?)) #. Test purge
run make install ;((EXIT|=$?)) #. Test reinstall
;;
execute:core)
run simbol unit core ;((EXIT|=$?))
coverage:*)
citm:kcov install ;((EXIT|=$?)) #. Code Coverage installation
echo

if [ ${MODULE} == 'core' ]; then
citm:kcov run simbol unit core ;((EXIT|=$?))
else
citm:kcov run simbol unit test ${MODULE} ;((EXIT|=$?))
fi
echo

citm:kcov report ;((EXIT|=$?))
echo
;;

execute:*)
run simbol unit test ${MODULE} ;((EXIT|=$?))
if [ ${MODULE} == 'core' ]; then
citm:run simbol unit core ;((EXIT|=$?))
else
citm:run simbol unit test ${MODULE} ;((EXIT|=$?))
fi
echo
;;

installer:-)
citm:run make uninstall ;((EXIT|=$?)) #. Test uninstall
citm:run make install ;((EXIT|=$?)) #. Test reinstall
citm:run make purge ;((EXIT|=$?)) #. Test purge
citm:run make install ;((EXIT|=$?)) #. Test reinstall
;;

*:*)
EXIT=1
echo "WARN: No action for ${CONTEXT}:${MODULE}"
EXIT=0
;;
esac
;;

after_success)
EXIT=0
case ${CONTEXT}:${MODULE} in
execute:core)
;;
esac
EXIT=$?
;;

after_failure)
EXIT=0
run cat ~/.simbol/var/log/simbol.log
citm:run cat ~/.simbol/var/log/simbol.log
;;

after_script)
EXIT=0
run make uninstall ;((EXIT|=$?))
citm:run make uninstall ;((EXIT|=$?))
;;
esac
fi
Expand Down

0 comments on commit 636aa8b

Please sign in to comment.