|
1 |
name: Tests
|
|
2 |
|
|
3 |
on:
|
|
4 |
push:
|
|
5 |
|
|
6 |
jobs:
|
|
7 |
tests:
|
|
8 |
name: test ${{matrix.db}} ruby-${{ matrix.ruby }}
|
|
9 |
runs-on: ubuntu-latest
|
|
10 |
|
|
11 |
strategy:
|
|
12 |
matrix:
|
|
13 |
ruby: ['3.0', '3.1']
|
|
14 |
db: ['postgresql', 'mysql2', 'sqlite3']
|
|
15 |
fail-fast: false
|
|
16 |
|
|
17 |
services:
|
|
18 |
postgres:
|
|
19 |
image: postgres:13
|
|
20 |
env:
|
|
21 |
POSTGRES_DB: redmine_test
|
|
22 |
POSTGRES_USER: root
|
|
23 |
POSTGRES_PASSWORD: root
|
|
24 |
ports:
|
|
25 |
- 5432:5432
|
|
26 |
options: >-
|
|
27 |
--health-cmd pg_isready
|
|
28 |
--health-interval 10s
|
|
29 |
--health-timeout 5s
|
|
30 |
--health-retries 5
|
|
31 |
|
|
32 |
mysql:
|
|
33 |
image: mysql:8.0
|
|
34 |
env:
|
|
35 |
MYSQL_DATABASE: redmine_test
|
|
36 |
MYSQL_ROOT_PASSWORD: 'root'
|
|
37 |
ports:
|
|
38 |
- 3306:3306
|
|
39 |
options: >-
|
|
40 |
--health-cmd="mysqladmin ping"
|
|
41 |
--health-interval=10s
|
|
42 |
--health-timeout=5s
|
|
43 |
--health-retries=3
|
|
44 |
|
|
45 |
steps:
|
|
46 |
- name: Checkout code
|
|
47 |
uses: actions/checkout@v4
|
|
48 |
|
|
49 |
- name: Install dependencies and configure environment
|
|
50 |
run: |
|
|
51 |
sudo apt-get update
|
|
52 |
sudo apt-get install --yes --quiet libsqlite3-dev ghostscript gsfonts locales bzr cvs
|
|
53 |
sudo locale-gen en_US # for bazaar non ascii test
|
|
54 |
|
|
55 |
- name: Allow imagemagick to read PDF files
|
|
56 |
run: |
|
|
57 |
echo '<policymap>' > policy.xml
|
|
58 |
echo '<policy domain="coder" rights="read | write" pattern="PDF" />' >> policy.xml
|
|
59 |
echo '</policymap>' >> policy.xml
|
|
60 |
sudo rm /etc/ImageMagick-6/policy.xml
|
|
61 |
sudo mv policy.xml /etc/ImageMagick-6/policy.xml
|
|
62 |
|
|
63 |
- if: ${{ matrix.db == 'sqlite3' }}
|
|
64 |
name: Prepare test database for sqlite3
|
|
65 |
run: |
|
|
66 |
cat > config/database.yml <<EOF
|
|
67 |
test:
|
|
68 |
adapter: sqlite3
|
|
69 |
database: db/test.sqlite3
|
|
70 |
EOF
|
|
71 |
|
|
72 |
- if: ${{ matrix.db == 'mysql2' || matrix.db == 'postgresql' }}
|
|
73 |
name: Prepare test database for mysql2 and postgresql
|
|
74 |
run: |
|
|
75 |
cat > config/database.yml <<EOF
|
|
76 |
test:
|
|
77 |
adapter: ${{ matrix.db }}
|
|
78 |
database: redmine_test
|
|
79 |
username: root
|
|
80 |
password: root
|
|
81 |
host: 127.0.0.1
|
|
82 |
EOF
|
|
83 |
|
|
84 |
- name: Install Ruby and gems
|
|
85 |
uses: ruby/setup-ruby@v1
|
|
86 |
with:
|
|
87 |
ruby-version: ${{ matrix.ruby }}
|
|
88 |
bundler-cache: true
|
|
89 |
|
|
90 |
- name: Run prepare test environment
|
|
91 |
env:
|
|
92 |
RAILS_ENV: test
|
|
93 |
SCMS: subversion,git,git_utf8,filesystem,bazaar,cvs
|
|
94 |
run: |
|
|
95 |
bundle exec rake ci:about
|
|
96 |
bundle exec rake ci:setup
|
|
97 |
bundle exec rake db:environment:set
|
|
98 |
|
|
99 |
- name: Run tests
|
|
100 |
run: |
|
|
101 |
bin/rails test
|
|
102 |
|
|
103 |
- name: Run bazaar non ascii test
|
|
104 |
env:
|
|
105 |
LANG: en_US.ISO8859-1
|
|
106 |
LC_ALL: en_US.ISO8859-1
|
|
107 |
run: |
|
|
108 |
bin/rails test test/unit/repository_bazaar_test.rb
|