-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
140 lines (120 loc) · 4.41 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Cypress tests
on:
pull_request:
types: [labeled, opened, synchronize, reopened]
env:
node-version: 20
concurrency:
group: Cypress tests ${{ github.ref }}
cancel-in-progress: true
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 }})
strategy:
fail-fast: false
matrix:
php-version: ['8.2']
browser: [chrome]
containers: [1, 2, 3, 4, 5, 6, 7, 8]
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: redis
coverage: none
- name: Check PHP Version
run: php -v
- name: Check Composer Version
run: composer -V
- name: Check PHP Extensions
run: php -m
# Composer
- name: Validate composer.json and composer.lock
run: composer validate
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer files
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
${{ runner.os }}-composer-${{ matrix.php-version }}
${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
# Yarn
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Get yarn cache directory path
id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache yarn files
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-yarn-
- name: Install yarn dependencies
run: yarn inst
- name: Build assets
run: yarn run production
# Prepare
- name: Prepare environment
run: |
cp scripts/ci/.env.mysql .env
touch config/.version config/.release config/.commit
mkdir -p results/coverage
echo "REQUIRES_SUBSCRIPTION=true" >> .env
- name: Generate key
run: php artisan key:generate
- name: Start mysql
run: sudo systemctl start mysql.service
- name: Create database
run: mysql --protocol=tcp -u root -proot -e "CREATE DATABASE IF NOT EXISTS monica CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
- name: Prepare database
run: mysql --protocol=tcp -u root -proot monica < scripts/database.test.sql
- name: Run migrations
run: php artisan migrate --no-interaction -vvv
- name: Run seeds
run: php artisan db:seed --no-interaction -vvv
- name: Create passport keys
run: php artisan passport:keys --no-interaction -vvv
# Cypress
- name: Cypress verify
run: npx cypress verify
- name: Find google-chrome
run: which google-chrome || true
- uses: cypress-io/github-action@v5
id: cypress
continue-on-error: true
with:
start: php artisan serve
browser: ${{ matrix.browser }}
headless: true
record: true
parallel: true
install: false
group: github action ${{ 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 }}