Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Refactored the .gitlab-ci.yml file to reduce redundancy and improve t…
Browse files Browse the repository at this point in the history
…he workflow.

This change introduces a .install-dependencies stage to the CI configuration, which removes the repetitive task of specifying the same 'image' and 'composer install' for each job. It also updates the phpstan and phpunit from being a dev-dependency in the composer.json file to be installed via phive, providing version isolation and ensuring that the tools will not conflict with the project's dependencies. Furthermore, the Laravel pint package was updated to version v1.13.6. This change was made to streamline the build process and keep dependencies up-to-date.
  • Loading branch information
DerKnerd committed Dec 1, 2023
1 parent 5cdb495 commit 941c5d9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
25 changes: 19 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
.install-dependencies:
variables:
PHP_MEMORY_LIMIT: "2048M"
image:
name: harbor.ulbricht.casa/jinya/jinya-cms-php-base-test-image:latest
pull_policy: always
before_script:
- phive --no-progress install --trust-gpg-keys D615FEE32FD1702834DACC9C8AC0BAA79732DD42,D8406D0D82947747293778314AA394086372C20A,CA7C2C7A30C8E8E1274A847651C67305FFC2E5C0
- composer install

stages:
- lint
- test
- deploy

pint:
image: harbor.ulbricht.casa/jinya/jinya-cms-php-base-test-image:latest
extends:
- .install-dependencies
stage: lint
script:
- composer install
- ./vendor/bin/pint --test

phpstan:
image: harbor.ulbricht.casa/jinya/jinya-cms-php-base-test-image:latest
extends:
- .install-dependencies
stage: lint
script:
- composer install
- ./vendor/bin/phpstan --no-progress analyze ./src ./tests
- ./tools/phpstan --no-progress analyze ./src ./tests

phpunit:
image: harbor.ulbricht.casa/jinya/jinya-cms-php-base-test-image:latest
extends:
- .install-dependencies
stage: test
script:
- composer install
- ./vendor/bin/phpunit --log-junit report.xml --configuration ./phpunit.xml --coverage-text --coverage-cobertura=build/coverage.cobertura.xml
- ./tools/phpunit --log-junit report.xml --configuration ./phpunit.xml --coverage-text --coverage-cobertura=build/coverage.cobertura.xml
artifacts:
when: always
paths:
Expand All @@ -36,7 +49,7 @@ phpunit:

pages:
stage: deploy
image: harbor.ulbricht.casa/proxy/library/ruby:latest
image: library/ruby:latest
variables:
JEKYLL_ENV: production
LC_ALL: C.UTF-8
Expand Down
5 changes: 5 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.10.34" installed="1.10.34" location="./tools/phpstan" copy="true"/>
<phar name="phpunit" version="^10.4.1" installed="10.4.1" location="./tools/phpunit" copy="true"/>
</phive>
8 changes: 1 addition & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"require-dev": {
"ext-sqlite3": "*",
"ext-pdo_sqlite": "*",
"phpstan/phpstan": "1.10.39",
"phpunit/phpunit": "10.4.1",
"laravel/pint": "v1.13.4"
"laravel/pint": "v1.13.6"
},
"license": "MIT",
"autoload": {
Expand All @@ -31,9 +29,5 @@
"ext-pdo": "*",
"laminas/laminas-hydrator": "^4.14.0",
"jetbrains/phpstorm-attributes": "^1.0"
},
"scripts": {
"phpstan": "./vendor/bin/phpstan analyze ./src ./tests",
"test": "./vendor/bin/phpunit --log-junit ./report.xml --configuration ./phpunit.xml"
}
}

0 comments on commit 941c5d9

Please sign in to comment.