-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (84 loc) · 2.99 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
name: Cypress Tests
on:
pull_request:
branches:
- main
paths:
- "**"
- "!.devcontainer/**"
- "!.github/**"
- "!infrastructure/.devcontainer/**"
- "!infrastructure/terragrunt/**"
env:
WPML_USER_ID: ${{ secrets.WPML_USER_ID }}
WPML_KEY: ${{ secrets.WPML_KEY }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 16
- name: PHP Setup
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- name: Add Composer auth credentials
run: |
cd wordpress
composer config github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }}
composer config http-basic.my.yoast.com token ${{ secrets.COMPOSER_YOAST_TOKEN }}
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache Composer
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Composer install
working-directory: wordpress
run: |
composer install --prefer-dist --no-progress
composer check-platform-reqs
- name: Cache NPM
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: |
~/.npm
~/.cache/Cypress
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cypress and NPM install and build
uses: cypress-io/github-action@f1f0912d392f0d06bdd01fb9ebe3b3299e5806fb # v6.7.7
with:
runTests: false
- name: Start test environment
run: |
npm run wp-env:init
npm run wp-env:test:setup
- name: Cypress run
uses: cypress-io/github-action@f1f0912d392f0d06bdd01fb9ebe3b3299e5806fb # v6.7.7
with:
install: false
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
if: always()
with:
name: cypress-videos
path: cypress/videos