forked from Shopify/shipit-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (139 loc) · 3.73 KB
/
main.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CI
on: [push, pull_request]
jobs:
lint:
name: Lint Ruby
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: rubocop
run: |
bundle exec rubocop
postgres:
name: Tests with Postgres
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby_version:
- '3.0'
services:
db:
image: postgres:11
ports: ['5432:5432']
env:
POSTGRES_HOST_AUTH_METHOD: 'trust'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- uses: actions/checkout@v1
- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Run tests
env:
PGHOST: 127.0.0.1
PGUSER: postgres
RAILS_ENV: test
run: |
cp test/dummy/config/database.postgresql.yml test/dummy/config/database.yml
bundle exec rake db:create db:schema:load test
bundle exec rake db:seed
mysql:
name: Tests with MySQL
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby_version:
- '3.0'
services:
db:
image: mysql:8.0
ports:
- 3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- uses: actions/checkout@v1
- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Run tests
env:
RAILS_ENV: test
DATABASE_URL: 'mysql2://[email protected]:${{ job.services.db.ports[3306] }}'
run: |
cp test/dummy/config/database.mysql.yml test/dummy/config/database.yml
bundle exec rake db:create db:schema:load test
bundle exec rake db:seed
sqlite:
name: Tests with SQLite3
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby_version:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
services:
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- uses: actions/checkout@v1
- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true
- name: Run tests
env:
RAILS_ENV: test
run: |
bundle exec rake db:create db:schema:load test
bundle exec rake db:seed
setup:
name: Test setup script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Run setup script
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
export SHIPIT_GEM_PATH="${PWD}"
mkdir /tmp/new-app
cd /tmp/new-app
gem install rails -v '~> 7.1.1' --no-document
rails new shipit --skip-action-cable --skip-turbolinks --skip-action-mailer --skip-active-storage --skip-webpack-install --skip-action-mailbox --skip-action-text -m "${SHIPIT_GEM_PATH}/template.rb"
env:
SHIPIT_EDGE: "1"