2020-11-29 18:58:44 +03:00
name : Tests
2020-03-26 09:45:54 +03:00
on :
push :
pull_request :
jobs :
test :
2020-11-29 18:58:44 +03:00
name : ${{ matrix.redmine }} ${{ matrix.db }} ruby-${{ matrix.ruby }}
2020-03-26 09:45:54 +03:00
runs-on : ubuntu-latest
strategy :
matrix :
2024-08-27 10:30:58 +03:00
ruby : [ '3.1' , '3.2' ]
2023-11-05 08:21:43 +03:00
redmine : [ '5.0-stable' , '5.1-stable' , 'master' ]
2020-11-29 18:58:44 +03:00
db : [ 'postgres' , 'mysql' ]
2022-12-26 08:50:24 +03:00
exclude :
- ruby : '3.2'
redmine : 5.0 -stable
2020-11-29 18:58:44 +03:00
fail-fast : false
services :
postgres :
2024-01-21 09:29:59 +03:00
image : postgres:16
2020-11-29 18:58:44 +03:00
env :
POSTGRES_USER : postgres
POSTGRES_PASSWORD : postgres
ports :
- 5432 : 5432
options : >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql :
2021-03-18 10:44:37 +03:00
image : mysql:8.0
2020-11-29 18:58:44 +03:00
env :
2021-03-18 10:44:37 +03:00
MYSQL_ROOT_PASSWORD : 'BestPasswordEver'
2020-11-29 18:58:44 +03:00
ports :
2021-03-18 10:44:37 +03:00
# will assign a random free host port
- 3306 /tcp
2020-11-29 18:58:44 +03:00
options : >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
2020-03-26 09:45:54 +03:00
steps :
2020-11-29 18:58:44 +03:00
- name : Verify MySQL connection from host
run : |
2021-03-18 10:44:37 +03:00
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -pBestPasswordEver -e "SHOW DATABASES"
2020-11-29 18:58:44 +03:00
if : matrix.db == 'mysql'
- name : Checkout Redmine
2023-11-05 08:21:43 +03:00
uses : actions/checkout@v4
2020-11-29 18:58:44 +03:00
with :
repository : redmine/redmine
ref : ${{ matrix.redmine }}
path : redmine
- name : Checkout additionals
2023-11-05 08:21:43 +03:00
uses : actions/checkout@v4
2020-11-29 18:58:44 +03:00
with :
repository : AlphaNodes/additionals
path : redmine/plugins/additionals
- name : Update package archives
run : sudo apt-get update --yes --quiet
- name : Install package dependencies
run : >
sudo apt-get install --yes --quiet
build-essential
cmake
libicu-dev
libpq-dev
libmysqlclient-dev
- name : Setup Ruby
2021-03-03 09:24:20 +03:00
uses : ruby/setup-ruby@v1
2020-11-29 18:58:44 +03:00
with :
ruby-version : ${{ matrix.ruby }}
2021-03-03 09:24:20 +03:00
bundler-cache : true # runs 'bundle install' and caches installed gems automatically
2020-11-29 18:58:44 +03:00
- name : Prepare Redmine source
working-directory : redmine
run : |
cp plugins/additionals/test/support/database-${{ matrix.db }}.yml config/database.yml
cp plugins/additionals/test/support/configuration.yml config/configuration.yml
2022-01-13 20:03:29 +03:00
cp plugins/additionals/test/support/additional_environment.rb config/additional_environment.rb
2020-11-29 18:58:44 +03:00
2022-06-23 18:42:21 +03:00
- name : Setup Gemfile
working-directory : redmine/plugins/additionals
run : |
touch .enable_test
2020-11-29 18:58:44 +03:00
- name : Install Ruby dependencies
working-directory : redmine
run : |
2021-04-06 08:36:07 +03:00
bundle config set --local without 'development'
bundle install --jobs=4 --retry=3
2020-11-29 18:58:44 +03:00
- name : Run Redmine rake tasks
env :
RAILS_ENV : test
2021-03-18 10:44:37 +03:00
MYSQL_PORT : ${{ job.services.mysql.ports[3306] }}
2020-11-29 18:58:44 +03:00
working-directory : redmine
run : |
bundle exec rake generate_secret_token
bundle exec rake db:create db:migrate redmine:plugins:migrate
- name : Run tests
env :
RAILS_ENV : test
2021-03-18 10:44:37 +03:00
MYSQL_PORT : ${{ job.services.mysql.ports[3306] }}
2020-11-29 18:58:44 +03:00
working-directory : redmine
run : bundle exec rake redmine:plugins:test NAME=additionals RUBYOPT="-W0"
- name : Run uninstall test
env :
RAILS_ENV : test
2021-03-18 10:44:37 +03:00
MYSQL_PORT : ${{ job.services.mysql.ports[3306] }}
2020-11-29 18:58:44 +03:00
working-directory : redmine
run : bundle exec rake redmine:plugins:migrate NAME=additionals VERSION=0
2021-01-18 12:16:26 +03:00
- name : Run build gem file
working-directory : redmine/plugins/additionals
run : gem build additionals.gemspec