forked from yffaffy/rollbar
-
Notifications
You must be signed in to change notification settings - Fork 20
138 lines (115 loc) · 4 KB
/
php_unit.yml
File metadata and controls
138 lines (115 loc) · 4 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
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
name: Unit Tests
# Since Unit Tests are required to pass for each PR,
# we cannot disable them for documentation-only changes.
on:
pull_request:
push:
# Allow manually triggering the workflow.
workflow_dispatch:
# 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:
test-php:
name: PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
wordpress:
- '6.5'
- '6.7'
- '6.8'
- '6.9'
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}
steps:
- uses: actions/checkout@v5.0.0
- name: Install Dependencies
run: npm ci
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl
- name: Install PHP Dependencies
run: composer install --no-interaction --no-progress --no-suggest --optimize-autoloader
- name: Docker debug information
run: |
docker -v
- name: General debug information
run: |
npm --version
node --version
php --version
curl --version
git --version
locale -a
echo "PHP version: ${WP_ENV_PHP_VERSION}"
echo "WordPress version: ${WP_ENV_CORE}"
- name: Start Docker environment
run: npm run wp-env start
- name: Log running Docker containers
run: docker ps -a
- name: Running unit tests
run: |
set -o pipefail
npm run test
# ------------------------------------------------ #
# Build Plugin and Run Tests on Built Distribution #
# ------------------------------------------------ #
- name: Stop Docker environment
# Remove this check when https://github.com/humbug/php-scoper/issues/1139 is resolved.
if: matrix.php != '8.5'
run: npm run wp-env stop
- name: Build Plugin
if: matrix.php != '8.5'
run: bin/build.sh
- name: Copy Test Files
if: matrix.php != '8.5'
run: |
cp .wp-env.json dist/.wp-env.json
cp package.json dist/package.json
cp package-lock.json dist/package-lock.json
cp phpcs.xml dist/phpcs.xml
cp phpunit.xml dist/phpunit.xml
cp -r tests dist/tests
cp -r utils dist/utils
- name: Install Dist Composer Dependencies
if: matrix.php != '8.5'
working-directory: dist
run: composer install --no-interaction --no-progress --no-suggest --optimize-autoloader
- name: Build Conflict Plugin
if: matrix.php != '8.5'
working-directory: dist
run: npm run build-conflict
- name: Start Dist Docker environment
if: matrix.php != '8.5'
working-directory: dist
run: npm run wp-env start
- name: Install Conflict Plugin
if: matrix.php != '8.5'
working-directory: dist
run: npm run install-conflict
- name: Log running Dist Docker containers
if: matrix.php != '8.5'
working-directory: dist
run: docker ps -a
- name: Running Dist unit tests
if: matrix.php != '8.5'
working-directory: dist
# We don't run phpcs here because the dist files are modified by the build script.
run: |
set -o pipefail
npm run test:php