-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (53 loc) · 1.67 KB
/
Copy pathunit-tests.yml
File metadata and controls
65 lines (53 loc) · 1.67 KB
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
name: Unit Tests
on:
pull_request:
push:
branches:
- main
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
unit-php:
name: Unit tests on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: npm
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php }}'
extensions: mbstring, intl
# Ensure that Composer installs the correct versions of packages.
- name: Override PHP version in composer.json
run: |
composer config platform.php '${{ matrix.php }}.99'
composer require "composer/installers:^2.0" --no-update
- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: 'highest'
- name: Npm install and build
run: |
npm ci
npm run build
- name: Install WordPress
run: npm run env:start
- name: Run unit tests
run: npm run test:php