Set a proper ID for the table for multiselect. #6
Workflow file for this run
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: Continuous Integration | |
on: | |
push: | |
branches: | |
- master | |
- 'MTC\-[0-9]+' | |
pull_request: | |
env: | |
PLUGIN_DIR: plugins/LeuchtfeuerCompanySegmentsBundle # Same as extra.install-directory-name in composer.json | |
jobs: | |
phpunit: | |
name: PHPUnit ${{ matrix.php-versions }}, ${{ matrix.db-types }}, Mautic ${{ matrix.mautic-versions }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ['8.0', '8.1'] | |
db-types: ['mysql', 'mariadb'] | |
mautic-versions: ['5.0', '5.1', '5.x'] | |
services: | |
database: | |
image: ${{ matrix.db-types == 'mysql' && 'mysql:8.0' || 'mariadb:10.3' }} | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: mautictest | |
ports: | |
- 3306 | |
options: >- | |
--shm-size=2gb | |
--name=${{ matrix.db-types }} | |
--tmpfs=/var/lib/mysql | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- name: Checkout Mautic | |
uses: actions/checkout@v4 | |
with: | |
repository: mautic/mautic | |
ref: ${{ matrix.mautic-versions }} | |
fetch-depth: 0 | |
- name: Checkout this plugin | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.PLUGIN_DIR }} | |
- name: Setup PHP Environment | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
ini-values: pcov.enabled=0, pcov.directory=., pcov.exclude="~tests|themes|vendor~", opcache.enable_cli=0 | |
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, pdo_mysql | |
coverage: pcov | |
- name: add MySQL config file | |
run: | | |
mysqldump --version | |
mysqldump --print-defaults | |
cp .github/ci-files/.my.cnf ~/.my.cnf | |
mysqldump --print-defaults | |
- name: Set SYMFONY_ENV to test | |
run: | | |
echo "SYMFONY_ENV=test" >> $GITHUB_ENV | |
echo "MAUTIC_ENV=test" >> $GITHUB_ENV | |
- name: NPM Cache | |
uses: actions/cache@v4 | |
with: | |
path: ./var/cache/js | |
key: ${{ runner.os }}-js-${{ hashFiles('**/package-lock.json', 'webpack.config.js') }}-${{ github.run_id }} | |
restore-keys: | | |
${{ runner.os }}-js-${{ hashFiles('**/package-lock.json', 'webpack.config.js') }} | |
${{ runner.os }}-js- | |
- name: Install composer requirements. | |
# composer install cache - https://github.com/ramsey/composer-install | |
uses: "ramsey/composer-install@v3" | |
- name: Install Mautic | |
env: | |
DB_PORT: ${{ job.services.database.ports[3306] }} | |
run: | | |
cp ./.github/ci-files/local.php ./app/config/local.php | |
php bin/console mautic:install --force http://localhost | |
- name: Install Plugins | |
env: | |
DB_PORT: ${{ job.services.database.ports[3306] }} | |
run: php bin/console mautic:plugins:install --env=dev | |
- name: Run tests - database = ${{ matrix.db-types }} | |
run: | | |
rm -rf var/cache | |
export DB_PORT="${{ job.services.database.ports[3306] }}" | |
if [[ "${{ matrix.php-versions }}" == "8.1" ]] && [[ "${{ matrix.db-types }}" == "mariadb" ]]; then | |
php -d zend.assertions=1 -d pcov.enabled=1 bin/phpunit -d memory_limit=2G --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist --coverage-clover=coverage.xml --log-junit=junit.xml -- ${{ env.PLUGIN_DIR }}/Tests | |
else | |
php -d zend.assertions=1 bin/phpunit -d memory_limit=1G --bootstrap vendor/autoload.php --configuration app/phpunit.xml.dist -- ${{ env.PLUGIN_DIR }}/Tests | |
fi | |
# maybe need to run phpunit differently to get the coverage from the bundle only? | |
- name: Upload coverage report | |
if: ${{ matrix.php-versions == '8.1' && matrix.db-types == 'mysql' && matrix.mautic-versions == '5.x' }} # upload just once, change for your matrix | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
verbose: true | |
files: ./coverage.xml | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Save test results for future steps | |
if: ${{ matrix.php-versions == '8.1' && matrix.db-types == 'mysql' && matrix.mautic-versions == '5.x' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: | | |
./junit.xml | |
./coverage.xml | |
- name: Upload logs as artifacts | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs-${{ matrix.php-versions }}-${{ matrix.db-types }}-${{ matrix.mautic-versions }} | |
path: | | |
./var/logs/* | |
./media/files/temp/test*.html | |
# need to separate different code utilities to different processes, because if running in one "thread" | |
# there is an issue with the order/env variables/other means | |
# which does not allow the build to complete. | |
misc: | |
runs-on: ubuntu-latest | |
# these should contain latest stable PHP and Mautic versions | |
strategy: | |
fail-fast: false | |
matrix: | |
commands: ['PHPStan', 'CS Fixer', 'Rector', 'Twig Lint'] | |
php-versions: ['8.1'] | |
mautic-versions: ['5.x'] | |
name: ${{ matrix.commands }} - ${{ matrix.php-versions }} - ${{ matrix.mautic-versions }} | |
steps: | |
- name: Checkout Mautic | |
uses: actions/checkout@v4 | |
with: | |
repository: mautic/mautic | |
ref: ${{ matrix.mautic-versions }} | |
fetch-depth: 0 | |
- name: Checkout this plugin | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.PLUGIN_DIR }} | |
- name: Rector Cache | |
if: ${{matrix.commands == 'Rector'}} | |
uses: actions/cache@v4 | |
with: | |
path: ./var/cache/rector | |
key: ${{ runner.os }}-rector-${{ hashFiles('**/composer.lock') }}-${{ github.run_id }} | |
restore-keys: | | |
${{ runner.os }}-rector-${{ hashFiles('**/composer.lock') }} | |
${{ runner.os }}-rector- | |
- name: PHPStan Cache | |
if: ${{matrix.commands == 'PHPStan'}} | |
uses: actions/cache@v4 | |
with: | |
path: ./var/phpstan-cache | |
key: ${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }}-${{ github.run_id }} | |
restore-keys: | | |
${{ runner.os }}-phpstan-${{ hashFiles('**/composer.lock') }} | |
${{ runner.os }}-phpstan- | |
- name: NPM Cache | |
uses: actions/cache@v4 | |
with: | |
path: ./var/cache/js | |
key: ${{ runner.os }}-js-${{ hashFiles('**/package-lock.json', 'webpack.config.js') }}-${{ github.run_id }} | |
restore-keys: | | |
${{ runner.os }}-js-${{ hashFiles('**/package-lock.json', 'webpack.config.js') }} | |
${{ runner.os }}-js- | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql, pdo_mysql | |
ini-values: opcache.enable_cli=0 | |
- name: Install dependencies | |
uses: "ramsey/composer-install@v3" | |
env: | |
NPM_CONFIG_CACHE: ./var/cache/js/npm | |
- name: Run ${{ matrix.commands }} | |
run: | | |
if [[ "${{ matrix.commands }}" == "PHPStan" ]]; then | |
composer remove --dev rector/rector | |
php ${{ env.PLUGIN_DIR }}/.github/phpstan-config.php | |
cat phpstan.neon | |
export SYMFONY_ENV=dev | |
export APP_ENV=dev | |
export APP_DEBUG=1 | |
composer phpstan -- --no-progress ${{ env.PLUGIN_DIR }} | |
elif [[ "${{ matrix.commands }}" == "Rector" ]]; then | |
export SYMFONY_ENV=test | |
bin/console cache:warmup | |
bin/rector process --dry-run --ansi -- ${{ env.PLUGIN_DIR }} | |
elif [[ "${{ matrix.commands }}" == "Twig Lint" ]]; then | |
bin/console lint:twig ${{ env.PLUGIN_DIR }} | |
elif [[ "${{ matrix.commands }}" == "CS Fixer" ]]; then | |
bin/php-cs-fixer fix ${{ env.PLUGIN_DIR }} --config=.php-cs-fixer.php -v --dry-run --using-cache=no --show-progress=dots --diff | |
else | |
echo "Invalid command" | |
exit 1 | |
fi |