Skip to content

Commit

Permalink
NH-3807 - Develop AppVeyor and CircleCI builds.
Browse files Browse the repository at this point in the history
- Allow failure for MySQL.
- Include TestLoggers.
- Exclude committed directories to Tools folder from being deleted.
  • Loading branch information
ngbrown committed Jan 26, 2018
1 parent cdfce3c commit 1e67d0a
Show file tree
Hide file tree
Showing 16 changed files with 1,155 additions and 0 deletions.
137 changes: 137 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# CircleCI 2.0 configuration file
---
# Common primary image
ref-base-image: &ref-base-image
image: ngbrown/nhibernate-build-dotnet-sdk:latest
environment:
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
- CAKE_VERSION: 0.21.1

# Download and cache dependencies
ref-restore-cache: &ref-restore-cache
restore_cache:
keys:
- cake-{{ .Environment.CAKE_VERSION }}

ref-save-cache: &ref-save-cache
save_cache:
key: cake-{{ .Environment.CAKE_VERSION }}
paths:
- ~/project/tools

version: 2
jobs:
test-mssql:
docker:
- *ref-base-image

- image: microsoft/mssql-server-linux:2017-latest
environment:
- ACCEPT_EULA: Y
- SA_PASSWORD: Password12!

working_directory: ~/project

steps:
- checkout

# Download and cache dependencies
- *ref-restore-cache
- run: ./build.sh --target Restore
- *ref-save-cache

# compile and run tests.
- run:
name: Test on Microsoft SQL Server 2017 for Linux
environment:
- NHIBERNATE_DATABASE_TEMPLATE: MSSQL.cfg.xml
- NHIBERNATE_CONNECTION_STRING: Server=(local);Database=master;User ID=sa;Password=Password12!
- NHIBERNATE_DIALECT: NHibernate.Dialect.MsSql2012Dialect
- DOTNET_FRAMEWORK: netcoreapp2.0
- TARGET_PLATFORM: x64
command: ./build.sh --target CircleCI --configuration Debug

- store_test_results:
path: ~/test-reports
- store_artifacts:
path: ~/test-reports

test-postgresql:
docker:
- *ref-base-image

- image: postgres:9.6-alpine
environment:
- POSTGRES_PASSWORD: Password12!
command: ["postgres", "-c", "max_prepared_transactions=100"]

working_directory: ~/project

steps:
- checkout

# Download and cache dependencies
- *ref-restore-cache
- run: ./build.sh --target Restore
- *ref-save-cache

# compile and run tests.
- run:
name: Test on PostgreSQL 9.6 for Linux
environment:
- NHIBERNATE_DATABASE_TEMPLATE: PostgreSQL.cfg.xml
- NHIBERNATE_CONNECTION_STRING: Server=localhost;Port=5432;Database=nhibernate;User ID=postgres;Password=Password12!;Enlist=true;
- NHIBERNATE_DIALECT: NHibernate.Dialect.PostgreSQL83Dialect
- DOTNET_FRAMEWORK: netcoreapp2.0
- TARGET_PLATFORM: x64
command: ./build.sh --target CircleCI --configuration Debug

- store_test_results:
path: ~/test-reports
- store_artifacts:
path: ~/test-reports

test-firebird:
docker:
- *ref-base-image

- image: ngbrown/nhibernate-build-firebird
environment:
- ISC_PASSWORD: Password12!
FIREBIRD_USER: nhibernate
FIREBIRD_PASSWORD: Password12!
FIREBIRD_DATABASE: nhibernate

working_directory: ~/project

steps:
- checkout

# Download and cache dependencies
- *ref-restore-cache
- run: ./build.sh --target Restore
- *ref-save-cache

# compile and run tests.
- run:
name: Test on Firebird 3.0 for Linux
environment:
- NHIBERNATE_DATABASE_TEMPLATE: FireBird.cfg.xml
- NHIBERNATE_CONNECTION_STRING: DataSource=localhost;Database=nhibernate;User ID=SYSDBA;Password=Password12!;MaxPoolSize=200;
- NHIBERNATE_DIALECT: NHibernate.Dialect.FirebirdDialect
- DOTNET_FRAMEWORK: netcoreapp2.0
- TARGET_PLATFORM: x64
command: ./build.sh --target CircleCI --configuration Debug

- store_test_results:
path: ~/test-reports
- store_artifacts:
path: ~/test-reports

workflows:
version: 2
build:
jobs:
- test-mssql
- test-postgresql
- test-firebird
50 changes: 50 additions & 0 deletions .circleci/images/nhibernate-build-dotnet-sdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM buildpack-deps:jessie-scm

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
unzip \
libc6 \
libcurl3 \
libgcc1 \
libgssapi-krb5-2 \
libicu52 \
liblttng-ust0 \
libssl1.0.0 \
libstdc++6 \
libunwind8 \
libuuid1 \
zlib1g \
&& rm -rf /var/lib/apt/lists/*

# Install .NET Core runtime - https://github.com/dotnet/dotnet-docker/blob/master/1.0/runtime/jessie/Dockerfile
ENV DOTNET_VERSION 1.0.5
ENV DOTNET_DOWNLOAD_SHA 55481b0254a72d8c342ba6ccca3908ffb5c99d7eeb54f83dec6cc93c6b4cc3ae
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-debian-x64.$DOTNET_VERSION.tar.gz

RUN curl -SL $DOTNET_DOWNLOAD_URL --output dotnet.tar.gz \
&& echo "$DOTNET_DOWNLOAD_SHA dotnet.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz

# Install .NET Core SDK - https://github.com/dotnet/dotnet-docker/blob/master/2.0/sdk/jessie/amd64/Dockerfile
ENV DOTNET_SDK_VERSION 2.0.0
ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz
ENV DOTNET_SDK_DOWNLOAD_SHA E457F3A5685382F7F24851A2E76EDBE75B575948C8A7F43220F159BA29C329A5008BBE7220C18DFB31EAF0398FC72177B1948B65E19B34ED0D907EFB459CF4B0

RUN curl -SL $DOTNET_SDK_DOWNLOAD_URL --output dotnet.tar.gz \
&& echo "$DOTNET_SDK_DOWNLOAD_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

# Trigger the population of the local package cache
ENV NUGET_XMLDOC_MODE skip
RUN mkdir warmup \
&& cd warmup \
&& dotnet new \
&& cd .. \
&& rm -rf warmup \
&& rm -rf /tmp/NuGetScratch
25 changes: 25 additions & 0 deletions .circleci/images/nhibernate-build-firebird/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM debian:jessie

ENV PREFIX=/usr/local/firebird
ENV DEBIAN_FRONTEND noninteractive
ENV FBURL=http://downloads.sourceforge.net/project/firebird/firebird/3.0.2-Release/Firebird-3.0.2.32703-0.tar.bz2
ENV DBPATH=/databases

ADD build.sh ./build.sh

RUN chmod +x ./build.sh && \
sync && \
./build.sh && \
rm -f ./build.sh

VOLUME ["/databases", "/var/firebird/run", "/var/firebird/etc", "/var/firebird/log", "/var/firebird/system", "/tmp/firebird"]

EXPOSE 3050/tcp

ADD docker-entrypoint.sh ${PREFIX}/docker-entrypoint.sh
RUN chmod +x ${PREFIX}/docker-entrypoint.sh

ADD docker-entrypoint-async.sh ${PREFIX}/docker-entrypoint-async.sh
RUN chmod +x ${PREFIX}/docker-entrypoint-async.sh

ENTRYPOINT ${PREFIX}/docker-entrypoint-async.sh ${PREFIX}/bin/fbguard
67 changes: 67 additions & 0 deletions .circleci/images/nhibernate-build-firebird/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# docker Firebird

## Default password for `sysdba`
The default password for `sysdba` is randomly generated when you first launch the container,
look in the docker log for your container or pull /var/firebird/etc/SYSDBA.password.
Alternatively you may pass the environment variable ISC_PASSWORD to set the default password.

## Description
This is a Firebird SQL Database container.

## Default Login information
Username: SYSDBA
Password is either set by `ISC_PASSWORD` or randomized

## Environment Variables:
### `TZ`
TimeZone. (i.e. America/Chicago)

### `ISC_PASSWORD`
Default `sysdba` user password, if left blank a random 20 character password will be set instead.
The password used will be placed in /var/firebird/etc/SYSDBA.password.
If a random password is generated then it will be in the log for the container.

### `FIREBIRD_DATABASE`
If this is set then a database will be created with this name under the `/databases` volume with the 'UTF8'
default character set and if `FIREBIRD_USER` is also set then `FIREBIRD_USER` will be given ownership.

### `FIREBIRD_USER`
This user will be created and given ownership of `FIREBIRD_DATABASE`.
This variable is only used if `FIREBIRD_DATABASE` is also set.

### `FIREBIRD_PASSWORD`
The password for `FIREBIRD_USER`, if left blank a random 20 character password will be set instead.
If a random password is generated then it will be in the log for the container.

### `<VARIABLE>_FILE`
If set to the path to a file then the named variable minus the _FILE portion will contain the contents of that file.
This is useful for using docker secrets to manage your password.
This applies to all variables except `TZ`

## Volumes:

### `/databases/`
Default location to put database files

### `/var/firebird/run`
guardian lock DIR

### `/var/firebird/etc`
config files DIR
message files DIR

### `/var/firebird/log`
log files DIR

### `/var/firebird/system`
security database DIR

### `/tmp/firebird`
Database lock directory

## Exposes:
### 3050/tcp

## Events
Please note for events to work properly you must either configure RemoteAuxPort and forward it with -p using a direct mapping where both sides internal and external use the same port or use --net=host to allow the random port mapping to work.
see: http://www.firebirdfaq.org/faq53/ for more information on event port mapping.
64 changes: 64 additions & 0 deletions .circleci/images/nhibernate-build-firebird/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
set -e
CPUC=$(awk '/^processor/{n+=1}END{print n}' /proc/cpuinfo)

apt-get update
apt-get install -qy --no-install-recommends \
libicu52 \
libtommath0
apt-get install -qy --no-install-recommends \
bzip2 \
ca-certificates \
curl \
g++ \
gcc \
libicu-dev \
libncurses5-dev \
libtommath-dev \
make \
zlib1g-dev
mkdir -p /home/firebird
cd /home/firebird
curl -o firebird-source.tar.bz2 -L \
"${FBURL}"
tar --strip=1 -xf firebird-source.tar.bz2
./configure \
--prefix=${PREFIX}/ --with-fbbin=${PREFIX}/bin/ --with-fbsbin=${PREFIX}/bin/ --with-fblib=${PREFIX}/lib/ \
--with-fbinclude=${PREFIX}/include/ --with-fbdoc=${PREFIX}/doc/ --with-fbudf=${PREFIX}/UDF/ \
--with-fbsample=${PREFIX}/examples/ --with-fbsample-db=${PREFIX}/examples/empbuild/ --with-fbhelp=${PREFIX}/help/ \
--with-fbintl=${PREFIX}/intl/ --with-fbmisc=${PREFIX}/misc/ --with-fbplugins=${PREFIX}/ \
--with-fbconf=/var/firebird/etc/ --with-fbmsg=${PREFIX}/ \
--with-fblog=/var/firebird/log/ --with-fbglock=/var/firebird/run/ \
--with-fbsecure-db=/var/firebird/system
make -j${CPUC}
make silent_install
cd /
rm -rf /home/firebird
find ${PREFIX} -name .debug -prune -exec rm -rf {} \;
apt-get purge -qy --auto-remove \
bzip2 \
ca-certificates \
curl \
g++ \
gcc \
libicu-dev \
libncurses5-dev \
libtommath-dev \
make \
zlib1g-dev
rm -rf /var/lib/apt/lists/*

# This allows us to initialize a random value for sysdba password
mv /var/firebird/system/security3.fdb ${PREFIX}/security3.fdb

sed -i 's/^#DatabaseAccess/DatabaseAccess/g' /var/firebird/etc/firebird.conf
sed -i "s~^\(DatabaseAccess\s*=\s*\).*$~\1Restrict ${DBPATH}~" /var/firebird/etc/firebird.conf

# Enable non-secured ADO.NET connector to connect.
echo $'WireCrypt = Enabled
AuthServer = Srp
AuthClient = Srp
UserManager = Srp
'\
>> /var/firebird/etc/firebird.conf

Loading

0 comments on commit 1e67d0a

Please sign in to comment.