Feature: Development Only Scripts template #11
This file contains 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, '[0-9]+.[0-9]'] | |
pull_request: | |
branches: [main, '[0-9]+.[0-9]'] | |
jobs: | |
build: | |
env: | |
FLOW_CONTEXT: Testing | |
PACKAGE_FOLDER: neos-base-distribution/DistributionPackages | |
NEOS_FOLDER: neos-base-distribution | |
PACKAGE_NAME: 'Networkteam.Neos.Vite' | |
REPOSITORY_NAME: 'networkteam/neos-vite' | |
runs-on: ubuntu-latest | |
name: PHP ${{ matrix.php-versions }} | Flow ${{ matrix.neos-versions }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['8.1', '8.2'] | |
neos-versions: ['8.3'] | |
dependencies: ['highest'] | |
defaults: | |
run: | |
working-directory: ${{ env.NEOS_FOLDER }} | |
steps: | |
- name: Checkout Neos base distribution | |
uses: actions/checkout@v2 | |
with: | |
repository: neos/neos-base-distribution | |
ref: ${{ matrix.neos-versions }} | |
path: ${{ env.NEOS_FOLDER }} | |
- name: Checkout package | |
uses: actions/checkout@v2 | |
with: | |
path: ${{ env.PACKAGE_FOLDER}}/${{ env.PACKAGE_NAME }} | |
- name: Setup PHP, with Composer and extensions | |
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache composer dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-php${{ matrix.php-versions }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-php${{ matrix.php-versions }}-composer- | |
- name: Install dependencies | |
run: | | |
ls -la ./DistributionPackages | |
git -C ../${{ env.PACKAGE_FOLDER}}/${{ env.PACKAGE_NAME }} checkout -b build | |
composer config minimum-stability dev | |
composer config prefer-stable true | |
composer require --no-update --no-interaction --no-progress ${{ env.REPOSITORY_NAME }}:"dev-build as dev-master" | |
composer ${{ matrix.dependencies == 'locked' && 'install' || 'update' }} --no-interaction --no-progress ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }} ${{ matrix.composer-arguments }} | |
- name: Set Flow context | |
run: echo "FLOW_CONTEXT=${{ env.FLOW_CONTEXT }}" >> $GITHUB_ENV | |
- name: Setup Flow configuration | |
run: | | |
rm -f Configuration/Routes.yaml | |
rm -f Configuration/Testing/Settings.yaml | |
cat <<EOF >> Configuration/Testing/Settings.yaml | |
Neos: | |
Flow: | |
persistence: | |
backendOptions: | |
driver: pdo_sqlite | |
memory: true | |
user: 'neos' | |
password: 'neos' | |
dbname: 'flow_functional_testing' | |
mvc: | |
routes: | |
'Neos.Flow': FALSE | |
'Neos.Welcome': FALSE | |
EOF | |
- name: Run functional tests | |
run: | | |
bin/phpunit --colors -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Application/${PACKAGE_NAME}/Tests/Functional | |
- name: Run PHPStan | |
run: | | |
composer require --dev networkteam/flow-phpstan | |
cat <<EOF >> phpstan-baseline.neon | |
parameters: | |
ignoreErrors: [] | |
EOF | |
cat <<EOF >> phpstan.neon | |
includes: | |
- phpstan-baseline.neon | |
- Packages/Libraries/networkteam/flow-phpstan/extension.neon | |
parameters: | |
# 0: basic checks | |
# 1: possibly undefined variable, ... | |
# 2: unknown methods checked on all expressions | |
# 3: return types, types assigned to properties | |
# 4: basic dead code checking | |
# 5: checking types of arguments passed to methods and functions | |
# 6: check for missing typehints | |
# 7: report partially wrong union types | |
# 8: report calling methods and accessing properties on nullable types | |
level: 8 | |
reportUnmatchedIgnoredErrors: true | |
EOF | |
bin/phpstan analyse Packages/Application/${PACKAGE_NAME}/Classes |