-
Notifications
You must be signed in to change notification settings - Fork 2
186 lines (167 loc) · 7.51 KB
/
Copy pathtest-postgis.yml
File metadata and controls
186 lines (167 loc) · 7.51 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Test with PostGIS
env:
PLUGIN_NAME: ${{ github.event.repository.name }}
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: redmine:${{ matrix.redmine_version }} ruby:${{ matrix.ruby_version }} postgis:${{ matrix.db_version }}
runs-on: ubuntu-latest
# Cap runaway steps (stalled bundle install, asset build, or DB wait) well
# under GitHub's 6-hour default so a hang can't hold the concurrency group.
timeout-minutes: 30
env:
# Redmine 7 (Rails 8.1) needs the 8.1-compatible geo gem stack; older
# Redmine stays on the defaults. redmine_gtt's Gemfile reads these env
# vars, and this plugin checks out redmine_gtt as a dependency, so
# setting them here drives the whole bundle.
GEM_RGEO_VERSION: ${{ matrix.rgeo || '3.0.1' }}
GEM_RGEO_ACTIVERECORD_VERSION: ${{ matrix.rgeo_ar || '8.0.0' }}
GEM_ACTIVERECORD_POSTGIS_ADAPTER_VERSION: ${{ matrix.postgis_adapter || '10.0.0' }}
strategy:
fail-fast: false
# Curated matrix mirroring redmine_gtt's `next` workflow instead of a full
# redmine x ruby x postgis cross-product, split into two concerns so
# coverage stays broad but the job count small:
# * compat - each supported Redmine/Ruby pair once, on the ceiling DB.
# Supported Rubies per
# https://redmine.jp/tech_note/supported-rubies/:
# 6.0 -> 3.3, 6.1 -> 3.3/3.4, 7.0 -> 3.4/4.0.
# * database - the PostGIS variants (PG 15/17), pinned to the
# known-stable 6.1/3.4 pair to isolate DB issues from
# Redmine-7/Ruby-4 newness.
# Redmine 7 rows carry the Rails 8.1 geo gem stack via the matrix
# overrides consumed by the env block above; 6.x uses the defaults.
matrix:
include:
# compat: each supported Redmine/Ruby pair once, on the 18-3.6 ceiling.
# The 6.1/3.4 pair is exercised by the database rows below.
- { redmine_version: 6.0-stable, ruby_version: '3.3', db_version: 18-3.6 }
- { redmine_version: 6.1-stable, ruby_version: '3.3', db_version: 18-3.6 }
- { redmine_version: 7.0-stable, ruby_version: '3.4', db_version: 18-3.6, rgeo_ar: '8.1.0', postgis_adapter: '11.1.0' }
- { redmine_version: 7.0-stable, ruby_version: '4.0', db_version: 18-3.6, rgeo: '3.1.0', rgeo_ar: '8.1.0', postgis_adapter: '11.1.0', system_test: true }
# database: PG 15/17 pinned to the known-stable 6.1/3.4 pair.
- { redmine_version: 6.1-stable, ruby_version: '3.4', db_version: 15-3.4 }
- { redmine_version: 6.1-stable, ruby_version: '3.4', db_version: 17-3.5 }
services:
postgres:
image: postgis/postgis:${{ matrix.db_version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout Redmine
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: redmine/redmine
ref: ${{ matrix.redmine_version }}
path: redmine
persist-credentials: false
# redmine_gtt is a hard dependency: this plugin uses RedmineGtt::Conversions
# for geometry and relies on the `geom` column its migration adds to issues.
# It is checked out from `next` on purpose: that is redmine_gtt's
# integration branch (Rails 8.1 / Redmine 7 compat lands there first), and
# this plugin must stay compatible with it. A CI break caused by a
# redmine_gtt change is a signal we want early, not noise to be pinned away.
- name: Checkout redmine_gtt (dependency)
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: gtt-project/redmine_gtt
ref: next
path: redmine/plugins/redmine_gtt
persist-credentials: false
- name: Checkout Plugin
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: redmine/plugins/${{ env.PLUGIN_NAME }}
persist-credentials: false
- name: Set up Ruby
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: ${{ matrix.ruby_version }}
- name: Install native gem system libraries
# pg and rgeo-geos gems' headers need these.
run: |
sudo apt-get update --yes --quiet
sudo apt-get install --yes --quiet --no-install-recommends libpq-dev libgeos-dev
- name: Prepare Redmine source
working-directory: redmine
run: |
cat <<EOF > config/database.yml
test:
adapter: postgis
database: redmine
host: 127.0.0.1
username: postgres
password: postgres
encoding: utf8
EOF
- name: Install Ruby dependencies
working-directory: redmine
run: |
bundle config set --local without 'development'
bundle install --jobs=4 --retry=3
- name: Run Redmine rake tasks
env:
RAILS_ENV: test
working-directory: redmine
run: |
bundle exec rake generate_secret_token
bundle exec rake db:create db:migrate redmine:plugins:migrate
# Eager-load gate. Test and development environments load lazily, so a
# filename/constant mismatch nothing references at boot can still make a
# production instance (which eager loads) die with a NameError. That is
# what happened to redmine_gtt_sync: green CI, unbootable production.
#
# This previously ran only `if grep -q zeitwerk config/application.rb`,
# which never matches: Redmine configures Zeitwerk in
# config/initializers/zeitwerk.rb, not application.rb. The step therefore
# passed without ever running the task. The rake task ships with Rails 6+,
# so every row in this matrix has it and no guard is needed.
- name: Zeitwerk check
env:
RAILS_ENV: test
working-directory: redmine
run: bundle exec rake zeitwerk:check
- name: Run tests
env:
RAILS_ENV: test
# For system tests in the plugin
GOOGLE_CHROME_OPTS_ARGS: "headless,disable-gpu,no-sandbox,disable-dev-shm-usage"
working-directory: redmine
# Only run suites that exist; `rails test` raises LoadError on a
# missing directory (functional/integration/system get added as the
# revival progresses). System tests only run on the designated matrix
# cell, like in redmine_gtt.
run: |
suites="unit functional integration"
if [ "${{ matrix.system_test }}" = "true" ]; then
suites="$suites system"
fi
for suite in $suites; do
dir="plugins/${{ env.PLUGIN_NAME }}/test/$suite"
if [ -d "$dir" ]; then
bundle exec rails test "$dir"
else
echo "Skipping $suite tests ($dir does not exist yet)"
fi
done
- name: Run uninstall test
env:
RAILS_ENV: test
working-directory: redmine
run: bundle exec rake redmine:plugins:migrate NAME=${{ env.PLUGIN_NAME }} VERSION=0