-
Notifications
You must be signed in to change notification settings - Fork 37
83 lines (79 loc) · 2.68 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
name: test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version:
- 3.2
- 3.1
- "3.0"
- 2.7
- 2.6
- 2.5
rails-version:
# - "edge"
- 7
- 6.1
- "6.0"
exclude:
# Rails 7 requires Ruby 2.7+
- ruby-version: 2.5
rails-version: 7
- ruby-version: 2.6
rails-version: 7
# Rails 6 requires Ruby <= 3.0
- ruby-version: 3.1
rails-version: "6.0"
- ruby-version: 3.2
rails-version: "6.0"
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
rubygems: latest
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Run gem tests
run: |
bundle config set --local path ".$(mktemp -u -d)"
bundle
bundle exec rake
- name: Set up new Rails dummy app
working-directory: ./spec
env:
RAILS_NEW_GEMFILE: dummy_app_config/gemfiles/Gemfile-rails-${{ matrix.rails-version }}
run: |
bundle config set --local path ".$(mktemp -u -d)"
BUNDLE_GEMFILE=$RAILS_NEW_GEMFILE bundle
rails new dummy_app --database=sqlite3 --skip-active-storage --skip-action-cable --skip-spring --skip-listen --skip-test
# XXX VERY DUMB workaround for Rails 7's "rails new" default Gemfile not working with Ruby 2.7
# e.g. https://github.com/abevoelker/devise-passwordless/actions/runs/8132843679/job/22223730812#step:7:292
# SUPPOSEDLY Rails 7 supports Ruby 2.7 but the "debug" gem dependency pulls in a "sqlite3" version which is
# incompatible with Ruby 2.7
if [[ "${{ matrix.ruby-version }}" == "2.7" && "${{ matrix.rails-version }}" == "7" ]]; then
sed -i '/^gem.*sqlite3/d' dummy_app/Gemfile
echo -e "\ngem 'sqlite3', '~> 1.6.0', '>= 1.6.9'\n" >> dummy_app/Gemfile
fi
cat dummy_app_config/Gemfile.append >> dummy_app/Gemfile
cd dummy_app
bundle
rails g rspec:install
cp -rf ../dummy_app_config/shared_source/all/* ./
cp -rf ../dummy_app_config/shared_source/${{ matrix.rails-version }}/* ./
yarn install
- name: Run Rails dummy app tests
working-directory: ./spec/dummy_app
run: |
rake db:drop db:create db:migrate
rake