Merge pull request #442 from sumocoders/561-sppondate-vervangen-door-… #162
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: ~ | |
| workflow_dispatch: ~ | |
| env: | |
| php_version: 8.5 | |
| php_extensions: json zip gd intl simplexml | |
| php_extensions_key: cache-v1 # can be any string, change to clear the extension cache. | |
| jobs: | |
| # Build section | |
| install_dependencies_and_build_assets: | |
| name: "Install dependencies and build assets" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Cache dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| key: ${{ env.php_extensions_key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| coverage: none | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: 'package.json' | |
| - name: Install Composer packages | |
| run: composer install --no-scripts | |
| - name: Copy parameters.yml | |
| run: cp app/config/parameters.yml.dist app/config/parameters.yml | |
| - name: Generate .env.local | |
| run: | | |
| echo 'FORK_ENV=dev' >> .env.local | |
| echo 'FORK_DEBUG=true' >> .env.local | |
| - name: Install NPM packages | |
| run: npm ci | |
| - name: Build assets | |
| run: | | |
| node_modules/.bin/gulp build | |
| npm run build | |
| # Code Quality section | |
| php_code_sniffer: | |
| name: "PHP_CodeSniffer - check code styling" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| key: ${{ env.php_extensions_key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| coverage: none | |
| - name: Run PHP Codesniffer | |
| run: php bin/phpcs --colors --report-full | |
| phpstan: | |
| name: "PHPStan - check for bugs" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_DATABASE: ci_test | |
| MYSQL_ROOT_PASSWORD: root | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| key: ${{ env.php_extensions_key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| coverage: none | |
| - name: Configure test environment | |
| run: | | |
| mysql -h 127.0.0.1 -u root -proot ci_test < tests/data/test_db.sql | |
| touch src/Frontend/Core/Js/bundle.js | |
| php bin/generate-parameters-gitlab | |
| cp app/config/parameters.yml.gitlab app/config/parameters.yml | |
| sed -i -E 's/database\.name:(.*)ci$/database.name:\1ci_test/g' app/config/parameters.yml | |
| sed -i -E 's/database\.host:(.*)mysql$/database.host:\1127.0.0.1/g' app/config/parameters.yml | |
| php bin/console --no-interaction assets:install . | |
| php bin/console --no-interaction forkcms:cache:clear --env=dev | |
| php bin/console --no-interaction cache:warmup --env=dev | |
| - name: Run PHPStan | |
| run: | | |
| php bin/phpstan analyse --memory-limit=-1 --no-progress --no-interaction | |
| twig_cs_fixer: | |
| name: "Twig-CS-Fixer - check code styling" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| key: ${{ env.php_extensions_key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| coverage: none | |
| - name: Run Twig-CS-Fixer | |
| run: php bin/twig-cs-fixer --no-interaction lint templates/ | |
| stylelint: | |
| name: "Stylelint - check code styling" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Run Stylelint | |
| run: ./node_modules/.bin/stylelint --color . | |
| standardjs: | |
| name: "StandardJS - check code styling" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Run Standard JS | |
| run: ./node_modules/.bin/standard . | |
| # Dependency Scanning section | |
| npm_audit: | |
| name: "NPM packages - check for vulnerabilities" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: 'package.json' | |
| - name: Run npm audit | |
| run: npm audit --production | |
| php_composer_audit: | |
| name: "PHP packages - composer audit" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| key: ${{ env.php_extensions_key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| coverage: none | |
| - name: Run composer audit | |
| run: composer audit --ansi --no-interaction | |
| # Outdated packages Scanning section | |
| npm_outdated: | |
| name: "NPM packages - check for outdated packages" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: 'package.json' | |
| - name: Run npm outdated | |
| run: npm outdated --production | |
| php_composer_outdated: | |
| name: "PHP packages - composer outdated" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| key: ${{ env.php_extensions_key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| coverage: none | |
| - name: Run composer outdated | |
| run: composer outdated --ansi --no-interaction --strict | |
| # Test section | |
| phpunit: | |
| name: "PHPUnit - Run unit tests" | |
| runs-on: ubuntu-latest | |
| needs: install_dependencies_and_build_assets | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_DATABASE: ci_test | |
| MYSQL_ROOT_PASSWORD: root | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| .env.local | |
| app/config/parameters.yml | |
| bin | |
| css | |
| fonts | |
| images | |
| js | |
| node_modules | |
| vendor | |
| key: ${{ runner.os }}-pipeline-${{ github.run_id }} | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| key: ${{ env.php_extensions_key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.php_version }} | |
| extensions: ${{ env.php_extensions }} | |
| coverage: none | |
| - name: Configure test environment | |
| run: | | |
| mysql -h 127.0.0.1 -u root -proot ci_test < tests/data/test_db.sql | |
| touch src/Frontend/Core/Js/bundle.js | |
| php bin/generate-parameters-gitlab | |
| cp app/config/parameters.yml.gitlab app/config/parameters.yml | |
| sed -i -E 's/database\.host:(.*)mysql$/database.host:\1127.0.0.1/g' app/config/parameters.yml | |
| cat app/config/parameters.yml | |
| php bin/console --no-interaction assets:install . --env=test | |
| php bin/console --no-interaction forkcms:cache:clear --env=test | |
| php bin/console --no-interaction cache:warmup --env=test | |
| - name: Run PHPUnit | |
| run: | | |
| php bin/simple-phpunit --testsuite=unit |