diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml new file mode 100644 index 0000000..51913c7 --- /dev/null +++ b/.github/workflows/rubyonrails.yml @@ -0,0 +1,133 @@ +# Redmine plugin for Custom Workflows +# +# Copyright © 2011-22 Karel Pičman +# +# 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. +# +# GitHub CI script + +name: "GitHub CI" +on: + push: + branches: ["devel"] + pull_request: + branches: ["devel"] +jobs: + plugin_tests: + strategy: + matrix: + engine: [mysql, postgresql, sqlite] + include: + - engine: mysql + # Database configuration for Redmine + database_configuration: > + test: + adapter: mysql2 + database: test + username: redmine + password: redmine + encoding: utf8mb4 + collation: utf8mb4_unicode_ci + # SQL commands to create a database for Redmine + sql1: CREATE DATABASE IF NOT EXISTS test CHARACTER SET utf8mb4; + sql2: CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine'; + sql3: GRANT ALL PRIVILEGES ON test.* TO 'redmine'@'localhost'; + # SQL client command + database_command: mysql -uroot -proot -e + # SQl service + database_service: mysql + - engine: postgresql + # Database configuration for Redmine + database_configuration: > + test: + adapter: postgresql + database: test + username: redmine + password: redmine + host: localhost + # SQL commands to create a database for Redmine + sql1: CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redmine' NOINHERIT VALID UNTIL 'infinity'; + sql2: CREATE DATABASE test WITH ENCODING='UTF8' OWNER=redmine; + sql3: ALTER USER redmine CREATEDB; + # SQL client command + database_command: sudo -u postgres psql -c + # SQL service + database_service: postgresql + - engine: sqlite + # Database configuration for Redmine + database_configuration: > + test: + adapter: sqlite3 + database: db/redmine.sqlite3 + # No database needed here. It's just a file. + runs-on: ubuntu-latest + env: + RAILS_ENV: test + NAME: redmine_custom_workflows + steps: + - name: Clone Redmine + # Get the latest stable Redmine + run: svn export http://svn.redmine.org/redmine/branches/5.0-stable/ /opt/redmine + - name: Checkout code + uses: actions/checkout@v3 + - name: Link the plugin + # Link the plugin to the redmine folder + run: | + ln -s $(pwd) /opt/redmine/plugins/redmine_custom_workflows + - name: Install Ruby and gems + uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3 + with: + bundler-cache: true + ruby-version: '3.0' + - name: Setup database + # Create the database + run: | + echo "${{matrix.database_configuration}}" > /opt/redmine/config/database.yml + if [[ "${{matrix.database_service}}" ]]; then + sudo systemctl start ${{matrix.engine}} + fi + if [[ "${{matrix.database_command}}" ]]; then + ${{matrix.database_command}} "${{matrix.sql1}}" + ${{matrix.database_command}} "${{matrix.sql2}}" + ${{matrix.database_command}} "${{matrix.sql3}}" + fi + - name: Install Redmine + # Install Redmine + run: | + cd /opt/redmine + bundle config set --local without 'rmagick development' + bundle install + bundle exec rake generate_secret_token + bundle exec rake db:migrate + ls -l plugins/ + bundle exec rake redmine:plugins:migrate + bundle exec rake redmine:load_default_data + env: + REDMINE_LANG: en + - name: Standard tests + # Run the tests + run: | + cd /opt/redmine + bundle exec rake redmine:plugins:test:units + bundle exec rake redmine:plugins:test:functionals + - name: Cleanup + # Rollback plugin's changes to the database + # Stop the database engine + run: | + cd /opt/redmine + bundle exec rake redmine:plugins:migrate VERSION=0 + if [[ "${{matrix.database_service}}" ]]; then + sudo systemctl stop ${{matrix.engine}} + fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 236fcda..87a1bfb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,4 +11,4 @@ #### **Do you want to patch the existing code?** -* Make a new fork of the current development branch (_devel-x.x.x_). Make your changes and [create a pull request](https://github.com/anteo/redmine_custom_workflows/compare). Only pull requests into the **development branch** except those fixing serious errors will be accepted. +* Make a new fork of the current development branch (_devel_). Make your changes and [create a pull request](https://github.com/anteo/redmine_custom_workflows/compare). Only pull requests into the **development branch** except those fixing serious errors will be accepted. diff --git a/README.md b/README.md index 664ea98..515df83 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,17 @@ -Custom Workflows plug-in -======================== +Custom Workflows plug-in 2.0.5 devel +==================================== -The current version of Redmine CustomWorkflows is **2.0.5 devel** - -[![pipeline status](https://gitlab.kontron.com/redmine-plugins/redmine_custom_workflows/badges/devel/pipeline.svg)](https://gitlab.kontron.com/redmine-plugins/redmine_custom_workflows/-/commits/devel) +![GitHub Action](https://github.com/antoneo/redmine_custom_workflows/actions/workflows/rubyonrails.yml/badge.svg?branch=devel) [![Support Ukraine Badge](https://bit.ly/support-ukraine-now)](https://github.com/support-ukraine/support-ukraine) This plug-in provides a great functionality for those who is familiar with the Ruby language. It allows to customize workflow by defining own rules for issues processing. It's possible: -* To change issue properties if some conditions are met; -* To create new issues programmatically if the conditions are met (for example you can create an issue in another project if the status of source issue is changed to specific value); -* To raise custom errors which will display to user, if he does something wrong; -* To do anything that conforms to your needs; +* To change issue properties if some conditions are met. +* To create new issues programmatically, if the conditions are met (for example you can create an issue in another project if the status of source issue is changed to specific value). +* To raise custom errors which will be displayed to the user, if he does something wrong. +* To do anything that conforms to your needs. -Starting with version 0.1.2 you can specify observable object for workflow. Supported observable objects for now: +Supported observable objects: * Issue (before_save, after_save) * Group (before_save, after_save) * User (before_save, after_save) @@ -25,9 +23,7 @@ Starting with version 0.1.2 you can specify observable object for workflow. Supp Thanks to --------- -Plugin development was supported by DOM Digital Online Media GmbH. - -https://www.dom.de +The initial development was supported by [DOM Digital Online Media GmbH](https://www.dom.de). The present development is supported by [Kontron](https://www.kontorn.com) Getting help ------------ @@ -52,11 +48,12 @@ From a ZIP file: * Download the latest version of the plugin. * Unzip it to /plugins. -From a GIT repository: +From the Git repository: * Clone the repository: -``` +```shell +cd redmine/plugins git clone https://github.com/anteo/redmine_custom_workflows.git ``` @@ -64,8 +61,9 @@ After download: * Run migrations and restart the application: -``` -RAILS_ENV=production bundle exec rake db:migrate +```shell +cd redmine +bundle install RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=redmine_custom_workflows systemctl restart apache2 ``` diff --git a/test/ci/mariadb.yml b/test/ci/mariadb.yml deleted file mode 100644 index ae02506..0000000 --- a/test/ci/mariadb.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Redmine plugin for Custom Workflows -# -# Copyright © 2015-19 Anton Argirov -# Copyright © 2019-22 Karel Pičman -# -# 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: redmine - password: "redmine" - encoding: utf8mb4 - collation: utf8mb4_unicode_ci \ No newline at end of file diff --git a/test/ci/postgres.yml b/test/ci/postgres.yml deleted file mode 100644 index e07ba3c..0000000 --- a/test/ci/postgres.yml +++ /dev/null @@ -1,27 +0,0 @@ -# Redmine plugin for Custom Workflows -# -# Copyright © 2015-19 Anton Argirov -# Copyright © 2019-22 Karel Pičman -# -# 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 - username: redmine - password: redmine - host: localhost \ No newline at end of file diff --git a/test/ci/sqlite3.yml b/test/ci/sqlite3.yml deleted file mode 100644 index 02592a2..0000000 --- a/test/ci/sqlite3.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Redmine plugin for Custom Workflows -# -# Copyright © 2015-19 Anton Argirov -# Copyright © 2019-22 Karel Pičman -# -# 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/redmine.sqlite3 \ No newline at end of file