-
Notifications
You must be signed in to change notification settings - Fork 130
184 lines (154 loc) · 5.01 KB
/
tests.yml
File metadata and controls
184 lines (154 loc) · 5.01 KB
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
name: tests
on: [push, pull_request]
env:
RAILS_ENV: test
PAGEFLOW_DB_HOST: mysql
jobs:
rspec:
name: ${{ matrix.job }} (Rails ${{ matrix.rails-version }})
runs-on: ubuntu-latest
container: ghcr.io/${{ github.repository }}/test:latest
env:
PAGEFLOW_RAILS_VERSION: ${{ matrix.rails-version }}
strategy:
fail-fast: false
matrix:
rails-version: ['~> 7.1.0', '~> 7.2.0']
job:
- pageflow
- pageflow_js
- pageflow_paged
- pageflow_scrolled
- pageflow_scrolled_js
include:
- job: pageflow
engine-name: pageflow
engine-directory: .
rspec-command: bin/rspec --tag ~js
install-audiowaveform: true
- job: pageflow_js
engine-name: pageflow
engine-directory: .
rspec-command: bin/rspec-with-retry --tag js
- job: pageflow_paged
engine-name: pageflow_paged
engine-directory: entry_types/paged
plugin-name: pageflow_paged
rspec-command: bin/rspec
- job: pageflow_scrolled
engine-name: pageflow_scrolled
engine-directory: entry_types/scrolled
plugin-name: pageflow_scrolled
rspec-command: bin/rspec --tag ~js
- job: pageflow_scrolled_js
engine-name: pageflow_scrolled
engine-directory: entry_types/scrolled
plugin-name: pageflow_scrolled
rspec-command: bin/rspec-with-retry-on-timeout --tag js
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
# Caching
- name: Set up cache for Bundler
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-rails-${{ matrix.rails-version }}-${{ hashFiles('**/*.gemspec') }}-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-gems-rails-${{ matrix.rails-version }}-
- name: Set up cache for Yarn
uses: actions/cache@v4
with:
path: .yarn-cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Dependencies
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Yarn install
run: |
yarn install --cache-folder .yarn-cache
# 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 SHAKAPACKER_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
container: ghcr.io/${{ github.repository }}/test: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@v4
- name: Set up cache for Yarn
uses: actions/cache@v4
with:
path: .yarn-cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Yarn install
run: |
yarn install --cache-folder .yarn-cache
(cd entry_types/paged/packages/pageflow-paged-react; yarn install --cache-folder ../../../../.yarn-cache)
- 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