-
Notifications
You must be signed in to change notification settings - Fork 19
110 lines (101 loc) · 3.39 KB
/
test.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
name: Tests
on:
push:
branches: ['master']
pull_request:
jobs:
test:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
strategy:
fail-fast: false
matrix:
include:
### TEST RUBY VERSIONS
- ruby: "2.5"
- ruby: "2.6"
- ruby: "2.7"
- ruby: "3.0"
db_gem_version: "~> 1.4" # fixes sqlite3 gem dependency issue
- ruby: "3.1"
- ruby: "3.2"
- ruby: "3.3"
### TEST RAILS VERSIONS
- ruby: "2.6"
rails_version: "~> 6.0"
- ruby: "2.6"
rails_version: "~> 6.1"
- ruby: "3.3"
rails_version: "~> 7.0"
- ruby: "3.3"
rails_version: "~> 7.1"
- ruby: "3.3"
rails_version: "~> 7.2"
### STORAGE METHOD TESTING
- ruby: 3.3
db_gem: "sqlite3"
active_snapshot_storage_method: "serialized_json"
- ruby: 3.3
db_gem: "sqlite3"
active_snapshot_storage_method: "serialized_yaml"
- ruby: 3.3
db_gem: "sqlite3"
active_snapshot_storage_method: "native_json"
- ruby: 3.3
db_gem: "mysql2"
active_snapshot_storage_method: "serialized_json"
- ruby: 3.3
db_gem: "mysql2"
active_snapshot_storage_method: "serialized_yaml"
- ruby: 3.3
db_gem: "mysql2"
active_snapshot_storage_method: "native_json"
- ruby: 3.3
db_gem: "pg"
active_snapshot_storage_method: "serialized_json"
- ruby: 3.3
db_gem: "pg"
active_snapshot_storage_method: "serialized_yaml"
- ruby: 3.3
db_gem: "pg"
active_snapshot_storage_method: "native_json"
services:
mysql:
image: ${{ (matrix.db_gem == 'mysql2' && 'mysql') || '' }} # conditional service
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: test
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
ports: ['3306:3306']
postgres:
image: ${{ (matrix.db_gem == 'pg' && 'postgres') || '' }} # conditional service
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: test
ports: ['5432:5432']
steps:
- uses: actions/checkout@v3
- name: Set env DATABASE_URL
run: |
if [[ "${{ matrix.db_gem }}" == 'mysql2' ]]; then
echo "DATABASE_URL=mysql2://root:[email protected]:3306/test" >> "$GITHUB_ENV"
elif [[ "${{ matrix.db_gem }}" == 'pg' ]]; then
echo "DATABASE_URL=postgres://postgres:password@localhost:5432/test" >> "$GITHUB_ENV"
fi
- name: Set env variables
run: |
echo "RAILS_VERSION=${{ matrix.rails_version }}" >> "$GITHUB_ENV"
echo "DB_GEM=${{ matrix.db_gem }}" >> "$GITHUB_ENV"
echo "DB_GEM_VERSION=${{ matrix.db_gem_version }}" >> "$GITHUB_ENV"
echo "ACTIVE_SNAPSHOT_STORAGE_METHOD=${{ matrix.active_snapshot_storage_method }}" >> "$GITHUB_ENV"
- name: Install ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby }}"
bundler-cache: false ### not compatible with ENV-style Gemfile
- name: Run test
run: |
bundle install
bundle exec rake test