forked from agileware-jp/redmine_issue_templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request agileware-jp#57 from agileware-jp/ci_for_latest_ve…
…rsion CI for tests for working with Redmine 4.x and 5.x
- Loading branch information
Showing
1 changed file
with
102 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,111 @@ | ||
# Ruby CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-ruby/ for more details | ||
# | ||
version: 2 | ||
version: 2.1 | ||
|
||
general: | ||
artifacts: | ||
- coverage/${CIRCLE_PROJECT_REPONAME}_test/index.html | ||
orbs: | ||
redmine-plugin: agileware-jp/[email protected] | ||
plugin-test: | ||
commands: | ||
run-tests: | ||
parameters: | ||
plugin: | ||
default: '' | ||
description: Plugin name. If unspecified it will be the current repository's plugin. | ||
type: string | ||
redmine_root: | ||
default: redmine | ||
description: Directory where redmine is installed | ||
type: string | ||
steps: | ||
- run: | ||
name: Setup Database | ||
command: 'RAILS_ENV=test bundle exec rake db:migrate redmine:plugins:migrate' | ||
working_directory: << parameters.redmine_root >> | ||
- run: | ||
name: Set tested plugin | ||
command: | | ||
PLUGIN_NAME='<< parameters.plugin >>' | ||
if [ -z $PLUGIN_NAME ]; then | ||
PLUGIN_NAME=$CIRCLE_PROJECT_REPONAME | ||
fi | ||
echo $PLUGIN_NAME >> .tested_plugin | ||
working_directory: << parameters.redmine_root >> | ||
- run: | ||
command: >- | ||
RAILS_ENV=test bundle exec rake redmine:plugins:test PLUGIN=`cat .tested_plugin` | ||
working_directory: << parameters.redmine_root >> | ||
jobs: | ||
build: | ||
docker: | ||
# specify the version you desire here (ruby 2.6.x) | ||
- image: circleci/ruby:2.6-browsers-legacy | ||
run-tests: | ||
executor: | ||
name: redmine-plugin/ruby-<< parameters.database >> | ||
ruby_version: << parameters.ruby_version >> | ||
parameters: | ||
database: | ||
enum: | ||
- mysql | ||
- pg | ||
- mariadb | ||
- sqlite3 | ||
type: enum | ||
redmine_version: | ||
type: string | ||
ruby_version: | ||
type: string | ||
steps: | ||
- checkout | ||
test: | ||
docker: | ||
# specify the version you desire here | ||
- image: circleci/ruby:2.6-browsers-legacy | ||
environment: | ||
RAILS_ENV: test | ||
DB_HOST: 127.0.0.1 | ||
DRIVER: headless | ||
TZ: /usr/share/zoneinfo/Asia/Tokyo | ||
- image: mysql:5.7 | ||
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --innodb-large-prefix=true --innodb-file-format=Barracuda --sql-mode="" | ||
environment: | ||
MYSQL_ROOT_USER: root | ||
MYSQL_ALLOW_EMPTY_PASSWORD: yes | ||
|
||
working_directory: ~/repo | ||
- redmine-plugin/download-redmine: | ||
version: << parameters.redmine_version >> | ||
- redmine-plugin/install-self | ||
- redmine-plugin/generate-database_yml | ||
- redmine-plugin/bundle-install | ||
- redmine-plugin/migrate-without-plugins | ||
- plugin-test/run-tests | ||
rspec: | ||
parameters: | ||
redmine_version: | ||
type: string | ||
ruby_version: | ||
type: string | ||
default: '2.7' | ||
db: | ||
type: enum | ||
enum: ['mysql', 'pg'] | ||
default: pg | ||
db_version: | ||
type: string | ||
default: 'latest-ram' | ||
executor: | ||
name: redmine-plugin/ruby-<< parameters.db >> | ||
ruby_version: << parameters.ruby_version >> | ||
db_version: << parameters.db_version >> | ||
steps: | ||
- checkout | ||
- run: | ||
name: ready for redmine | ||
command: | | ||
REDMINE_BRANCH=master sh script/circleci-setup.sh | ||
- run: perl -pi -e "s/gem \"capybara\".*$/gem \"capybara\"/g" Gemfile | ||
- run: bundle install --path vendor/bundle --without postgresql rmagick && bundle update | ||
- run: bundle exec rails g rspec:install | ||
- run: bundle exec rake db:create RAILS_ENV=test | ||
- run: bundle exec rake db:migrate RAILS_ENV=test | ||
- run: bundle exec rake redmine:plugins:migrate RAILS_ENV=test | ||
- run: | ||
command: | | ||
bundle exec rake ${CIRCLE_PROJECT_REPONAME}:test RAILS_ENV=test | ||
- run: | ||
command: | | ||
bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/models/ | ||
- run: | ||
command: | | ||
bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/helpers/ | ||
- run: | ||
command: | | ||
bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/controllers/ | ||
- run: | ||
command: | | ||
bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/requests/ | ||
- run: | ||
command: | | ||
bundle exec rspec -I plugins/redmine_issue_templates/spec --format documentation plugins/redmine_issue_templates/spec/features/ | ||
- run: | ||
command: | | ||
bundle exec rake redmine:plugins:migrate NAME=${CIRCLE_PROJECT_REPONAME} \ | ||
VERSION=0 RAILS_ENV=test | ||
- run: | ||
command: | | ||
mkdir -p /tmp/coverage | ||
cp -r coverage/${CIRCLE_PROJECT_REPONAME}_test /tmp/coverage/ | ||
cp -r coverage/${CIRCLE_PROJECT_REPONAME}_spec /tmp/coverage/ | ||
- store_artifacts: | ||
path: /tmp/coverage | ||
|
||
- redmine-plugin/download-redmine: | ||
version: << parameters.redmine_version >> | ||
- redmine-plugin/install-self | ||
- redmine-plugin/generate-database_yml | ||
- redmine-plugin/bundle-install | ||
- redmine-plugin/rspec | ||
workflows: | ||
version: 2 | ||
build_and_test: | ||
run-tests-workflow: | ||
jobs: | ||
- build | ||
- test: | ||
requires: | ||
- build | ||
filters: | ||
branches: | ||
ignore: | ||
- /v0.2.x-support-Redmine3.*/ | ||
|
||
- run-tests: | ||
name: test on newest versions with PostgreSQL | ||
database: pg | ||
ruby_version: '2.7' | ||
redmine_version: 'latest' | ||
- run-tests: | ||
name: test on oldest versions with MySQL | ||
database: mysql | ||
ruby_version: '2.6' | ||
redmine_version: '4.2.9' | ||
- rspec: | ||
name: RSpec on newest versions with PostgreSQL | ||
redmine_version: latest | ||
ruby_version: '2.7' | ||
db: pg | ||
- rspec: | ||
name: RSpec on oldest versions with MySQL | ||
redmine_version: '4.2.9' | ||
ruby_version: '2.6' | ||
db: mysql | ||
db_version: '5.7-ram' |