forked from ExpressionEngine/ExpressionEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (121 loc) · 5.2 KB
/
Copy pathunit-tests.yml
File metadata and controls
147 lines (121 loc) · 5.2 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
139
140
141
142
143
144
145
146
147
name: PHP Unit Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- '*.dev'
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
cancel-running-tests:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Cancel running tests
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: true
build-for-testing:
needs: cancel-running-tests
name: Build EE for testing
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache repository info
uses: actions/cache@v4
with:
path: .git
key: cache-ee-git-${{ github.sha }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: dom, curl, sqlite, libxml, mbstring, zip, pcntl, pdo, mysql, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none
ini-values: error_log=/home/runner/php_errors.log, memory_limit=128M
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '10'
- name: Install build tool dependencies
working-directory: build-tools
run: npm install
- name: Get version
id: build_json
working-directory: build-tools
run: |
content=`node -pe 'JSON.parse(process.argv[1]).tag' "$(cat build.json)"`
echo "BUILD_VERSION=$content" >> $GITHUB_OUTPUT
- name: Run build process
working-directory: build-tools
env:
RELEASE_PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
APP_REPO_PATH: ${{ github.workspace }}
run: gulp build-app --local --nogit --head --skip-lint --skip-pro --version=${{ steps.build_json.outputs.BUILD_VERSION }}
- name: Rename build directory
working-directory: build-tools/builds
run: |
mv ExpressionEngine${{ steps.build_json.outputs.BUILD_VERSION }} ExpressionEngine
- name: Cache built EE version
uses: actions/cache@v4
with:
path: build-tools/builds/ExpressionEngine
key: cache-ee-build-${{ github.sha }}
enableCrossOsArchive: true
- name: Directory Listing on Failure
if: failure()
run: |
ls -latr build-tools/builds
ls -latr build-tools/builds/ExpressionEngine
php-tests:
if: github.event.pull_request.draft == false
needs: [cancel-running-tests, build-for-testing]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: [7.3, 7.4, 8.0, 8.1, 8.2]
os: [ubuntu-latest]
include:
- php: 8.1
os: windows-latest
name: PHPUnit, php${{ matrix.php }} - ${{ matrix.os }}
steps:
- name: Install locales
if: runner.os != 'Windows'
run: |
sudo locale-gen en
sudo locale-gen de
sudo locale-gen de_DE
sudo locale-gen uk
sudo locale-gen ru
- name: Checkout code
uses: actions/checkout@v4
- name: Use cached EE build
uses: actions/cache@v4
with:
path: build-tools/builds/ExpressionEngine
key: cache-ee-build-${{ github.sha }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, sqlite, libxml, mbstring, zip, pcntl, pdo, mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none
- name: Copy config.php
run: php -r "file_exists('system/user/config/config.php') || copy('tests/cypress/support/config/config.php', 'system/user/config/config.php');"
- name: Install PHP Unit Test dependencies
working-directory: system/ee/ExpressionEngine/Tests/
run: |
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-interaction
composer require overtrue/phplint --dev --no-progress --no-suggest --prefer-dist
- name: Run PHPLint
run: ./system/ee/ExpressionEngine/Tests/vendor/bin/phplint --no-configuration ./ --exclude=system/ee/ExpressionEngine/Tests/vendor --exclude=system/ee/installer/config/config_tmpl.php --exclude=system/ee/ExpressionEngine/Service/Generator/stubs
- name: Configure matchers
uses: mheap/phpunit-matcher-action@v1
- name: Run PHPUnit Tests
working-directory: system/ee/ExpressionEngine/Tests/
run: vendor/bin/phpunit --testdox --configuration=phpunit.xml