Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sbts committed Dec 26, 2019
2 parents 006566e + d1a2323 commit ea2f6d3
Show file tree
Hide file tree
Showing 738 changed files with 167,549 additions and 148,280 deletions.
181 changes: 181 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,181 @@
version: 2.1

#TODO: To enable matrix, Consider https://github.com/winksaville/circleci-matrix

# Define defaults
_defaults: &defaults
# Make sure that .profile is sourced for Perlbrew
shell: /bin/bash --login -eo pipefail

general:
branches:
ignore:
- /1\.2.*/
- /1\.3.*/
- /1\.4.*/
- /1\.5.*/
- /1\.6.*/

# Define aliases for simplification
aliases:
- &store_artifacts
store_artifacts:
path: /tmp/artifact/

# Reuseable commands
commands:
prove:
steps:
- run:
command: |
if [ "x$COVERAGE" == "x1" ]
then
export HARNESS_PERL_SWITCHES="$HARNESS_PERL_SWITCHES -MDevel::Cover=-ignore,^/|^utils/|^x?t/|\.lttc$,-blib,0"
fi
echo $PERL5OPT
echo $HARNESS_PERL_SWITCHES
echo $PWD
# Coverage explicitly without parallellism to prevent resource contention
# when Devel::Cover writes coverage database on process-exit
prove --recurse \
--pgtap-option dbname=lsmbinstalltest \
--pgtap-option username=postgres \
--pgtap-option psql=.circleci/psql-wrap \
--feature-option tags=~@wip t/ xt/
- run:
command: |
curl $PSGI_BASE_URL/stop.pl || true
while [ ! -e plackup-done ];
do
echo -n "."
sleep 1
done
echo " done"
- run:
command: |
mkdir -p /tmp/artifact/logs;
mkdir -p /tmp/artifact/screens;
cp logs/* /tmp/artifact/logs || true;
cp screens/* /tmp/artifact/screens || true;
when: always
- run:
name: Upload coverage data
command: |
if [ "x$COVERAGE" == "x1" ];
then
cover -report coveralls
cover -report text > /tmp/artifact/coverage.txt
fi
- *store_artifacts
prep_env:
description: "Prepare environment"
steps:
- checkout
- run:
name: Pull related Git repositories
command: |
git submodule sync
git submodule update --init
# Freshen up CPAN
- run:
name: Refresh modules from CPAN
command: |
cpanm --quiet --notest \
--with-develop \
--with-feature=starman \
--with-feature=latex-pdf-images \
--with-feature=latex-pdf-ps \
--with-feature=openoffice \
--with-feature=xls \
--with-feature=edi \
--installdeps .
cpanm --notest Starlet
if [ "x$COVERAGE" == "x1" ]
then
cpanm --quiet --notest \
Devel::Cover \
Devel::Cover::Report::Coveralls
fi
- run:
name: Set up dirs and files
command: |
mkdir -p logs screens;
cp doc/conf/ledgersmb.conf.default ledgersmb.conf
start_plackup:
description: "Start plackup"
steps:
- run:
command: |
echo $PWD
PERL5OPT="$PERL5OPT -MDevel::Cover=-ignore,^/|^utils/|^x?t/|\.lttc$,-blib,0" plackup -I$HOME/project/lib -I$HOME/project/old/lib \
-s HTTP::Server::PSGI --port 5762 \
$HOME/project/bin/ledgersmb-server.psgi
echo "Plackup done!"
touch plackup-done
background: true
start_proxy:
description: "Start the proxy"
parameters:
proxy:
type: string
default: nginx
steps:
- run:
command: |
/usr/local/bin/<< parameters.proxy >>.sh
background: true

# Define executors
executors:
test:
parameters:
perl:
type: string
default: latest
postgres:
type: string
default: latest
browser:
type: string
default: chrome
coverage:
type: integer
default: 1
docker:
- image: ledgersmb/ledgersmb_circleci-perl:<< parameters.perl >>
- image: ledgersmb/ledgersmb_circleci-postgres:<< parameters.postgres >>
- image: ledgersmb/ledgersmb_circleci-<< parameters.browser >>
environment:
COVERAGE: << parameters.coverage >>
# DEVEL_COVER_OPTIONS:
RELEASE_TESTING: 1
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: test
LSMB_TEST_DB: 1
LSMB_NEW_DB: lsmbinstalltest
LSMB_BASE_URL: http://127.0.0.1:5000
PSGI_BASE_URL: http://127.0.0.1:5762
HARNESS_RULESFILE: t/testrules.yml

# Define jobs
jobs:
test_nodojo:
<<: *defaults
executor:
name: test
perl: "5.28"
postgres: "11"
browser: phantomjs
steps:
- prep_env
- start_plackup
- start_proxy
- prove

# Workflows
# Tests multiple browsers, coverage and dojo
workflows:
workflow:
jobs:
- test_nodojo
6 changes: 6 additions & 0 deletions .circleci/images/chrome/Dockerfile
@@ -0,0 +1,6 @@
FROM browserless/chrome
MAINTAINER LedgerSMB devel@lists.ledgersmb.org

ENV LANG en_US.UTF-8

EXPOSE 3000:4422
6 changes: 6 additions & 0 deletions .circleci/images/firefox/Dockerfile
@@ -0,0 +1,6 @@
FROM deepsweet/firefox-headless-remote
MAINTAINER LedgerSMB devel@lists.ledgersmb.org

ENV LANG en_US.UTF-8

EXPOSE 2828:4422
138 changes: 138 additions & 0 deletions .circleci/images/perl/Dockerfile
@@ -0,0 +1,138 @@
FROM ylavoie/ledgersmb_circleci-primary
MAINTAINER ylavoie@yveslavoie.com

# Perl version
ARG perl=5.28.0

ENV HOME /home/circleci
SHELL ["/bin/bash", "-c"]

USER root
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -qyy install perlbrew && \
apt-get -qqy autoremove && \
apt-get -qqy autoclean && \
rm -rf /var/lib/apt/lists/*

USER circleci
WORKDIR $HOME

# Build time variables
ENV NODE_PATH /usr/lib/node_modules

# Install LedgerSMB
RUN cd && \
git clone -b master https://github.com/ledgersmb/LedgerSMB.git project

# install the standalone perlbrew
RUN perlbrew init --shell=/bin/bash && \
source ~/perl5/perlbrew/etc/bashrc && \
perlbrew install-patchperl && \
perlbrew install --notest -j 4 $perl && \
perlbrew use perl-$perl && \
perlbrew install-cpanm && \
echo "source ~/perl5/perlbrew/etc/bashrc" >> ~/.profile && \
cpanm inc::Module::Install Starman

RUN cd ~/project && \
source ~/perl5/perlbrew/etc/bashrc && \
perlbrew use perl-$perl && \
cpanm --quiet --notest \
--with-develop \
--with-feature=starman \
--with-feature=latex-pdf-images \
--with-feature=latex-pdf-ps \
--with-feature=openoffice \
--with-feature=xls \
--with-feature=edi \
--installdeps .

RUN cd ~/project && \
source ~/perl5/perlbrew/etc/bashrc && \
perlbrew use perl-$perl && \
cpanm --quiet --notest Dancer2 Dancer2::Session::Cookie Dancer2::Plugin::Auth::Extensible \
URL::Encode URL::Encode::XS \
Pod::ProjectDocs \
Devel::Cover Devel::Cover::Report::Coveralls \
Dist::Zilla \
Locale::Country

RUN eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) && \
source ~/perl5/perlbrew/etc/bashrc && \
perlbrew use perl-$perl && \
cd /tmp && git clone git://github.com/pjlsergeant/test-bdd-cucumber-perl.git -b match-mode && \
cd test-bdd-cucumber-perl && ( dzil authordeps --missing | cpanm --notest ) && ( dzil listdeps --missing --author | cpanm --notest ) && \
dzil install && rm -rf ~/.cpanm && \
cd ~/ && rm -rf /tmp/test-bdd-cucumber-perl && rm -rf project && mkdir project

USER root
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
(wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -) && \
DEBIAN_FRONTEND=noninteractive apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install postgresql-client && \
apt-get -qqy autoremove && \
apt-get -qqy autoclean && \
rm -rf /var/lib/apt/lists/*

# Configure outgoing mail to use host, other run time variable defaults

## sSMTP
ENV SSMTP_ROOT=ar@example.com \
SSMTP_MAILHUB=172.17.0.1 \
SSMTP_HOSTNAME=172.17.0.1 \
SSMTP_FROMLINE_OVERRIDE=YES
#ENV SSMTP_USE_STARTTLS=
#ENV SSMTP_AUTH_USER=
#ENV SSMTP_AUTH_PASS=
#ENV SSMTP_AUTH_METHOD=

## PostgreSQL
ENV POSTGRES_HOST=postgres \
POSTGRES_PORT=5432 \
DEFAULT_DB=lsmb

COPY start.sh /usr/local/bin/start.sh
COPY update_ssmtp.sh /usr/local/bin/update_ssmtp.sh

RUN chown circleci /etc/ssmtp /etc/ssmtp/ssmtp.conf && \
chmod +x /usr/local/bin/update_ssmtp.sh /usr/local/bin/start.sh && \
mkdir -p /var/www && chown www-data /var/www

# Work around an aufs bug related to directory permissions:
RUN mkdir -p /tmp && \
chmod 1777 /tmp

# Install proxies. They should be in their own image but CircleCI doesn't
# support bind mounts and proxies need access to UI

RUN DEBIAN_FRONTEND=noninteractive \
apt-get update && \
apt-get --no-install-recommends --yes install nginx lighttpd && \
apt-get -qqy autoremove && \
apt-get -qqy autoclean && \
rm -rf /var/lib/apt/lists/*

COPY nginx*.conf /etc/nginx/
COPY nginx.sh /usr/local/bin
RUN chmod +x /usr/local/bin/nginx.sh
COPY lighttpd.sh /usr/local/bin
COPY lighttpd*.conf /etc/lighttpd/
RUN chmod +x /usr/local/bin/lighttpd.sh
# Remove startup warnings
RUN chown circleci:circleci -R /var/log/nginx /var/log/lighttpd

USER circleci

# To make sure that all the proper perl version is always used
RUN echo "perlbrew use perl-$perl" >> .profile

# We don't need to install it globally after brewing Perl here
RUN npm install uglify-js@">=2.0 <3.0"

# Fix PATH
ENV PATH $HOME/perl5/perlbrew/perls/perl-$perl/bin:$PATH

# Internal Port Expose
EXPOSE 5762

CMD ["start.sh"]
6 changes: 6 additions & 0 deletions .circleci/images/perl/build.sh
@@ -0,0 +1,6 @@
#!/bin/bash -x

for v in 5.28 5.26 5.24 5.22 5.20 5.18 ; do
docker build -t ylavoie/ledgersmb_circleci-perl:$v --build-arg perl=$v.0 .
docker push ylavoie/ledgersmb_circleci-perl:$v
done

0 comments on commit ea2f6d3

Please sign in to comment.