-
Notifications
You must be signed in to change notification settings - Fork 125
121 lines (106 loc) · 3.75 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
name: Cypress tests
on:
pull_request:
types: [labeled, opened, synchronize, reopened]
workflow_run:
workflows: [Compress images]
types: [completed]
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.0']
browser: [chrome]
containers: [1, 2, 3, 4, 5, 6, 7, 8]
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: mbstring, dom, fileinfo
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: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer files
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ 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: Get yarn cache directory path
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache yarn files
uses: actions/[email protected]
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 run inst
- name: Build assets
run: yarn run production
# Prepare
- name: Prepare environment
run: |
cp tests/.env.ci-cypress .env
touch config/.version config/.release
- name: Create SQLite database
run: |
mkdir -p database
touch database/database.sqlite
- name: Generate key
run: php artisan key:generate
- name: Run migrations
run: php artisan migrate --no-interaction -vvv
- name: Run seeds
run: php artisan db:seed --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@v2
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 }}