forked from binarylogic/authlogic
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (131 loc) · 4.34 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: gha-workflow-authlogic-test
on: [push, pull_request]
jobs:
# Linting is a separate job, primary because it only needs to be done once,
# and secondarily because jobs are performed concurrently.
gha-job-authlogic-lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
# Set to `TargetRubyVersion` in `.rubocop.yml`
ruby-version: 2.6
- name: Bundle
run: |
gem install bundler -v 2.4.22
bundle install --jobs 4 --retry 3
- name: Lint
run: bundle exec rubocop
# The test job is a matrix of ruby/rails versions.
gha-job-authlogic-test:
name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}
runs-on: ubuntu-latest
services:
gha-service-authlogic-mysql:
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: authlogic
image: mysql:8.0
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
ports:
- 3306:3306
gha-service-authlogic-postgres:
env:
POSTGRES_PASSWORD: asdfasdf
image: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
fail-fast: false
# Unlike TravisCI, the database will not be part of the matrix. Each
# sub-job in the matrix tests all three databases. Alternatively, we could
# have set this up with each database as a separate job, but then we'd be
# duplicating the matrix configuration three times.
matrix:
# To keep matrix size down, only test highest and lowest rubies. In
# `.rubocop.yml`, set `TargetRubyVersion`, to the lowest ruby version
# tested here.
ruby: ["2.6", "3.3"]
rails: ["5.2", "6.0", "6.1", "7.0", "7.1", "7.2", "8.0"]
exclude:
# rails 7 requires ruby >= 2.7.0
- ruby: "2.6"
rails: "7.0"
- ruby: "2.6"
rails: "7.1"
- ruby: "2.6"
rails: "7.2"
- ruby: "2.6"
rails: "8.0"
- ruby: "3.3"
rails: "5.2"
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Bundle
run: |
gem install bundler -v 2.4.22
bundle install --jobs 4 --retry 3
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
# MySQL db was created above, sqlite will be created during test suite,
# when migrations occur, so we only need to create the postgres db. I
# tried something like `cd .....dummy_app && ....db:create`, but couldn't
# get that to work.
- name: Create postgres database
run: |
createdb \
--host=$POSTGRES_HOST \
--port=$POSTGRES_PORT \
--username=postgres \
authlogic
env:
PGPASSWORD: asdfasdf
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
# The following three steps finally run the tests.
# We run `rake test` instead of the default task, which includes rubocop,
# because rubocop is done (once!) in a separate job above.
- name: Test, sqlite
run: bundle exec rake test
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
DB: sqlite
- name: Test, mysql
run: bundle exec rake test
env:
BACKTRACE: 1
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
DB: mysql
AUTHLOGIC_DB_NAME: authlogic
AUTHLOGIC_DB_USER: root
AUTHLOGIC_DB_HOST: 127.0.0.1
AUTHLOGIC_DB_PORT: 3306
- name: Test, postgres
run: bundle exec rake test
env:
BACKTRACE: 1
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
DB: postgres
AUTHLOGIC_DB_NAME: authlogic
AUTHLOGIC_DB_USER: postgres
AUTHLOGIC_DB_HOST: 127.0.0.1
AUTHLOGIC_DB_PORT: 5432
AUTHLOGIC_DB_PASSWORD: asdfasdf