From 69f507f73181e08928198b9f3603c657f57e53d4 Mon Sep 17 00:00:00 2001 From: Abdouni Abdelkarim Date: Mon, 2 Dec 2024 20:08:42 +0100 Subject: [PATCH] Improve Github CI --- .github/workflows/{phpunit.yaml => ci.yaml} | 9 ++-- .github/workflows/php-cs-fixer.yaml | 56 --------------------- .github/workflows/phpstan.yaml | 56 --------------------- .github/workflows/twig-cs-fixer.yaml | 56 --------------------- .github/workflows/yaml-lint.yaml | 56 --------------------- Makefile | 6 +-- 6 files changed, 9 insertions(+), 230 deletions(-) rename .github/workflows/{phpunit.yaml => ci.yaml} (91%) delete mode 100644 .github/workflows/php-cs-fixer.yaml delete mode 100644 .github/workflows/phpstan.yaml delete mode 100644 .github/workflows/twig-cs-fixer.yaml delete mode 100644 .github/workflows/yaml-lint.yaml diff --git a/.github/workflows/phpunit.yaml b/.github/workflows/ci.yaml similarity index 91% rename from .github/workflows/phpunit.yaml rename to .github/workflows/ci.yaml index 9cd696b2..9a217421 100644 --- a/.github/workflows/phpunit.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: PHPUnit +name: CI on: [push] env: @@ -6,7 +6,7 @@ env: jobs: tests: - name: PHPUnit + name: CI # https://hub.docker.com/_/ubuntu/ runs-on: ubuntu-latest services: @@ -52,7 +52,10 @@ jobs: - name: Install Composer dependencies run: composer install - ## —— Tests ✅ ——————————————————————————————————————————————————————————— + - name: Run checks + run: make checks + + # —— Tests ✅ ——————————————————————————————————————————————————————————— - name: Create database run: bin/console doctrine:database:create --if-not-exists --env=test diff --git a/.github/workflows/php-cs-fixer.yaml b/.github/workflows/php-cs-fixer.yaml deleted file mode 100644 index 5223c1e4..00000000 --- a/.github/workflows/php-cs-fixer.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: PHP CS Fixer -on: [push] - -env: - DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/todolist?serverVersion=13&charset=utf8 - -jobs: - tests: - name: PHP CS Fixer - # https://hub.docker.com/_/ubuntu/ - runs-on: ubuntu-latest - services: - # https://hub.docker.com/_/postgres/ - postgresql: - image: postgres:13 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_PORT: 5432 - POSTGRES_DB: todolist - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - strategy: - fail-fast: true - matrix: - php-versions: ['8.2'] - steps: - # —— Setup Github actions 🐙 ————————————————————————————————————————————— - # https://github.com/actions/checkout (official) - - name: Checkout - uses: actions/checkout@v2 - - # https://github.com/shivammathur/setup-php (community) - - name: Setup PHP, extensions and composer with shivammathur/setup-php - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo, xdebug - tools: composer:v2 - env: - update: true - - # —— Composer 🧙‍️ ————————————————————————————————————————————————————————— - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install Composer dependencies - run: composer install - - - name: Run php-cs-fixer - run: PHP_CS_FIXER_IGNORE_ENV=true vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --diff --dry-run --verbose diff --git a/.github/workflows/phpstan.yaml b/.github/workflows/phpstan.yaml deleted file mode 100644 index 95975372..00000000 --- a/.github/workflows/phpstan.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: PHPStan -on: [push] - -env: - DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/todolist?serverVersion=13&charset=utf8 - -jobs: - tests: - name: PHPStan - # https://hub.docker.com/_/ubuntu/ - runs-on: ubuntu-latest - services: - # https://hub.docker.com/_/postgres/ - postgresql: - image: postgres:13 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_PORT: 5432 - POSTGRES_DB: todolist - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - strategy: - fail-fast: true - matrix: - php-versions: ['8.2'] - steps: - # —— Setup Github actions 🐙 ————————————————————————————————————————————— - # https://github.com/actions/checkout (official) - - name: Checkout - uses: actions/checkout@v2 - - # https://github.com/shivammathur/setup-php (community) - - name: Setup PHP, extensions and composer with shivammathur/setup-php - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo, xdebug - tools: composer:v2 - env: - update: true - - # —— Composer 🧙‍️ ————————————————————————————————————————————————————————— - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install Composer dependencies - run: composer install - - - name: Run phpstan - run: vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=1G diff --git a/.github/workflows/twig-cs-fixer.yaml b/.github/workflows/twig-cs-fixer.yaml deleted file mode 100644 index 2443ca38..00000000 --- a/.github/workflows/twig-cs-fixer.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: Twig-CS-Fixer -on: [push] - -env: - DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/todolist?serverVersion=13&charset=utf8 - -jobs: - tests: - name: Twig-CS-Fixer - # https://hub.docker.com/_/ubuntu/ - runs-on: ubuntu-latest - services: - # https://hub.docker.com/_/postgres/ - postgresql: - image: postgres:13 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_PORT: 5432 - POSTGRES_DB: todolist - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - strategy: - fail-fast: true - matrix: - php-versions: ['8.2'] - steps: - # —— Setup Github actions 🐙 ————————————————————————————————————————————— - # https://github.com/actions/checkout (official) - - name: Checkout - uses: actions/checkout@v2 - - # https://github.com/shivammathur/setup-php (community) - - name: Setup PHP, extensions and composer with shivammathur/setup-php - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo, xdebug - tools: composer:v2 - env: - update: true - - # —— Composer 🧙‍️ ————————————————————————————————————————————————————————— - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install Composer dependencies - run: composer install - - - name: Run twig-cs-fixer - run: vendor/bin/twig-cs-fixer diff --git a/.github/workflows/yaml-lint.yaml b/.github/workflows/yaml-lint.yaml deleted file mode 100644 index c2424b31..00000000 --- a/.github/workflows/yaml-lint.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: YAML lint -on: [push] - -env: - DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/todolist?serverVersion=13&charset=utf8 - -jobs: - tests: - name: YAML lint - # https://hub.docker.com/_/ubuntu/ - runs-on: ubuntu-latest - services: - # https://hub.docker.com/_/postgres/ - postgresql: - image: postgres:13 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_PORT: 5432 - POSTGRES_DB: todolist - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - strategy: - fail-fast: true - matrix: - php-versions: ['8.2'] - steps: - # —— Setup Github actions 🐙 ————————————————————————————————————————————— - # https://github.com/actions/checkout (official) - - name: Checkout - uses: actions/checkout@v2 - - # https://github.com/shivammathur/setup-php (community) - - name: Setup PHP, extensions and composer with shivammathur/setup-php - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, dom, filter, gd, iconv, json, mbstring, pdo, xdebug - tools: composer:v2 - env: - update: true - - # —— Composer 🧙‍️ ————————————————————————————————————————————————————————— - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install Composer dependencies - run: composer install - - - name: Run yaml-lint - run: bin/console lint:yaml .github/workflows config translations diff --git a/Makefile b/Makefile index b5fd107d..e050873c 100644 --- a/Makefile +++ b/Makefile @@ -93,10 +93,10 @@ sf-cw: ## Warmup Symfony cache .PHONY: php-cs-fixer phpstan twig-cs-fixer yaml-lint rector checks: ## Run checks -checks: php-cs-fixer twig-cs-fixer yaml-lint phpstan rector +checks: rector php-cs-fixer twig-cs-fixer yaml-lint phpstan php-cs-fixer: ## Run php-cs-fixer - PHP_CS_FIXER_IGNORE_ENV=true vendor/bin/php-cs-fixer fix --diff --dry-run --verbose + PHP_CS_FIXER_IGNORE_ENV=true vendor/bin/php-cs-fixer fix --diff --verbose phpstan: ## Run phpstan vendor/bin/phpstan analyse --memory-limit=1G @@ -108,7 +108,7 @@ yaml-lint: ## Run yaml-lint bin/console lint:yaml config translations rector: ## Run rector - vendor/bin/rector --dry-run + vendor/bin/rector # Tests .PHONY: tests tests-reset coverage coverage-reset