-
Notifications
You must be signed in to change notification settings - Fork 16
52 lines (52 loc) · 1.79 KB
/
branch-tests-ci.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
name: Tests
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: portal_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: "2.7.1"
- name: Verify MySQL connection from host
run: |
sudo apt-get install -y mysql-client libmysqlclient-dev
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} --user=root -e "SHOW GRANTS FOR 'root'@'localhost'"
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} --user=root mysql
- name: Install dependencies
run: |
bundle install --jobs 4 --retry 3
yarn install
- name: Setup database
env:
RAILS_ENV: test
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: ${{ job.services.mysql.ports[3306] }}
run: |
bundle exec rails db:create
bundle exec rails db:migrate
- name: Run unit tests
env:
RAILS_ENV: test
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: ${{ job.services.mysql.ports[3306] }}
KEY_CLAIM_TOKEN: test
KEY_CLAIM_HOST: test.serverexample.com
run: bundle exec rails test
- name: Run system tests
env:
RAILS_ENV: test
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: ${{ job.services.mysql.ports[3306] }}
KEY_CLAIM_TOKEN: test
KEY_CLAIM_HOST: test.serverexample.com
run: bundle exec rails test:system