forked from monicahq/monica
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (110 loc) · 3.91 KB
/
cypress.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
name: Cypress tests
on:
pull_request:
types: [labeled, opened, synchronize, reopened]
jobs:
cypress:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'cypress')
name: Cypress tests with ${{ matrix.browser }} (PHP ${{ matrix.php-version }})
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: monica
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: false
matrix:
php-version: [7.4]
browser: [chrome]
containers: [1, 2, 3, 4, 5, 6, 7, 8]
max-parallel: 10
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: imagick
coverage: none
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
# step-prepare-environment
- name: Prepare environment
run: |
mkdir -p results/coverage
cp scripts/ci/.env.mysql .env
touch .sentry-release
echo "REQUIRES_SUBSCRIPTION=true" >> .env
- name: Validate composer.json and composer.lock
run: composer validate
- name: Get Composer Cache Directory
id: composer-cache-dir-path
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer files
uses: actions/cache@v2.1.3
with:
path: ${{ steps.composer-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-interaction --ignore-platform-reqs
# step-prepare-db
- name: Prepare db
run: mysql -h 127.0.0.1 -u root -P 3306 monica < scripts/database.test.sql
- name: Run migration scripts
run: php artisan migrate --no-interaction -vvv
# step-seed-test-db
- name: Seed database
run: |
php artisan db:seed --no-interaction -vvv
php artisan passport:keys --no-interaction -vvv
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2.1.3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install
run: yarn inst
- name: yarn build
run: yarn run production
- name: Cypress verify
run: npm run cy:verify
- name: which google-chrome
run: |
which google-chrome || true
- uses: cypress-io/github-action@v1
with:
start: php artisan serve
browser: ${{ matrix.browser }}
headless: true
record: true
parallel: true
install: false
group: Azure DevOps CI ${{ matrix.browser }}
tag: ${{ github.event_name }}
config: baseUrl=http://localhost:8000
wait-on: http://localhost:8000
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
- name: Cypress infos
run: |
echo Cypress finished with: ${{ steps.cypress.outcome }}
echo See results at ${{ steps.cypress.outputs.dashboardUrl }}