#1309 Gitlab CI
This commit is contained in:
parent
4dbd7b39fb
commit
6d91260d78
@ -0,0 +1,72 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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 the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The main file for GitLab Continous Integration
|
||||
|
||||
image: docker:stable
|
||||
|
||||
before_script:
|
||||
- docker info
|
||||
|
||||
stages:
|
||||
- dmsf
|
||||
|
||||
mariadb:
|
||||
stage: dmsf
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
# Create an image
|
||||
- docker build -t dmsf_image -f Dockerfile .
|
||||
# Run the container, optionally run some tests/apps in it
|
||||
- docker rm -f dmsf_container 2>/dev/null || true
|
||||
- docker run --name dmsf_container dmsf_image bash ./test/ci/ci.sh mariadb
|
||||
# Remove the container
|
||||
- docker rm dmsf_container
|
||||
# Remove image
|
||||
- docker rmi dmsf_image
|
||||
|
||||
postgres:
|
||||
stage: dmsf
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
# Create an image
|
||||
- docker build -t dmsf_image -f Dockerfile .
|
||||
# Run the container, optionally run some tests/apps in it
|
||||
- docker rm -f dmsf_container 2>/dev/null || true
|
||||
- docker run --name dmsf_container dmsf_image bash ./test/ci/ci.sh postgres
|
||||
# Remove the container
|
||||
- docker rm dmsf_container
|
||||
# Remove image
|
||||
- docker rmi dmsf_image
|
||||
|
||||
sqlite3:
|
||||
stage: dmsf
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
# Create an image
|
||||
- docker build -t dmsf_image -f Dockerfile .
|
||||
# Run the container, optionally run some tests/apps in it
|
||||
- docker rm -f dmsf_container 2>/dev/null || true
|
||||
- docker run --name dmsf_container dmsf_image bash ./test/ci/ci.sh sqlite3
|
||||
# Remove the container
|
||||
- docker rm dmsf_container
|
||||
# Remove image
|
||||
- docker rmi dmsf_image
|
||||
69
.travis.yml
69
.travis.yml
@ -1,69 +0,0 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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 the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
language: ruby
|
||||
|
||||
sudo: true
|
||||
|
||||
dist: bionic
|
||||
|
||||
rvm:
|
||||
- 2.6
|
||||
|
||||
before_install:
|
||||
- sudo apt-get -y install litmus curl
|
||||
|
||||
before_script:
|
||||
- sudo mysql -e 'CREATE DATABASE IF NOT EXISTS test CHARACTER SET utf8mb4;'
|
||||
- sudo mysql -e "CREATE USER 'dmsf'@'localhost' IDENTIFIED BY 'eGCq9ueVpUH3'";
|
||||
- sudo mysql -e "GRANT ALL PRIVILEGES ON test.* TO 'dmsf'@'localhost'";
|
||||
- psql -c 'create database test;' -U postgres
|
||||
- export WORKSPACE=`pwd`/workspace
|
||||
- export PATH_TO_DMSF=`pwd`
|
||||
- export PATH_TO_REDMINE=$WORKSPACE/redmine
|
||||
- export BUNDLE_GEMFILE=$PATH_TO_REDMINE/Gemfile
|
||||
- mkdir -p ${WORKSPACE}
|
||||
- cp -f ./test/ci/${DB}.yml ${WORKSPACE}/database.yml
|
||||
- bash -x ./test/ci/redmine_install.sh -c
|
||||
- bash -x ./test/ci/redmine_install.sh -i
|
||||
|
||||
script:
|
||||
- bash -x ./test/ci/redmine_install.sh -t
|
||||
|
||||
after_script:
|
||||
- bash -x ./test/ci/redmine_install.sh -u
|
||||
|
||||
env:
|
||||
global:
|
||||
- DB=sqlite REDMINE_GIT_TAG=4.2-stable
|
||||
- DB=mysql REDMINE_GIT_TAG=4.2-stable
|
||||
- DB=postgres REDMINE_GIT_TAG=4.2-stable
|
||||
|
||||
cache: bundler
|
||||
|
||||
services:
|
||||
- mysql
|
||||
- postgresql
|
||||
|
||||
addons:
|
||||
mariadb: '10.4'
|
||||
apt:
|
||||
update: true
|
||||
25
Dockerfile
25
Dockerfile
@ -0,0 +1,25 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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 the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The Docker file definition for GitLab Continous Integration
|
||||
|
||||
FROM debian:latest
|
||||
RUN apt-get update
|
||||
RUN apt-get -qq install mariadb-server postgresql sqlite3 libsqlite3-dev ruby ruby-dev build-essential libmariadb-dev libpq-dev subversion git litmus
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
@ -3,6 +3,8 @@ Redmine DMSF Plugin
|
||||
|
||||
The current version of Redmine DMSF is **2.4.11 devel**
|
||||
|
||||
[](https://gitlab.kontron.com/redmine-plugins/redmine_dmsf/pipelines/devel-2.4.11/latest)
|
||||
|
||||
Redmine DMSF is Document Management System Features plugin for Redmine issue tracking system; It is aimed to replace current Redmine's Documents module.
|
||||
|
||||
Redmine DMSF now comes bundled with Webdav functionality: if switched on within plugin settings this will be accessible from /dmsf/webdav.
|
||||
|
||||
122
test/ci/ci.sh
122
test/ci/ci.sh
@ -0,0 +1,122 @@
|
||||
#!/bin/bash
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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 the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# The script for GitLab Continous Integration
|
||||
|
||||
# Exit if any command fails
|
||||
set -e
|
||||
|
||||
# Display the first argument (DB engine)
|
||||
echo $1
|
||||
|
||||
# Variables
|
||||
REDMINE_REPO=http://svn.redmine.org/redmine/branches/4.2-stable/
|
||||
REDMINE_PATH=/opt/redmine
|
||||
|
||||
# Init
|
||||
rm -rf "${REDMINE_PATH}"
|
||||
|
||||
# Clone Redmine
|
||||
svn export "${REDMINE_REPO}" "${REDMINE_PATH}"
|
||||
|
||||
# Add the plugin
|
||||
ln -s /app "${REDMINE_PATH}"/plugins/redmine_dmsf
|
||||
|
||||
# Prepare the database
|
||||
cp "./test/ci/$1.yml" "${REDMINE_PATH}/config/database.yml"
|
||||
case $1 in
|
||||
|
||||
mariadb)
|
||||
/etc/init.d/$1 start
|
||||
mariadb -e "CREATE DATABASE IF NOT EXISTS test CHARACTER SET utf8mb4"
|
||||
mariadb -e "CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine'";
|
||||
mariadb -e "GRANT ALL PRIVILEGES ON test.* TO 'redmine'@'localhost'";
|
||||
;;
|
||||
|
||||
postgres)
|
||||
/etc/init.d/$1ql start
|
||||
su -c "psql -c \"CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redmine' NOINHERIT VALID UNTIL 'infinity';\"" postgres
|
||||
su -c "psql -c \"CREATE DATABASE test WITH ENCODING='UTF8' OWNER=redmine;\"" postgres
|
||||
su -c "psql -c \"ALTER USER redmine CREATEDB;\"" postgres
|
||||
;;
|
||||
|
||||
sqlite3)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 'Missing argument'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Install Redmine
|
||||
cd "${REDMINE_PATH}"
|
||||
gem install bundler
|
||||
RAILS_ENV=test bundle config set --local without 'rmagick xapian development'
|
||||
RAILS_ENV=test bundle install
|
||||
RAILS_ENV=test bundle exec rake generate_secret_token
|
||||
RAILS_ENV=test bundle exec rake db:migrate
|
||||
RAILS_ENV=test bundle exec rake redmine:plugins:migrate
|
||||
RAILS_ENV=test REDMINE_LANG=en bundle exec rake redmine:load_default_data
|
||||
|
||||
# Run Redmine tests
|
||||
#RAILS_ENV=test bundle exec rake test
|
||||
|
||||
# Run DMSF tests
|
||||
bundle exec rake redmine:plugins:test:units NAME=redmine_dmsf RAILS_ENV=test
|
||||
bundle exec rake redmine:plugins:test:functionals NAME=redmine_dmsf RAILS_ENV=test
|
||||
bundle exec rake redmine:plugins:test:integration NAME=redmine_dmsf RAILS_ENV=test
|
||||
|
||||
# Litmus
|
||||
|
||||
# Prepare Redmine's environment for WebDAV testing
|
||||
RAILS_ENV=test bundle exec rake redmine:dmsf_webdav_test_on
|
||||
|
||||
# Run Webrick server
|
||||
bundle exec rails server webrick -e test -d
|
||||
|
||||
# Run Litmus tests (Omit 'http' tests due to 'timeout waiting for interim response')
|
||||
TESTS="basic copymove props locks" litmus http://localhost:3000/dmsf/webdav/dmsf_test_project admin admin
|
||||
|
||||
# Shutdown Webrick
|
||||
kill `cat tmp/pids/server.pid`
|
||||
|
||||
# Clean up Redmine's environment from WebDAV testing
|
||||
RAILS_ENV=test bundle exec rake redmine:dmsf_webdav_test_off
|
||||
|
||||
case $1 in
|
||||
|
||||
mariadb)
|
||||
/etc/init.d/$1 stop
|
||||
;;
|
||||
|
||||
postgres)
|
||||
/etc/init.d/$1ql stop
|
||||
;;
|
||||
|
||||
sqlite3)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 'Missing argument'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$1 Okay"
|
||||
@ -1,8 +1,27 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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 the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# MariDb file definition for GitLab Continous Integration
|
||||
|
||||
test:
|
||||
adapter: mysql2
|
||||
database: test
|
||||
username: dmsf
|
||||
password: "eGCq9ueVpUH3"
|
||||
username: redmine
|
||||
password: "redmine"
|
||||
encoding: utf8mb4
|
||||
collation: utf8mb4_unicode_ci
|
||||
@ -1,5 +1,26 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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 the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# PosgreSQL file definition for GitLab Continous Integration
|
||||
|
||||
test:
|
||||
adapter: postgresql
|
||||
database: test
|
||||
encoding: utf8
|
||||
username: redmine
|
||||
password: redmine
|
||||
host: localhost
|
||||
@ -1,115 +0,0 @@
|
||||
#!/bin/bash
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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 the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
if [[ ! -v REDMINE_GIT_REPO ]]; then
|
||||
export REDMINE_GIT_REPO=git://github.com/redmine/redmine.git
|
||||
fi
|
||||
if [[ ! -v REDMINE_GIT_TAG ]]; then
|
||||
export REDMINE_GIT_TAG=4.1-stable
|
||||
fi
|
||||
|
||||
clone()
|
||||
{
|
||||
# Exit if the cloning fails
|
||||
set -e
|
||||
|
||||
rm -rf ${PATH_TO_REDMINE}
|
||||
git clone -b ${REDMINE_GIT_TAG} --depth=100 --quiet ${REDMINE_GIT_REPO} ${PATH_TO_REDMINE}
|
||||
}
|
||||
|
||||
test()
|
||||
{
|
||||
# Exit if a test fails
|
||||
set -e
|
||||
|
||||
cd ${PATH_TO_REDMINE}
|
||||
|
||||
# Run tests within application
|
||||
bundle exec rake redmine:plugins:test:units NAME=redmine_dmsf RAILS_ENV=test
|
||||
bundle exec rake redmine:plugins:test:functionals NAME=redmine_dmsf RAILS_ENV=test
|
||||
bundle exec rake redmine:plugins:test:integration NAME=redmine_dmsf RAILS_ENV=test
|
||||
|
||||
# Litmus
|
||||
# Prepare Redmine's environment for WebDAV testing
|
||||
bundle exec rake redmine:dmsf_webdav_test_on RAILS_ENV=test
|
||||
# Run Webrick server
|
||||
bundle exec rails server webrick -e test -d
|
||||
# Run Litmus tests
|
||||
litmus http://localhost:3000/dmsf/webdav/dmsf_test_project admin admin
|
||||
# Shutdown Webrick
|
||||
kill `cat tmp/pids/server.pid`
|
||||
# Clean up Redmine's environment from WebDAV testing
|
||||
bundle exec rake redmine:dmsf_webdav_test_off RAILS_ENV=test
|
||||
}
|
||||
|
||||
uninstall()
|
||||
{
|
||||
# Exit if the migration fails
|
||||
set -e
|
||||
|
||||
cd ${PATH_TO_REDMINE}
|
||||
|
||||
# clean up database
|
||||
bundle exec rake redmine:plugins:migrate NAME=redmine_dmsf VERSION=0 RAILS_ENV=test
|
||||
}
|
||||
|
||||
install()
|
||||
{
|
||||
# Exit if the installation fails
|
||||
set -e
|
||||
|
||||
# cd to redmine folder
|
||||
cd ${PATH_TO_REDMINE}
|
||||
echo current directory is `pwd`
|
||||
|
||||
# Create a link to the dmsf plugin
|
||||
ln -sf ${PATH_TO_DMSF} plugins/redmine_dmsf
|
||||
|
||||
# Copy database.yml
|
||||
cp ${WORKSPACE}/database.yml config/
|
||||
|
||||
# Install gems
|
||||
# Not ideal, but at present Travis-CI will not install with xapian enabled:
|
||||
bundle install --without xapian rmagick development RAILS_ENV=test
|
||||
|
||||
# Run Redmine database migrations
|
||||
bundle exec rake db:migrate --trace RAILS_ENV=test
|
||||
|
||||
# Load Redmine database default data
|
||||
bundle exec rake redmine:load_default_data REDMINE_LANG=en RAILS_ENV=test
|
||||
|
||||
# generate session store/secret token
|
||||
bundle exec rake generate_secret_token RAILS_ENV=test
|
||||
|
||||
# Run the plugin database migrations
|
||||
bundle exec rake redmine:plugins:migrate RAILS_ENV=test
|
||||
}
|
||||
|
||||
while getopts :ictu opt
|
||||
do case "$opt" in
|
||||
c) clone; exit 0;;
|
||||
i) install; exit 0;;
|
||||
t) test; exit 0;;
|
||||
u) uninstall; exit 0;;
|
||||
[?]) echo "i: install; c: clone redmine; t: run tests; u: uninstall";;
|
||||
esac
|
||||
done
|
||||
@ -1,5 +1,23 @@
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright © 2011-21 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# 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 the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# SQLite file definition for GitLab Continous Integration
|
||||
|
||||
test:
|
||||
adapter: sqlite3
|
||||
database: db/test.sqlite3
|
||||
timeout: 500
|
||||
database: db/redmine.sqlite3
|
||||
Loading…
x
Reference in New Issue
Block a user