-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (67 loc) · 2.01 KB
/
test.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
name: test
on:
push:
branches: [develop, main, master, "feature/**"]
pull_request:
branches: [develop, main, master, "feature/**"]
# Allows workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_USERNAME: root
DB_PASSWORD: root
RAILS_ENV: test
steps:
- name: Verify mysql connection
run: |
mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USERNAME}} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES"
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install dependencies
run: |
gem install bundler
bundle install
yarn install --frozen-lockfile
- name: Setup config files for CI
run: |
cp config/ldap_ci.yml config/ldap.yml
- name: Setup Database
run: |
cp config/database_ci.yml config/database.yml
./bin/rails db:create
./bin/rails db:migrate
- name: Run E2E tests with Cypress
uses: cypress-io/github-action@v5
with:
start: bundle exec rails server -e test -p 5017
wait-on: "http://localhost:5017"
browser: chrome
config: baseUrl=http://localhost:5017
- name: Upload test screenshots if any
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- name: Upload snapshots
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-snapshots
path: cypress/snapshots
- name: Run RSpec
run: bundle exec rspec