mirror of
https://github.com/flarum/core.git
synced 2025-09-03 05:02:45 +02:00
chore: improve test suite (#3814)
Allows running tests without constantly running `composer install` on each extension.
This commit is contained in:
30
.github/workflows/REUSABLE_backend.yml
vendored
30
.github/workflows/REUSABLE_backend.yml
vendored
@@ -21,6 +21,12 @@ on:
|
||||
required: false
|
||||
default: '.'
|
||||
|
||||
# Only relevant in mono-repos.
|
||||
monorepo_tests:
|
||||
description: "The list of directories to test in a monorepo. This should be a space-separated list of directories relative to the backend directory."
|
||||
type: string
|
||||
required: false
|
||||
|
||||
php_versions:
|
||||
description: Versions of PHP to test with. Should be array of strings encoded as JSON array
|
||||
type: string
|
||||
@@ -47,6 +53,7 @@ on:
|
||||
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: dev-main
|
||||
# `inputs.composer_directory` defaults to `inputs.backend_directory`
|
||||
FLARUM_TEST_TMP_DIR_LOCAL: tests/integration/tmp
|
||||
|
||||
jobs:
|
||||
@@ -143,18 +150,27 @@ jobs:
|
||||
run: composer install
|
||||
working-directory: ${{ inputs.backend_directory }}
|
||||
|
||||
- name: Setup Composer tests
|
||||
run: composer test:setup
|
||||
# If we have a `inputs.monorepo_tests`, we will run tests for each item of the provided array in a ::group::item
|
||||
# If we don't have a `inputs.monorepo_tests`, we will run tests for the current repository
|
||||
# We also have to run the `composer test:setup` script first before running each test
|
||||
- name: Run tests
|
||||
run: |
|
||||
if [ -z "${{ inputs.monorepo_tests }}" ]; then
|
||||
composer test:setup
|
||||
composer test
|
||||
else
|
||||
for test in ${{ inputs.monorepo_tests }}; do
|
||||
echo "::group::Running tests for $test"
|
||||
composer test:setup --working-dir=$test
|
||||
composer test --working-dir=$test
|
||||
echo "::endgroup::"
|
||||
done
|
||||
fi
|
||||
working-directory: ${{ inputs.backend_directory }}
|
||||
env:
|
||||
DB_PORT: 13306
|
||||
DB_PASSWORD: root
|
||||
DB_PREFIX: ${{ matrix.prefix }}
|
||||
|
||||
- name: Run Composer tests
|
||||
run: composer test
|
||||
working-directory: ${{ inputs.backend_directory }}
|
||||
env:
|
||||
COMPOSER_PROCESS_TIMEOUT: 600
|
||||
|
||||
phpstan:
|
||||
|
Reference in New Issue
Block a user