Skip to content

Commit eb0bfc8

Browse files
committed
ci: workflow for php8.2 and php8.3
1 parent e1c0c45 commit eb0bfc8

File tree

4 files changed

+70
-57
lines changed

4 files changed

+70
-57
lines changed

.github/workflows/lint.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
1-
name: Lint
1+
name: Coding standards
22
on: [push]
33
jobs:
44
lint:
5-
name: PHP Lint
5+
name: Coding standards
66
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
php: [ '8.2', '8.3' ]
11+
712
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
816
- name: Setup PHP
917
uses: shivammathur/setup-php@v2
1018
with:
11-
php-version: 8.2
19+
php-version: ${{ matrix.php }}
20+
tools: composer:v2
21+
22+
- name: Setup cache
23+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
1224

13-
- name: Cache Composer dependencies
25+
- name: Cache dependencies installed with composer
1426
uses: actions/cache@v2
1527
with:
16-
path: /tmp/composer-cache
17-
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
28+
path: ${{ env.COMPOSER_CACHE_DIR }}
29+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
30+
restore-keys: |
31+
php${{ matrix.php }}-composer-latest-
32+
33+
- name: Update composer
34+
run: composer self-update
35+
36+
- name: Install dependencies with composer
37+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
1838

19-
- uses: actions/checkout@master
20-
- name: lint
21-
run: make lint
39+
- name: Run code quality analysis
40+
run: make lint

.github/workflows/test.yaml

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
1-
name: Test
1+
name: Tests
22
on: [push]
33
jobs:
4-
lint:
5-
name: PHP Test
6-
runs-on: ubuntu-latest
7-
steps:
8-
- name: Setup PHP
9-
uses: shivammathur/setup-php@v2
10-
with:
11-
php-version: 8.2
4+
test:
5+
name: Tests
6+
runs-on: ubuntu-latest
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
php: [ '8.2', '8.3' ]
1211

13-
- name: Cache Composer dependencies
14-
uses: actions/cache@v2
15-
with:
16-
path: /tmp/composer-cache
17-
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
1815

19-
- uses: actions/checkout@master
20-
- name: test
21-
run: make test
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ matrix.php }}
20+
tools: composer:v2
21+
22+
- name: Setup cache
23+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
24+
25+
- name: Cache dependencies installed with composer
26+
uses: actions/cache@v2
27+
with:
28+
path: ${{ env.COMPOSER_CACHE_DIR }}
29+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
30+
restore-keys: |
31+
php${{ matrix.php }}-composer-latest-
32+
33+
- name: Update composer
34+
run: composer self-update
35+
36+
- name: Install dependencies with composer
37+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
38+
39+
- name: Run tests
40+
run: make test

Makefile

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
.DEFAULT_GOAL := help
22

3-
# -----------------------------------
4-
# Variables
5-
# -----------------------------------
6-
is_docker := $(shell docker info > /dev/null 2>&1 && echo 1)
7-
user := $(shell id -u)
8-
group := $(shell id -g)
9-
10-
ifeq ($(is_docker), 1)
11-
php := USER_ID=$(user) GROUP_ID=$(group) docker-compose run --rm --no-deps php
12-
composer := $(php) composer
13-
else
14-
php := php
15-
composer := composer
16-
endif
17-
183
# -----------------------------------
194
# Recipes
205
# -----------------------------------
@@ -24,17 +9,17 @@ help: ## affiche cet aide
249

2510
.PHONY: lint
2611
lint: vendor/autoload.php ## affiche les erreurs de formatage de code
27-
$(php) vendor/bin/ecs
28-
$(php) vendor/bin/phpstan
12+
php vendor/bin/ecs
13+
php vendor/bin/phpstan
2914

3015
.PHONY: test
3116
test: vendor/autoload.php ## lance les tests
32-
$(php) vendor/bin/phpunit
17+
php vendor/bin/phpunit
3318

3419
.PHONY: lint-fix
3520
lint-fix: vendor/autoload.php ## corrige les erreurs de formatage de code
36-
$(php) vendor/bin/ecs --fix
21+
php vendor/bin/ecs --fix
3722

3823
vendor/autoload.php: composer.lock # installe les dépendances PHP
39-
$(composer) update
40-
$(composer) dump-autoload
24+
composer update
25+
composer dump-autoload

docker-compose.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)