-
-
Notifications
You must be signed in to change notification settings - Fork 26
164 lines (155 loc) · 4.28 KB
/
test_and_deploy.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
name: Test and deploy
on:
- push
- workflow_dispatch
jobs:
test:
env:
RACK_ENV: test
RAILS_ENV: test
runs-on: ubuntu-latest
services:
postgres:
ports:
- 5432:5432
image: postgres:10.15
env:
POSTGRES_DB: mumuki_test
POSTGRES_USER: mumuki
POSTGRES_PASSWORD: mumuki
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
with:
ruby-version: 2.6.3
bundler: 2.1.4
bundler-cache: true
- name: Load schema
run: bundle exec rake db:schema:load
- name: Setup hosts
run: |
echo '
127.0.0.1 test.localmumuki.io
' | sudo tee -a /etc/hosts
- name: Setup Xvfb
run: Xvfb :99 &
- name: Run tests
run: bundle exec rake
env:
DISPLAY: :99
test-firefox:
env:
MUMUKI_SELENIUM_DRIVER: firefox
RACK_ENV: test
RAILS_ENV: test
runs-on: ubuntu-latest
services:
postgres:
ports:
- 5432:5432
image: postgres:10.15
env:
POSTGRES_DB: mumuki_test
POSTGRES_USER: mumuki
POSTGRES_PASSWORD: mumuki
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
with:
ruby-version: 2.6.3
bundler: 2.1.4
bundler-cache: true
- name: Setup Firefox
run: |
wget --no-verbose -O /tmp/firefox-79.0.tar.bz2 'https://download.mozilla.org/?product=firefox-79.0&lang=en-US&os=linux64'
tar xjf /tmp/firefox-79.0.tar.bz2 -C /opt/
sudo ln -sf /opt/firefox/firefox /usr/lib/firefox/firefox
- name: Load schema
run: bundle exec rake db:schema:load
- name: Setup hosts
run: |
echo '
127.0.0.1 localmumuki.io
127.0.0.1 base.localmumuki.io
127.0.0.1 central.localmumuki.io
127.0.0.1 empty.localmumuki.io
127.0.0.1 foo.localmumuki.io
127.0.0.1 immersive-orga.localmumuki.io
127.0.0.1 private.localmumuki.io
127.0.0.1 someorga.localmumuki.io
127.0.0.1 test.localmumuki.io
127.0.0.1 the-public-org.localmumuki.io
' | sudo tee -a /etc/hosts
- name: Setup Xvfb
run: Xvfb :99 &
- name: Run web tests
run: bundle exec rake spec:web
env:
DISPLAY: :99
test-chrome:
env:
MUMUKI_SELENIUM_DRIVER: chrome
RACK_ENV: test
RAILS_ENV: test
runs-on: ubuntu-latest
services:
postgres:
ports:
- 5432:5432
image: postgres:10.15
env:
POSTGRES_DB: mumuki_test
POSTGRES_USER: mumuki
POSTGRES_PASSWORD: mumuki
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
with:
ruby-version: 2.6.3
bundler: 2.1.4
bundler-cache: true
- name: Load schema
run: bundle exec rake db:schema:load
- name: Setup hosts
run: |
echo '
127.0.0.1 localmumuki.io
127.0.0.1 base.localmumuki.io
127.0.0.1 central.localmumuki.io
127.0.0.1 empty.localmumuki.io
127.0.0.1 foo.localmumuki.io
127.0.0.1 immersive-orga.localmumuki.io
127.0.0.1 private.localmumuki.io
127.0.0.1 someorga.localmumuki.io
127.0.0.1 test.localmumuki.io
127.0.0.1 the-public-org.localmumuki.io
' | sudo tee -a /etc/hosts
- name: Setup Xvfb
run: Xvfb :99 &
- name: Run web tests
run: bundle exec rake spec:web
env:
DISPLAY: :99
deploy:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs:
- test
- test-firefox
- test-chrome
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"