mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-23 16:05:34 +00:00
ci: use image with already installed composer & npm + add commit msg and js lint stages
This commit is contained in:
parent
88c52db53c
commit
53a934c8ea
@ -1,6 +1,7 @@
|
|||||||
image: php:8.0-fpm
|
image: thecodingmachine/php:8.0-v4-fpm-node14
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- prepare
|
||||||
- quality
|
- quality
|
||||||
- bundle
|
- bundle
|
||||||
- release
|
- release
|
||||||
@ -10,32 +11,31 @@ cache:
|
|||||||
- vendor/
|
- vendor/
|
||||||
- node_modules/
|
- node_modules/
|
||||||
|
|
||||||
before_script:
|
php-dependencies:
|
||||||
- apt-get update -y
|
stage: prepare
|
||||||
|
script:
|
||||||
|
# Install all php dependencies
|
||||||
|
- php composer.phar install --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
|
||||||
|
|
||||||
# Install git which is required by composer (the php image doesn't have it)
|
js-dependencies:
|
||||||
- apt-get install git -y
|
stage: prepare
|
||||||
|
script:
|
||||||
|
# Install all npm dependencies
|
||||||
|
- npm install
|
||||||
|
|
||||||
- apt-get install -y libicu-dev
|
lint-commit-msg:
|
||||||
|
stage: quality
|
||||||
# Install intl PHP extension for tests
|
script:
|
||||||
- docker-php-ext-install intl
|
- chmod +x ./scripts/lint-commit.sh
|
||||||
|
# lint commit message
|
||||||
# Install composer
|
- ./scripts/lint-commit.sh
|
||||||
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
|
||||||
- php composer-setup.php
|
|
||||||
- php -r "unlink('composer-setup.php');"
|
|
||||||
|
|
||||||
# Install latest npm
|
|
||||||
- curl -sL https://deb.nodesource.com/setup_lts.x | bash -
|
|
||||||
- apt-get update && apt-get install -y nodejs
|
|
||||||
- npm install --global npm
|
|
||||||
|
|
||||||
# Install all php dependencies
|
|
||||||
- php composer.phar install --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
|
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
stage: quality
|
stage: quality
|
||||||
|
before_script:
|
||||||
|
# Install required intl PHP extension for tests
|
||||||
|
- apt-get install -y libicu-dev
|
||||||
|
- docker-php-ext-install intl
|
||||||
script:
|
script:
|
||||||
# run phpunit without code coverage
|
# run phpunit without code coverage
|
||||||
# TODO: add code coverage
|
# TODO: add code coverage
|
||||||
@ -44,20 +44,30 @@ tests:
|
|||||||
code-style:
|
code-style:
|
||||||
stage: quality
|
stage: quality
|
||||||
script:
|
script:
|
||||||
|
# check php code style
|
||||||
- vendor/bin/ecs check --ansi
|
- vendor/bin/ecs check --ansi
|
||||||
|
|
||||||
static-analysis:
|
static-analysis:
|
||||||
stage: quality
|
stage: quality
|
||||||
script:
|
script:
|
||||||
# increase memory limit to 1GB because of script failure
|
# phpstan - increase memory limit to 1GB to prevent script failure
|
||||||
- php -d memory_limit=1G vendor/bin/phpstan analyse --ansi
|
- php -d memory_limit=1G vendor/bin/phpstan analyse --ansi
|
||||||
|
|
||||||
code-review:
|
code-review:
|
||||||
stage: quality
|
stage: quality
|
||||||
script:
|
script:
|
||||||
|
# run rector to check for php errors
|
||||||
- vendor/bin/rector process --dry-run --ansi
|
- vendor/bin/rector process --dry-run --ansi
|
||||||
|
|
||||||
bundle_app:
|
lint-js:
|
||||||
|
stage: quality
|
||||||
|
script:
|
||||||
|
- npm run prettier
|
||||||
|
- npm run typecheck
|
||||||
|
- npm run eslint
|
||||||
|
- npm run stylelint
|
||||||
|
|
||||||
|
bundle:
|
||||||
stage: bundle
|
stage: bundle
|
||||||
script:
|
script:
|
||||||
# make scripts/bundle.sh executable
|
# make scripts/bundle.sh executable
|
||||||
@ -76,7 +86,7 @@ bundle_app:
|
|||||||
- beta
|
- beta
|
||||||
- alpha
|
- alpha
|
||||||
|
|
||||||
release_app:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
# make release scripts executable
|
# make release scripts executable
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
"lint": "eslint --ext js,ts app/Views/_assets",
|
"lint": "eslint --ext js,ts app/Views/_assets",
|
||||||
"lint:fix": "eslint --ext js,ts app/Views/_assets --fix",
|
"lint:fix": "eslint --ext js,ts app/Views/_assets --fix",
|
||||||
"lint:css": "stylelint \"app/Views/_assets/**/*.css\"",
|
"lint:css": "stylelint \"app/Views/_assets/**/*.css\"",
|
||||||
|
"prettier": "prettier --check --ignore-path .gitignore .",
|
||||||
"prettier:fix": "prettier --write --ignore-path .gitignore .",
|
"prettier:fix": "prettier --write --ignore-path .gitignore .",
|
||||||
"typecheck": "tsc",
|
"typecheck": "tsc",
|
||||||
"commit": "git-cz",
|
"commit": "git-cz",
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# install only dev dependencies using the --no-dev option
|
# install only production dependencies using the --no-dev option
|
||||||
php composer.phar install --no-dev --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
|
php composer.phar install --no-dev --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
|
||||||
|
|
||||||
# install js dependencies and build all production UI assets
|
# build all production UI assets
|
||||||
npm install
|
|
||||||
npm run build
|
npm run build
|
||||||
|
12
scripts/lint-commit.sh
Executable file
12
scripts/lint-commit.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# see https://github.com/conventional-changelog/commitlint/issues/885
|
||||||
|
|
||||||
|
if [ "${CI_COMMIT_BEFORE_SHA}" = "0000000000000000000000000000000000000000" ]
|
||||||
|
then
|
||||||
|
echo "commitlint from HEAD^"
|
||||||
|
npx commitlint --from=HEAD^
|
||||||
|
else
|
||||||
|
echo "commitlint from ${CI_COMMIT_BEFORE_SHA}"
|
||||||
|
npx commitlint --from="${CI_COMMIT_BEFORE_SHA}"
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user