diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c8f91ad..2a12234 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,21 +1,40 @@ -name: Lint +name: Coding standards on: [push] jobs: lint: - name: PHP Lint + name: Coding standards runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [ '8.2', '8.3' ] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: ${{ matrix.php }} + tools: composer:v2 + + - name: Setup cache + run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - name: Cache Composer dependencies + - name: Cache dependencies installed with composer uses: actions/cache@v2 with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + php${{ matrix.php }}-composer-latest- + + - name: Update composer + run: composer self-update + + - name: Install dependencies with composer + run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - uses: actions/checkout@master - - name: lint - run: make lint + - name: Run code quality analysis + run: make lint \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b5471f9..9930e0c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,21 +1,40 @@ -name: Test +name: Tests on: [push] jobs: - lint: - name: PHP Test - runs-on: ubuntu-latest - steps: - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.2 + test: + name: Tests + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: [ '8.2', '8.3' ] - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + steps: + - name: Checkout + uses: actions/checkout@v2 - - uses: actions/checkout@master - - name: test - run: make test + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + + - name: Setup cache + run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV + + - name: Cache dependencies installed with composer + uses: actions/cache@v2 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + php${{ matrix.php }}-composer-latest- + + - name: Update composer + run: composer self-update + + - name: Install dependencies with composer + run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi + + - name: Run tests + run: make test \ No newline at end of file diff --git a/Makefile b/Makefile index f6b830c..b7bce62 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,5 @@ .DEFAULT_GOAL := help -# ----------------------------------- -# Variables -# ----------------------------------- -is_docker := $(shell docker info > /dev/null 2>&1 && echo 1) -user := $(shell id -u) -group := $(shell id -g) - -ifeq ($(is_docker), 1) - php := USER_ID=$(user) GROUP_ID=$(group) docker-compose run --rm --no-deps php - composer := $(php) composer -else - php := php - composer := composer -endif - # ----------------------------------- # Recipes # ----------------------------------- @@ -24,17 +9,17 @@ help: ## affiche cet aide .PHONY: lint lint: vendor/autoload.php ## affiche les erreurs de formatage de code - $(php) vendor/bin/ecs - $(php) vendor/bin/phpstan + php vendor/bin/ecs + php vendor/bin/phpstan .PHONY: test test: vendor/autoload.php ## lance les tests - $(php) vendor/bin/phpunit + php vendor/bin/phpunit .PHONY: lint-fix lint-fix: vendor/autoload.php ## corrige les erreurs de formatage de code - $(php) vendor/bin/ecs --fix + php vendor/bin/ecs --fix vendor/autoload.php: composer.lock # installe les dépendances PHP - $(composer) update - $(composer) dump-autoload + composer update + composer dump-autoload \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index 220fa8d..0000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,10 +0,0 @@ -version: '3' - -services: - php: - image: grafikart/php:php8.2-2 - user: '${USER_ID}:${GROUP_ID}' - container_name: maxicash_php - restart: unless-stopped - volumes: - - .:/var/www:delegated