Skip to content

Commit 09ff5f2

Browse files
committed
Add support for Redmine 5.1/6.0/6.1
1 parent 4992940 commit 09ff5f2

23 files changed

+197
-84
lines changed
Lines changed: 112 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,64 @@
1-
name: Test
1+
name: CI
22

33
on:
44
- push
55
- pull_request
66

77
jobs:
88
test:
9-
name: ${{ matrix.redmine }} ${{ matrix.db }} ruby-${{ matrix.ruby }}
9+
name: ${{ matrix.redmine[0] }} ${{ matrix.db }} ruby-${{ matrix.ruby }}
1010
runs-on: ubuntu-latest
1111

1212
strategy:
13-
matrix:
14-
ruby: ['2.7', '3.0', '3.1']
15-
redmine: ['5.0-stable', 'master']
16-
db: ['postgres', 'mysql']
1713
fail-fast: false
14+
matrix:
15+
ruby:
16+
- '3.4'
17+
- '3.3'
18+
- '3.2'
19+
- '3.1'
20+
- '3.0'
21+
redmine:
22+
# we must follow "additionals" Redmine plugin version constraints
23+
# see: https://github.com/alphanodes/additionals/blob/main/CHANGELOG.md
24+
# [redmine_version, additionals_version]
25+
- ['5.0-stable', '3.2.0']
26+
- ['5.1-stable', '3.4.0']
27+
- ['6.0-stable', '4.0.0']
28+
- ['6.1-stable', '4.3.0']
29+
db:
30+
- 'postgres'
31+
- 'mysql'
32+
33+
exclude:
34+
- ruby: '3.4'
35+
redmine: ['5.0-stable', '3.2.0']
36+
- ruby: '3.4'
37+
redmine: ['5.1-stable', '3.4.0']
38+
- ruby: '3.4'
39+
redmine: ['6.0-stable', '4.0.0']
40+
41+
- ruby: '3.3'
42+
redmine: ['5.0-stable', '3.2.0']
43+
- ruby: '3.3'
44+
redmine: ['5.1-stable', '3.4.0']
45+
46+
- ruby: '3.2'
47+
redmine: ['5.0-stable', '3.2.0']
48+
49+
- ruby: '3.1'
50+
redmine: ['6.1-stable', '4.3.0']
51+
52+
- ruby: '3.0'
53+
redmine: ['5.1-stable', '3.4.0']
54+
- ruby: '3.0'
55+
redmine: ['6.0-stable', '4.0.0']
56+
- ruby: '3.0'
57+
redmine: ['6.1-stable', '4.3.0']
1858

1959
services:
2060
postgres:
21-
image: postgres:14
61+
image: postgres:18
2262
env:
2363
POSTGRES_USER: postgres
2464
POSTGRES_PASSWORD: postgres
@@ -32,7 +72,7 @@ jobs:
3272
--health-retries 5
3373
3474
mysql:
35-
image: mysql:8.0
75+
image: mysql:9.6
3676
env:
3777
MYSQL_ROOT_PASSWORD: 'BestPasswordEver'
3878
ports:
@@ -50,67 +90,59 @@ jobs:
5090
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -pBestPasswordEver -e "SHOW DATABASES"
5191
if: matrix.db == 'mysql'
5292

53-
- name: Checkout Redmine
54-
uses: actions/checkout@v3
93+
# install system deps
94+
- name: Install package dependencies
95+
run: |
96+
sudo apt-get update --yes --quiet &&
97+
sudo apt-get install --yes --quiet \
98+
build-essential \
99+
cmake \
100+
libgpg-error-dev \
101+
libicu-dev \
102+
libpq-dev \
103+
libmysqlclient-dev \
104+
libssh2-1 \
105+
libssh2-1-dev \
106+
pkg-config \
107+
subversion
108+
109+
# install redmine
110+
- name: Checkout redmine
111+
uses: actions/checkout@v6
55112
with:
56113
repository: redmine/redmine
57-
ref: ${{ matrix.redmine }}
58114
path: redmine
115+
ref: ${{ matrix.redmine[0] }}
59116

117+
# install redmine_git_hosting plugin
60118
- name: Checkout redmine_git_hosting
61-
uses: actions/checkout@v3
119+
uses: actions/checkout@v6
62120
with:
63121
path: redmine/plugins/redmine_git_hosting
64122

123+
# install additionals plugin
65124
- name: Checkout additionals
66-
uses: actions/checkout@v3
125+
uses: actions/checkout@v6
67126
with:
68127
repository: AlphaNodes/additionals
69128
path: redmine/plugins/additionals
129+
ref: ${{ matrix.redmine[1] }}
70130

131+
# install sidekiq plugin
71132
- name: Checkout redmine_sidekiq
72-
uses: actions/checkout@v3
133+
uses: actions/checkout@v6
73134
with:
74-
# TODO Switch back to the original repo, once https://github.com/ogom/redmine_sidekiq/pull/16 is released
75-
# repository: ogom/redmine_sidekiq
76-
repository: dosyfier/redmine_sidekiq
77-
ref: fix-rails-6
135+
repository: redmine-git-hosting/redmine_sidekiq
78136
path: redmine/plugins/redmine_sidekiq
79137

138+
# install gitolite
80139
- name: Checkout gitolite
81-
uses: actions/checkout@v3
140+
uses: actions/checkout@v6
82141
with:
83142
repository: sitaramc/gitolite
84143
path: gitolite
85144

86-
- name: Update package archives
87-
run: sudo apt-get update --yes --quiet
88-
89-
- name: Install package dependencies
90-
run: >
91-
sudo apt-get install --yes --quiet
92-
build-essential
93-
cmake
94-
libgpg-error-dev
95-
libicu-dev
96-
libpq-dev
97-
libmysqlclient-dev
98-
libssh2-1
99-
libssh2-1-dev
100-
pkg-config
101-
subversion
102-
103-
- name: Setup Ruby
104-
uses: ruby/setup-ruby@v1
105-
with:
106-
ruby-version: ${{ matrix.ruby }}
107-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
108-
109-
- name: Prepare Redmine source
110-
working-directory: redmine
111-
run: |
112-
cp plugins/redmine_git_hosting/contrib/github/database-${{ matrix.db }}.yml config/database.yml
113-
145+
# configure gitolite
114146
- name: Install admin ssh key
115147
working-directory: redmine
116148
run: |
@@ -120,24 +152,49 @@ jobs:
120152
working-directory: redmine
121153
run: |
122154
sudo useradd --create-home git
155+
sudo chmod 755 /home/git /home/runner
123156
sudo -n -u git -i mkdir bin
124157
sudo -n -u git -i $GITHUB_WORKSPACE/gitolite/install -to /home/git/bin
125158
sudo cp plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa.pub /home/git/
126159
sudo chown git.git /home/git/redmine_gitolite_admin_id_rsa.pub
127160
sudo -n -u git -i bin/gitolite setup -pk redmine_gitolite_admin_id_rsa.pub
128161
129-
- name: Install Ruby dependencies
162+
# configure ruby dependencies
163+
- name: Setup Ruby dependencies
164+
working-directory: redmine
165+
if: matrix.redmine[0] == '6.0-stable' || matrix.redmine[0] == '6.1-stable'
166+
run: |
167+
echo "gem 'observer'" > Gemfile.local
168+
echo "gem 'redcarpet'" >> Gemfile.local
169+
170+
- name: Setup Bundler
171+
working-directory: redmine
172+
run: |
173+
mkdir .bundle
174+
{
175+
echo '---'
176+
echo 'BUNDLE_BUILD__RUGGED: "--with-ssh"'
177+
echo 'BUNDLE_WITHOUT: "development"'
178+
} > .bundle/config
179+
180+
- name: Prepare Redmine source
130181
working-directory: redmine
131182
run: |
132-
bundle config set --local without 'development'
133-
bundle config build.rugged --with-ssh
134-
bundle install --jobs=4 --retry=3
183+
cp plugins/redmine_git_hosting/contrib/github/database-${{ matrix.db }}.yml config/database.yml
135184
185+
- name: Setup Ruby
186+
uses: ruby/setup-ruby@v1
187+
with:
188+
working-directory: redmine
189+
ruby-version: ${{ matrix.ruby }}
190+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
191+
192+
# configure redmine
136193
- name: Run Redmine rake tasks
194+
working-directory: redmine
137195
env:
138196
RAILS_ENV: test
139197
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
140-
working-directory: redmine
141198
run: |
142199
bundle exec rake generate_secret_token
143200
bundle exec rake db:create db:migrate redmine:plugins:migrate
@@ -149,16 +206,17 @@ jobs:
149206
mkdir spec
150207
cp plugins/redmine_git_hosting/spec/root_spec_helper.rb spec/spec_helper.rb
151208
209+
# run tests
152210
- name: Run tests
211+
working-directory: redmine
153212
env:
154213
RAILS_ENV: test
155214
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
156-
working-directory: redmine
157215
run: bundle exec rake redmine_git_hosting:ci:all
158216

159217
- name: Run uninstall test
218+
working-directory: redmine
160219
env:
161220
RAILS_ENV: test
162221
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
163-
working-directory: redmine
164222
run: bundle exec rake redmine:plugins:migrate NAME=redmine_git_hosting VERSION=0

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ gem 'RedCloth'
3232
gem 'rack-parser', require: 'rack/parser'
3333

3434
# temp autoloading fix
35-
gem 'sidekiq', '<7'
35+
# gem 'sidekiq', '<7'
3636
gem 'sshkey'
3737

3838
group :development, :test do

app/controllers/repository_mirrors_controller.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ class RepositoryMirrorsController < RedmineGitHostingController
66

77
accept_api_auth :index, :show
88

9-
helper :additionals_clipboardjs
9+
if RedmineGitHosting.old_additionals?
10+
helper :additionals_clipboardjs
11+
else
12+
helper :additionals_clipboard
13+
end
1014

1115
def index
1216
@repository_mirrors = @repository.mirrors.sorted

app/models/git_cache.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
class GitCache < ActiveRecord::Base
3+
class GitCache < RedmineGitHosting.old_redmine? ? ActiveRecord::Base : ApplicationRecord
44
include Redmine::SafeAttributes
55

66
CACHE_ADAPTERS = [%w[Database database],

app/models/github_comment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
class GithubComment < ActiveRecord::Base
3+
class GithubComment < RedmineGitHosting.old_redmine? ? ActiveRecord::Base : ApplicationRecord
44
## Relations
55
belongs_to :journal
66

app/models/github_issue.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
class GithubIssue < ActiveRecord::Base
3+
class GithubIssue < RedmineGitHosting.old_redmine? ? ActiveRecord::Base : ApplicationRecord
44
## Relations
55
belongs_to :issue
66

app/models/gitolite_public_key.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
class GitolitePublicKey < ActiveRecord::Base
3+
class GitolitePublicKey < RedmineGitHosting.old_redmine? ? ActiveRecord::Base : ApplicationRecord
44
include Redmine::SafeAttributes
55

66
TITLE_LENGTH_LIMIT = 60

0 commit comments

Comments
 (0)