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:
|
|
|
|
php-version: '7.1'
|
|
|
|
tools: composer:v2
|
2021-11-29 07:07:14 +01:00
|
|
|
coverage: none
|
2021-02-12 23:03:03 +01:00
|
|
|
|
2022-06-30 19:05:08 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-12 23:03:03 +01:00
|
|
|
|
|
|
|
- name: Get Composer Cache Directories
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=files_cache::$(composer config cache-files-dir)"
|
|
|
|
echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)"
|
|
|
|
|
|
|
|
- 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-
|
|
|
|
|
2022-05-29 06:24:11 +02:00
|
|
|
- name: Drop incompatible packages
|
|
|
|
run: composer remove --no-interaction --dev phpunit/phpunit brianium/paratest psalm/plugin-phpunit weirdan/prophecy-shim
|
|
|
|
|
2021-02-12 23:03:03 +01:00
|
|
|
- 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
|
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:
|
2021-01-12 00:19:11 +01: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: |
|
|
|
|
echo "::set-output name=count::$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')"
|
|
|
|
echo "::set-output name=chunks::$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')"
|
|
|
|
|
|
|
|
tests:
|
|
|
|
name: "Unit Tests - ${{ matrix.chunk }}"
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- chunk-matrix
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
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
|
|
|
|
|
2020-12-06 17:33:43 +01:00
|
|
|
steps:
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
2022-06-14 15:29:46 +02:00
|
|
|
php-version: '8.1'
|
2020-12-06 17:33:43 +01:00
|
|
|
tools: composer:v2
|
2021-11-29 07:07:14 +01:00
|
|
|
coverage: none
|
2021-12-08 19:10:31 +01:00
|
|
|
extensions: decimal
|
2020-12-06 17:33:43 +01:00
|
|
|
|
2022-06-30 19:05:08 +02:00
|
|
|
- uses: actions/checkout@v3
|
2020-12-06 17:33:43 +01:00
|
|
|
|
|
|
|
- name: Get Composer Cache Directories
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=files_cache::$(composer config cache-files-dir)"
|
|
|
|
echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)"
|
|
|
|
|
|
|
|
- name: Cache composer cache
|
2022-06-30 19:05:06 +02:00
|
|
|
uses: actions/cache@v3
|
2020-12-06 17:33:43 +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
|
|
|
|
run: composer install -o
|
|
|
|
env:
|
|
|
|
COMPOSER_ROOT_VERSION: dev-master
|
|
|
|
|
|
|
|
- name: Run unit tests
|
2021-01-11 23:30:33 +01:00
|
|
|
run: bin/tests-github-actions.sh
|