ad-aures_castoPod/.gitlab-ci.yml
Yassine Doghri ed57e13b40
feat: set min PHP version to 8.5 + upgrade CI4 to 4.7
update all dependencies to latest
2026-02-19 16:23:20 +00:00

198 lines
4.8 KiB
YAML

image: code.castopod.org:5050/adaures/castopod:ci-php8.5
stages:
- prepare
- quality
- bundle
- release
- deploy
- build
php-dependencies:
stage: prepare
script:
# Install all php dependencies
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
cache:
key:
files:
- composer.lock
paths:
- .composer-cache
artifacts:
expire_in: 30 mins
paths:
- vendor/
rules:
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
when: never
- when: on_success
js-dependencies:
stage: prepare
script:
# Install all js dependencies
- pnpm install
cache:
key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
artifacts:
expire_in: 30 mins
paths:
- node_modules/
rules:
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
when: never
- when: on_success
lint-commit-msg:
stage: quality
script:
- chmod +x ./scripts/lint-commit-msg.sh
# lint commit message
- ./scripts/lint-commit-msg.sh
dependencies:
- js-dependencies
rules:
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
when: never
- if: $CI_COMMIT_BRANCH =~ /^(develop|main|alpha|beta|next)$/
lint-php:
stage: quality
script:
# check php code style
- vendor/bin/ecs check --ansi
# phpstan - increase memory limit to 1GB to prevent script failure
- php -d memory_limit=1G vendor/bin/phpstan analyse --ansi
# run rector to check for php errors
- vendor/bin/rector process --dry-run --ansi
dependencies:
- php-dependencies
rules:
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
when: never
- when: on_success
lint-js:
stage: quality
script:
- pnpm run format
- pnpm run typecheck
- pnpm run lint
- pnpm run lint:css
dependencies:
- js-dependencies
rules:
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
when: never
- when: on_success
tests:
stage: quality
services:
- mariadb:10.11
variables:
MYSQL_ROOT_PASSWORD: "R00Tp4ssW0RD"
MYSQL_DATABASE: "test"
MYSQL_USER: "castopod"
MYSQL_PASSWORD: "castopod"
script:
- echo "SHOW DATABASES;" | mariadb --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mariadb "$MYSQL_DATABASE" --skip_ssl
# run phpunit without code coverage
# TODO: add code coverage
- vendor/bin/phpunit --no-coverage
dependencies:
- php-dependencies
rules:
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
when: never
- when: on_success
bundle:
stage: bundle
before_script:
# prepare dependencies before bundling
- chmod +x ./scripts/bundle-prepare.sh
- ./scripts/bundle-prepare.sh
script:
# make scripts/bundle.sh executable
- chmod +x ./scripts/bundle.sh
# bundle castopod with commit ref as version
- ./scripts/bundle.sh ${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}
dependencies:
- php-dependencies
- js-dependencies
artifacts:
name: "castopod-${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}"
paths:
- castopod
rules:
- if: $CI_PROJECT_NAMESPACE != "adaures"
when: never
- if: $CI_COMMIT_BRANCH =~ /^(main|alpha|beta|next)$/ || $CI_COMMIT_TAG
when: never
- when: on_success
release:
stage: release
before_script:
# IMPORTANT: delete local git tags before release to prevent eventual script failure (ie. tag already exists)
- git tag | xargs git tag -d
# prepare dependencies before release, both bundle and package scripts will be run by semantic-release
- chmod +x ./scripts/bundle-prepare.sh
- ./scripts/bundle-prepare.sh
script:
# make release scripts executable
- chmod +x ./scripts/bundle.sh
- chmod +x ./scripts/package.sh
# run semantic-release script (configured in `.releaserc.json` file)
- pnpm run release
dependencies:
- php-dependencies
- js-dependencies
artifacts:
paths:
- castopod
rules:
- if: $CI_PROJECT_NAMESPACE != "adaures"
when: never
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
when: never
- if: $CI_COMMIT_BRANCH =~ /^(main|alpha|beta|next)$/
website:
stage: deploy
trigger: adaures/castopod.org
rules:
- if: $CI_PROJECT_NAMESPACE != "adaures"
when: never
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/ && $CI_COMMIT_TAG
documentation:
stage: deploy
trigger:
include: docs/.gitlab-ci.yml
strategy: depend
rules:
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
when: never
- when: on_success
docker:
stage: build
trigger:
include: docker/production/.gitlab-ci.yml
strategy: depend
rules:
- if: $CI_PROJECT_NAMESPACE != "adaures"
when: never
- if: $CI_COMMIT_BRANCH == "develop"
- if: $CI_COMMIT_MESSAGE =~ /^chore\(release\):/ && $CI_COMMIT_TAG