Merge pull request #255 from Flowpack/neos-9 #609
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
PACKAGE_FOLDER: media-ui | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Run linting | |
run: yarn lint | |
codestyle: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
- name: Add additional dependencies | |
run: | | |
composer require --no-update --no-interaction neos/contentgraph-doctrinedbaladapter:"~9.0.0" | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.composer/cache | |
key: dependencies-composer-${{ hashFiles('composer.json') }} | |
- name: Install dependencies | |
uses: php-actions/composer@v6 | |
with: | |
php_version: 8.2 | |
version: 2 | |
- name: PHPStan | |
uses: php-actions/phpstan@v3 | |
with: | |
php_version: 8.2 | |
version: 2.1.17 | |
command: analyse | |
path: 'Classes/' | |
php-unit-tests: | |
env: | |
FLOW_CONTEXT: Testing | |
FLOW_FOLDER: ../flow-base-distribution | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.2'] | |
flow-versions: ['9.0'] | |
services: | |
mariadb: | |
# see https://mariadb.com/kb/en/mariadb-server-release-dates/ | |
# this should be a current release, e.g. the LTS version | |
image: mariadb:10.8 | |
env: | |
MYSQL_USER: neos | |
MYSQL_PASSWORD: neos | |
MYSQL_DATABASE: neos_functional_testing | |
MYSQL_ROOT_PASSWORD: neos | |
ports: | |
- "3306:3306" | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set package branch name | |
run: echo "PACKAGE_TARGET_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV | |
working-directory: . | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite, mysql | |
coverage: xdebug #optional | |
ini-values: opcache.fast_shutdown=0 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.composer/cache | |
key: dependencies-composer-${{ hashFiles('composer.json') }} | |
- name: Prepare Flow distribution | |
run: | | |
git clone https://github.com/neos/flow-base-distribution.git -b ${{ matrix.flow-versions }} ${FLOW_FOLDER} | |
cd ${FLOW_FOLDER} | |
git -C ../${{ env.PACKAGE_FOLDER }} checkout -b build | |
composer config repositories.package '{ "type": "path", "url": "../${{ env.PACKAGE_FOLDER }}", "options": { "symlink": false } }' | |
composer require --no-update --no-interaction flowpack/media-ui:"dev-build as dev-${PACKAGE_TARGET_VERSION}" | |
composer require --no-update --no-interaction neos/contentgraph-doctrinedbaladapter:"~9.0.0" | |
- name: Composer Install | |
run: | | |
cd ${FLOW_FOLDER} | |
composer update --no-interaction --no-progress | |
- name: Run Unit tests | |
run: | | |
cd ${FLOW_FOLDER} | |
bin/phpunit --colors -c Build/BuildEssentials/PhpUnit/UnitTests.xml Packages/Application/Flowpack.Media.Ui/Tests/Unit/ | |
- name: Setup Flow configuration | |
run: | | |
cd ${FLOW_FOLDER} | |
rm -f Configuration/Testing/Settings.yaml | |
cat <<EOF >> Configuration/Testing/Settings.yaml | |
Neos: | |
Flow: | |
persistence: | |
backendOptions: | |
host: '127.0.0.1' | |
driver: pdo_mysql | |
user: 'neos' | |
password: 'neos' | |
dbname: 'neos_functional_testing' | |
EOF | |
- name: Run Functional tests | |
run: | | |
cd ${FLOW_FOLDER} | |
bin/phpunit --colors -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/Flowpack.Media.Ui/Tests/Functional/ | |
- name: Show log on failure | |
if: ${{ failure() }} | |
run: | | |
cd ${FLOW_PATH_ROOT} | |
cat Data/Logs/System_Testing.log | |
for file in Data/Logs/Exceptions/*; do | |
echo $file | |
cat $file | |
done | |
js-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Run mocha tests | |
run: yarn test:unit | |
e2e: | |
env: | |
# Solves error when parcel tries to count cpus via lscpu | |
PARCEL_WORKERS: 1 | |
DEBUG: 'testcafe:tested-app:*' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Build main module | |
run: yarn build:module | |
- name: Build plugin for Neos UI | |
run: yarn build:plugin | |
- name: Run TestCafe | |
run: yarn test:e2e:github-actions | |
- name: Archive failure screenshots | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: e2e-failure-screenshots | |
path: screenshots |