Skip to content

Commit 74cdd2d

Browse files
authored
Merge pull request #28 from gtt-project/ftr/action-setup-redmine
Use GitHub Actions Marketplace "Setup Redmine" for CI
2 parents 09f35b5 + 375fb9b commit 74cdd2d

File tree

1 file changed

+7
-94
lines changed

1 file changed

+7
-94
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,19 @@ jobs:
1919
name: redmine:${{ matrix.redmine_version }} ruby:${{ matrix.ruby_version }} db:${{ matrix.db }}
2020
runs-on: ubuntu-22.04
2121

22-
container:
23-
image: ruby:${{ matrix.ruby_version }}-bullseye
24-
2522
strategy:
2623
fail-fast: false
2724
matrix:
2825
redmine_version: [4.2-stable, 5.0-stable, 5.1-stable, master]
2926
ruby_version: ['2.7', '3.0', '3.1', '3.2']
30-
db: [mysql, postgres, sqlite]
27+
db: ['mysql:5.7', 'postgres:10', 'sqlite3']
3128
# System test takes 2~3 times longer, so limit to specific matrix combinations
3229
# See: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
3330
include:
3431
- system_test: true
3532
redmine_version: 5.1-stable
3633
ruby_version: '3.2'
37-
db: mysql
34+
db: 'mysql:5.7'
3835
exclude:
3936
- redmine_version: 4.2-stable
4037
ruby_version: '3.0'
@@ -47,112 +44,34 @@ jobs:
4744
- redmine_version: master
4845
ruby_version: '2.7'
4946

50-
services:
51-
mysql:
52-
image: mysql:5.7 # min
53-
# image: mysql:8.0 # latest
54-
env:
55-
MYSQL_ROOT_PASSWORD: password
56-
ports:
57-
- 3306:3306
58-
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 5
59-
postgres:
60-
image: postgres:10 # min
61-
# image: postgres:15 # latest
62-
env:
63-
POSTGRES_USER: postgres
64-
POSTGRES_PASSWORD: postgres
65-
ports:
66-
- 5432:5432
67-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
68-
6947
steps:
70-
- name: Checkout Redmine
71-
uses: actions/checkout@v4
48+
- name: Setup Redmine
49+
uses: hidakatsuya/action-setup-redmine@v1
7250
with:
7351
repository: redmine/redmine
74-
ref: ${{ matrix.redmine_version }}
52+
version: ${{ matrix.redmine_version }}
53+
ruby-version: ${{ matrix.ruby_version }}
54+
database: ${{ matrix.db }}
7555
path: redmine
7656

7757
- name: Checkout Plugin
7858
uses: actions/checkout@v4
7959
with:
8060
path: redmine/plugins/${{ env.PLUGIN_NAME }}
8161

82-
- name: Update package archives
83-
run: apt-get update --yes --quiet
84-
85-
- name: Install package dependencies
86-
run: |
87-
if [ ${{ matrix.db }} = "mysql" ]; then
88-
apt-get install --yes --quiet default-mysql-client-core
89-
fi
90-
if [ ${{ matrix.db }} = "postgres" ]; then
91-
apt-get install --yes --quiet postgresql-client
92-
fi
93-
# For system test
94-
if [ ${{ matrix.system_test }} = "true" ]; then
95-
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
96-
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
97-
apt-get -y update
98-
apt-get install -y google-chrome-stable
99-
fi
100-
101-
- name: Verify MySQL connection from host
102-
if: matrix.db == 'mysql'
103-
run: |
104-
mysql --host mysql --port 3306 -uroot -ppassword -e "SHOW DATABASES"
105-
106-
- name: Prepare Redmine source
107-
working-directory: redmine
108-
run: |
109-
if [ ${{ matrix.db }} = "mysql" ]; then
110-
cat <<EOF > config/database.yml
111-
test:
112-
adapter: mysql2
113-
database: redmine
114-
host: mysql
115-
username: root
116-
password: password
117-
encoding: utf8mb4
118-
EOF
119-
fi
120-
if [ ${{ matrix.db }} = "postgres" ]; then
121-
cat <<EOF > config/database.yml
122-
test:
123-
adapter: postgresql
124-
database: redmine
125-
host: postgres
126-
username: postgres
127-
password: postgres
128-
encoding: utf8
129-
EOF
130-
fi
131-
if [ ${{ matrix.db }} = "sqlite" ]; then
132-
cat <<EOF > config/database.yml
133-
test:
134-
adapter: sqlite3
135-
database: db/redmine.sqlite3
136-
EOF
137-
fi
138-
13962
- name: Install Ruby dependencies
14063
working-directory: redmine
14164
run: |
14265
bundle config set --local without 'development'
14366
bundle install --jobs=4 --retry=3
14467
14568
- name: Run Redmine rake tasks
146-
env:
147-
RAILS_ENV: test
14869
working-directory: redmine
14970
run: |
15071
bundle exec rake generate_secret_token
15172
bundle exec rake db:create db:migrate redmine:plugins:migrate
15273
15374
- name: Zeitwerk check
154-
env:
155-
RAILS_ENV: test
15675
working-directory: redmine
15776
run: |
15877
if grep -q zeitwerk config/application.rb ; then
@@ -161,10 +80,6 @@ jobs:
16180
shell: bash
16281

16382
- name: Run plugin tests
164-
env:
165-
RAILS_ENV: test
166-
# For system test in plugin
167-
GOOGLE_CHROME_OPTS_ARGS: "headless,disable-gpu,no-sandbox,disable-dev-shm-usage"
16883
working-directory: redmine
16984
run: |
17085
bundle exec rake redmine:plugins:test:units NAME=${{ env.PLUGIN_NAME }} RUBYOPT="-W0"
@@ -190,7 +105,5 @@ jobs:
190105
# run: bundle exec rake test:system
191106

192107
- name: Run uninstall test
193-
env:
194-
RAILS_ENV: test
195108
working-directory: redmine
196109
run: bundle exec rake redmine:plugins:migrate NAME=${{ env.PLUGIN_NAME }} VERSION=0

0 commit comments

Comments
 (0)