-
Notifications
You must be signed in to change notification settings - Fork 126
222 lines (182 loc) · 5.93 KB
/
tests.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: tests
on: [push, pull_request]
env:
RAILS_ENV: test
PAGEFLOW_DB_HOST: 127.0.0.1
jobs:
rspec:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- engine-name: pageflow
ruby-version: 2.6
engine-directory: .
rspec-command: bin/rspec --tag ~js
install-audiowaveform: true
- engine-name: pageflow
ruby-version: 3.2
rails-version: "~> 6.1"
engine-directory: .
rspec-command: bin/rspec --tag ~js
install-audiowaveform: true
- engine-name: pageflow
ruby-version: 2.6
engine-directory: .
rspec-command: bin/rspec-with-retry --tag js
- engine-name: pageflow
ruby-version: 3.2
rails-version: "~> 6.1"
engine-directory: .
rspec-command: bin/rspec-with-retry --tag js
- engine-name: pageflow_paged
ruby-version: 2.6
engine-directory: entry_types/paged
plugin-name: pageflow_paged
rspec-command: bin/rspec
- engine-name: pageflow_scrolled
ruby-version: 2.6
engine-directory: entry_types/scrolled
plugin-name: pageflow_scrolled
rspec-command: bin/rspec --tag ~js
- engine-name: pageflow_scrolled
ruby-version: 2.6
engine-directory: entry_types/scrolled
plugin-name: pageflow_scrolled
rspec-command: bin/rspec-with-retry-on-timeout --tag js
env:
PAGEFLOW_RAILS_VERSION: ${{ matrix.rails-version }}
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
# Set health checks to wait until mysql has started
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries 5
redis:
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
# Caching
- name: Set up cache for Bundler
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-ruby-${{ matrix.ruby-version }}-gems-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Set up cache for Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Ruby/Node
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
# Dependencies
- name: Install audiowaveform package
if: ${{ matrix.install-audiowaveform == true}}
run: |
sudo add-apt-repository ppa:chris-needham/ppa
sudo apt-get update
sudo apt-get install audiowaveform
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Yarn install
run: |
yarn install
# Build
- name: Build packages
run: |
bin/build-packages
- name: Generate dummy app
working-directory: ${{ matrix.engine-directory }}
env:
PAGEFLOW_PLUGIN_ENGINE: ${{ matrix.plugin-name }}
run: |
bin/rake ${{ matrix.engine-name }}:dummy
- name: Precompile
working-directory: ${{ matrix.engine-directory }}
run: |
WEBPACKER_PRECOMPILE=false bin/rake app:assets:precompile
# Test
- name: Run tests
working-directory: ${{ matrix.engine-directory }}
run: ${{ matrix.rspec-command }}
jest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: pageflow
package-directory: package
- name: pageflow-paged
package-directory: entry_types/paged/packages/pageflow-paged
- name: pageflow-paged-react
package-directory: entry_types/paged/packages/pageflow-paged-react
- name: pageflow-scrolled
package-directory: entry_types/scrolled/package
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Set up cache for Yarn
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
- name: Yarn install
run: |
yarn install
(cd entry_types/paged/packages/pageflow-paged-react; yarn install)
- name: Build packages
run: |
yarn run build
- name: Run ${{ matrix.name }} tests
working-directory: ${{ matrix.package-directory }}
run: |
yarn test
trigger-edge-build:
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'codevise/pageflow' }}
runs-on: ubuntu-latest
steps:
- name: Trigger GitLab workflow
run: |
curl -X POST \
-F token=${{ secrets.GITLAB_WORKFLOW_TRIGGER_TOKEN }} \
-F ref=master \
https://gitlab.codevise.de/api/v4/projects/180/trigger/pipeline