-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (144 loc) · 5.5 KB
/
5-0-stable.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This configuration is taken from Redmine DMSF and Redmine Base Deface plugin
# and adapted to the needs of this plugin.
#
# Copyright © 2023 Liane Hampe <[email protected]>
# Copyright © 2022-23 Karel Pičman <[email protected]>
# Copyright © 2022 Jean-Baptiste Barth <[email protected]>
name: "GitHub CI"
on:
push:
branches: ["develop"]
pull_request:
branches: ["develop"]
jobs:
plugin_tests:
strategy:
fail-fast: false
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_table_calculation_inheritance
steps:
- name: Clone Redmine
# Get the latest stable Redmine
run: svn export http://svn.redmine.org/redmine/branches/5.0-stable/ redmine
- name: Checkout dependencies - Base Deface
uses: actions/checkout@v3
with:
repository: xmera-circle/redmine_base_deface
path: redmine/plugins/redmine_base_deface
- name: Checkout dependencies - Advanced Plugin Helper
uses: actions/checkout@v3
with:
repository: xmera-circle/advanced_plugin_helper
path: redmine/plugins/advanced_plugin_helper
- name: Checkout dependencies - Project Types
uses: actions/checkout@v3
with:
repository: xmera-circle/redmine_project_types
path: redmine/plugins/redmine_project_types
- name: Checkout dependencies - Project Types Relations
uses: actions/checkout@v3
with:
repository: xmera-circle/redmine_project_types_relations
path: redmine/plugins/redmine_project_types_relations
- name: Checkout dependencies - Table Calculation
uses: actions/checkout@v3
with:
repository: xmera-circle/redmine_table_calculation
path: redmine/plugins/redmine_table_calculation
- name: Checkout plugin
uses: actions/checkout@v3
with:
path: redmine/plugins/${{ env.NAME }}
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '3.1'
- name: Setup database
# Create the database
run: |
echo "${{matrix.database_configuration}}" > 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: |
echo "gem \"webrick\"" > Gemfile.local
bundle config set --local without 'rmagick development'
bundle install
bundle exec rake generate_secret_token
bundle exec rake db:migrate
bundle exec rake redmine:plugins:migrate
bundle exec rake redmine:load_default_data
env:
REDMINE_LANG: en
working-directory: redmine
- name: Standard plugin tests
# Run the tests
working-directory: redmine
run: |
bundle exec rake redmine:plugins:test:units
bundle exec rake redmine:plugins:test:functionals
bundle exec rake redmine:plugins:test:integration
- name: Cleanup
# Rollback plugin's changes to the database
# Stop the database engine
working-directory: redmine
run: |
bundle exec rake redmine:plugins:migrate VERSION=0
if [[ "${{matrix.database_service}}" ]]; then
sudo systemctl stop ${{matrix.engine}}
fi