From 32f87a49f436b8a1f43dcea9cec0c54537104aeb Mon Sep 17 00:00:00 2001 From: Naoki Takaesu Date: Mon, 30 Jan 2023 10:45:31 +0900 Subject: [PATCH 1/5] fix circleci config --- .circleci/config.yml | 149 +++++++++++++++++++------------------------ 1 file changed, 67 insertions(+), 82 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ea7a2b73..e6190e3d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,89 +1,74 @@ -# 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/redmine-plugin@2.3.0 + 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 - 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/migrate-without-plugins + - plugin-test/run-tests 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' From 4fc9d3dd4592fd21217358b31f49e2642d136b56 Mon Sep 17 00:00:00 2001 From: Naoki Takaesu Date: Mon, 30 Jan 2023 10:54:24 +0900 Subject: [PATCH 2/5] Add rspec --- .circleci/config.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e6190e3d..85758606 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,6 +59,32 @@ jobs: - 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 + - 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: run-tests-workflow: jobs: @@ -72,3 +98,14 @@ workflows: 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.0.9' + ruby_version: '2.6' + db: mysql + db_version: '5.7-ram' From 6f5965d2c408de64784a03e6dbc3e45d0de5c9d0 Mon Sep 17 00:00:00 2001 From: Naoki Takaesu Date: Mon, 30 Jan 2023 11:00:30 +0900 Subject: [PATCH 3/5] refactor: merge test and rspec --- .circleci/config.yml | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 85758606..87584937 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -57,34 +57,9 @@ jobs: - redmine-plugin/install-self - redmine-plugin/generate-database_yml - redmine-plugin/bundle-install + - redmine-plugin/rspec - 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 - - 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: run-tests-workflow: jobs: @@ -98,14 +73,3 @@ workflows: 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.0.9' - ruby_version: '2.6' - db: mysql - db_version: '5.7-ram' From c1e81494122026178d9cb1f314d586b83fc9b0aa Mon Sep 17 00:00:00 2001 From: Naoki Takaesu Date: Mon, 30 Jan 2023 11:05:44 +0900 Subject: [PATCH 4/5] Revert "refactor: merge test and rspec" This reverts commit 6f5965d2c408de64784a03e6dbc3e45d0de5c9d0. --- .circleci/config.yml | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 87584937..85758606 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -57,9 +57,34 @@ jobs: - redmine-plugin/install-self - redmine-plugin/generate-database_yml - redmine-plugin/bundle-install - - redmine-plugin/rspec - 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 + - 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: run-tests-workflow: jobs: @@ -73,3 +98,14 @@ workflows: 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.0.9' + ruby_version: '2.6' + db: mysql + db_version: '5.7-ram' From 40a9c867ea78bcdc05b337b8a7a513bb02d35aa8 Mon Sep 17 00:00:00 2001 From: Naoki Takaesu Date: Mon, 30 Jan 2023 11:11:37 +0900 Subject: [PATCH 5/5] fix rspec oldest versions --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 85758606..4bdb522c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -105,7 +105,7 @@ workflows: db: pg - rspec: name: RSpec on oldest versions with MySQL - redmine_version: '4.0.9' + redmine_version: '4.2.9' ruby_version: '2.6' db: mysql db_version: '5.7-ram'