2020-12-06 17:33:43 +01:00
|
|
|
name: Run unit tests
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
2022-06-28 02:29:16 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-12-06 17:33:43 +01:00
|
|
|
jobs:
|
2021-02-12 23:03:03 +01:00
|
|
|
lint:
|
|
|
|
name: Check PHP syntax
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
2023-07-21 22:46:46 +02:00
|
|
|
php-version: '7.4'
|
2021-02-12 23:03:03 +01:00
|
|
|
tools: composer:v2
|
2021-11-29 07:07:14 +01:00
|
|
|
coverage: none
|
2023-03-12 06:45:23 +01:00
|
|
|
env:
|
|
|
|
fail-fast: true
|
2021-02-12 23:03:03 +01:00
|
|
|
|
2023-09-11 09:29:32 +02:00
|
|
|
- uses: actions/checkout@v4
|
2021-02-12 23:03:03 +01:00
|
|
|
|
|
|
|
- name: Get Composer Cache Directories
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
2023-02-09 08:35:58 +01:00
|
|
|
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
|
2021-02-12 23:03:03 +01:00
|
|
|
|
2023-03-12 07:01:01 +01:00
|
|
|
- name: Generate composer.lock
|
|
|
|
run: |
|
|
|
|
composer update --no-install
|
2023-03-12 07:15:47 +01:00
|
|
|
env:
|
|
|
|
COMPOSER_ROOT_VERSION: dev-master
|
2023-03-12 07:01:01 +01:00
|
|
|
|
2021-02-12 23:03:03 +01:00
|
|
|
- name: Cache composer cache
|
2022-06-30 19:05:06 +02:00
|
|
|
uses: actions/cache@v3
|
2021-02-12 23:03:03 +01:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
${{ steps.composer-cache.outputs.files_cache }}
|
|
|
|
${{ steps.composer-cache.outputs.vcs_cache }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Run composer install
|
2022-05-29 06:24:11 +02:00
|
|
|
run: composer install -o
|
2021-02-12 23:03:03 +01:00
|
|
|
env:
|
|
|
|
COMPOSER_ROOT_VERSION: dev-master
|
|
|
|
|
|
|
|
- run: |
|
2021-10-05 02:57:06 +02:00
|
|
|
git ls-files | grep \\\.php$ | grep -v ^dictionaries/scripts/* | ./vendor/bin/parallel-lint --stdin
|
2023-07-21 21:49:36 +02:00
|
|
|
|
|
|
|
code-style:
|
|
|
|
name: Code Style Analysis
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
2023-07-21 22:46:46 +02:00
|
|
|
php-version: '7.4'
|
2023-07-21 21:49:36 +02:00
|
|
|
tools: composer:v2
|
|
|
|
coverage: none
|
|
|
|
env:
|
|
|
|
fail-fast: true
|
|
|
|
|
2023-09-11 09:29:32 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-21 21:49:36 +02:00
|
|
|
|
|
|
|
- name: Get Composer Cache Directories
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Generate composer.lock
|
|
|
|
run: composer update --no-install
|
|
|
|
env:
|
|
|
|
COMPOSER_ROOT_VERSION: dev-master
|
|
|
|
|
|
|
|
- name: Cache composer cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
${{ steps.composer-cache.outputs.files_cache }}
|
|
|
|
${{ steps.composer-cache.outputs.vcs_cache }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Run composer install
|
|
|
|
run: composer install -o
|
|
|
|
env:
|
|
|
|
COMPOSER_ROOT_VERSION: dev-master
|
|
|
|
|
|
|
|
- name: Code Style Analysis with PHPCS
|
|
|
|
run: vendor/bin/phpcs -d memory_limit=512M
|
|
|
|
|
2021-01-11 23:30:33 +01:00
|
|
|
chunk-matrix:
|
2022-06-28 02:29:16 +02:00
|
|
|
permissions:
|
|
|
|
contents: none
|
2021-01-11 23:30:33 +01:00
|
|
|
name: Generate Chunk Matrix
|
|
|
|
|
2020-12-06 17:33:43 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-01-11 23:30:33 +01:00
|
|
|
env:
|
2023-07-19 21:06:35 +02:00
|
|
|
CHUNK_COUNT: 8
|
2021-01-11 23:30:33 +01:00
|
|
|
|
|
|
|
outputs:
|
|
|
|
count: ${{ steps.chunk-matrix.outputs.count }}
|
|
|
|
chunks: ${{ steps.chunk-matrix.outputs.chunks }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- id: chunk-matrix
|
|
|
|
name: Generates the Chunk Matrix
|
|
|
|
run: |
|
2023-02-09 08:35:58 +01:00
|
|
|
echo "count=$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')" >> $GITHUB_OUTPUT
|
|
|
|
echo "chunks=$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" >> $GITHUB_OUTPUT
|
2021-01-11 23:30:33 +01:00
|
|
|
|
2023-07-19 20:41:59 +02:00
|
|
|
tests:
|
2023-07-20 01:43:31 +02:00
|
|
|
name: "Unit Tests - PHP ${{ matrix.php-version }} ${{ matrix.chunk }}/${{ matrix.count }}"
|
2021-01-11 23:30:33 +01:00
|
|
|
|
2023-07-19 23:52:25 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-01-11 23:30:33 +01:00
|
|
|
needs:
|
|
|
|
- chunk-matrix
|
|
|
|
|
2023-07-19 20:30:57 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-07-19 20:41:59 +02:00
|
|
|
php-version:
|
|
|
|
- "8.0"
|
|
|
|
- "8.1"
|
|
|
|
- "8.2"
|
|
|
|
- "8.3"
|
2023-07-19 20:30:57 +02:00
|
|
|
count: ${{ fromJson(needs.chunk-matrix.outputs.count) }}
|
|
|
|
chunk: ${{ fromJson(needs.chunk-matrix.outputs.chunks) }}
|
|
|
|
|
|
|
|
env:
|
|
|
|
CHUNK_COUNT: "${{ matrix.count }}"
|
|
|
|
CHUNK_NUMBER: "${{ matrix.chunk }}"
|
|
|
|
PARALLEL_PROCESSES: 5
|
2023-11-29 08:56:31 +01:00
|
|
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
2023-07-19 20:30:57 +02:00
|
|
|
|
|
|
|
steps:
|
2023-07-19 20:41:59 +02:00
|
|
|
- name: Set up PHP
|
2023-07-19 20:30:57 +02:00
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
2023-07-19 20:41:59 +02:00
|
|
|
php-version: "${{ matrix.php-version }}"
|
2023-07-19 20:30:57 +02:00
|
|
|
ini-values: zend.assertions=1, assert.exception=1, opcache.enable_cli=1, opcache.jit=function, opcache.jit_buffer_size=512M
|
|
|
|
tools: composer:v2
|
|
|
|
coverage: none
|
|
|
|
extensions: none, curl, dom, filter, intl, json, libxml, mbstring, opcache, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter
|
|
|
|
env:
|
|
|
|
fail-fast: true
|
|
|
|
|
2023-09-11 09:29:32 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-19 20:30:57 +02:00
|
|
|
|
|
|
|
- name: Get Composer Cache Directories
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Generate composer.lock
|
|
|
|
run: |
|
|
|
|
composer update --no-install
|
|
|
|
env:
|
|
|
|
COMPOSER_ROOT_VERSION: dev-master
|
|
|
|
|
|
|
|
- name: Cache composer cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
${{ steps.composer-cache.outputs.files_cache }}
|
|
|
|
${{ steps.composer-cache.outputs.vcs_cache }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: Run composer install
|
|
|
|
run: composer install -o
|
|
|
|
env:
|
|
|
|
COMPOSER_ROOT_VERSION: dev-master
|
|
|
|
|
2023-07-19 20:41:59 +02:00
|
|
|
- name: Run unit tests
|
2021-01-11 23:30:33 +01:00
|
|
|
run: bin/tests-github-actions.sh
|