1 # Select what we should cache
6 # Run tests for php:8.1
9 before_script: &before_linter_script
10 # Install git, the docker php image doesn't have it installed by default
12 - apt-get install git -yqq
13 - apt-get install zip -yqq
14 # Enable necessary php extensions
15 - docker-php-ext-enable curl && docker-php-ext-enable json && docker-php-ext-enable zip && docker-php-ext-enable mbstring && docker-php-ext-enable gd && docker-php-ext-enable pdo_mysql
17 - curl -sS https://getcomposer.org/installer | php
18 # Create composer.json file manually, since this is a project without any non-dev dependencies yet
19 - php composer.phar require --dev php-parallel-lint/php-parallel-lint
20 - php composer.phar require --dev friendsofphp/php-cs-fixer:3.10.0
21 # Install all project dependencies
22 - php composer.phar install
23 script: &linter_script
24 - ./vendor/bin/parallel-lint --exclude vendor .
25 - ./vendor/bin/php-cs-fixer -vvv fix . --dry-run --using-cache=no --rules=@PSR2
27 # Run tests for php:7.4
30 before_script: *before_linter_script
31 script: *linter_script
39 - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
40 - docker build -t $CI_REGISTRY/$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG .
41 # If we're on the default branch, also tag the image as latest
42 - docker build -t $CI_REGISTRY/$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG -t $CI_REGISTRY/$CI_REGISTRY_IMAGE:latest .
43 - docker push $CI_REGISTRY/$CI_REGISTRY_IMAGE --all-tags