Merge pull request #1861 from cultuurnet/III-6389/prevent-UiTpas-loca⦠#7520
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: CI | |
on: push | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ["7.4", "8.0", "8.1"] | |
name: Unit tests ${{ matrix.php-versions }} | |
services: | |
mysql: | |
image: bitnami/mysql:8.0 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: false | |
MYSQL_PASSWORD: vagrant | |
MYSQL_ROOT_PASSWORD: vagrant | |
MYSQL_USER: vagrant | |
MYSQL_DATABASE: udb3_test | |
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
steps: | |
- name: π€ Checkout project | |
uses: actions/checkout@v4 | |
- name: π Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
ini-values: xdebug.mode=coverage | |
extensions: bcmath, tidy | |
tools: composer | |
- name: βοΈ Check PHP Version | |
run: php -v | |
- name: π Validate composer.json and composer.lock | |
run: composer validate | |
- name: π© Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}-v1 | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: π¦ Install dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: composer install --no-progress --no-suggest | |
- name: β Run tests | |
run: composer test | |
env: | |
DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }} | |
cs: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ["7.4", "8.0", "8.1"] | |
name: Code style ${{ matrix.php-versions }} | |
steps: | |
- name: π€ Checkout project | |
uses: actions/checkout@v4 | |
- name: π Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: tidy, zip | |
tools: composer | |
- name: π© Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: π¦ Install dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: composer install --no-progress --no-suggest | |
- name: β¨ Run code style check | |
run: composer cs | |
phpstan: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ["7.4", "8.0", "8.1"] | |
name: Static analysis ${{ matrix.php-versions }} | |
steps: | |
- name: π€ Checkout project | |
uses: actions/checkout@v4 | |
- name: π Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: tidy, zip | |
tools: composer | |
- name: π© Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: π¦ Install dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: composer install --no-progress --no-suggest | |
- name: π Run static analysis | |
run: composer phpstan | |
unused: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: ["7.4", "8.0", "8.1"] | |
name: Unused composer dependencies ${{ matrix.php-versions }} | |
steps: | |
- name: π€ Checkout project | |
uses: actions/checkout@v4 | |
- name: π Install PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: tidy, zip | |
tools: composer | |
- name: π© Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: π¦ Install dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: composer install --no-progress --no-suggest | |
- name: π Run unused dependencies check | |
run: composer unused |