Newer
Older
image: code.castopod.org:5050/adaures/castopod:latest

Yassine Doghri
committed
- quality
- release
php-dependencies:
stage: prepare
script:
# Install all php dependencies
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --ignore-platform-reqs
artifacts:
paths:
- vendor/

Yassine Doghri
committed
expire_in: 30 mins
js-dependencies:
stage: prepare
script:
# Install all npm dependencies
artifacts:
paths:

Yassine Doghri
committed
expire_in: 30 mins

Yassine Doghri
committed
lint-commit-msg:
stage: quality
script:
- chmod +x ./scripts/lint-commit-msg.sh

Yassine Doghri
committed
# lint commit message
- ./scripts/lint-commit-msg.sh
dependencies:
- js-dependencies
only:
- develop
- main
- beta
- alpha

Yassine Doghri
committed
lint-php:

Yassine Doghri
committed
stage: quality
script:

Yassine Doghri
committed
# check php code style

Yassine Doghri
committed
- vendor/bin/ecs check --ansi

Yassine Doghri
committed
# phpstan - increase memory limit to 1GB to prevent script failure
- php -d memory_limit=1G vendor/bin/phpstan analyse --ansi

Yassine Doghri
committed
# run rector to check for php errors
- vendor/bin/rector process --dry-run --ansi
dependencies:
- php-dependencies

Yassine Doghri
committed
lint-js:
stage: quality
script:
- npm run prettier
- npm run typecheck
- npm run lint
- npm run lint:css
dependencies:
- js-dependencies

Yassine Doghri
committed

Yassine Doghri
committed
tests:
stage: quality
services:
- mariadb
variables:
MYSQL_DATABASE: "tests"
MYSQL_ROOT_PASSWORD: "R00Tp4ssW0RD"
MYSQL_USER: "tests_user"
MYSQL_PASSWORD: "password"

Yassine Doghri
committed
script:
- apt-get install -y mariadb-client libmariadb-dev
- echo "SHOW DATABASES;" | mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mariadb "$MYSQL_DATABASE"

Yassine Doghri
committed
# run phpunit without code coverage
# TODO: add code coverage
- vendor/bin/phpunit --no-coverage
dependencies:
- php-dependencies

Yassine Doghri
committed

Yassine Doghri
committed
bundle:

Yassine Doghri
committed
before_script:
# prepare dependencies before bundling
- chmod +x ./scripts/bundle-prepare.sh
- ./scripts/bundle-prepare.sh

Yassine Doghri
committed
# make scripts/bundle.sh executable
- chmod +x ./scripts/bundle.sh
# bundle castopod with commit ref as version

Yassine Doghri
committed
- ./scripts/bundle.sh ${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}
dependencies:
- php-dependencies
- js-dependencies
name: "castopod-${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}"
only:
variables:
- $CI_PROJECT_NAMESPACE == "adaures"
except:
- main
- beta
- alpha

Yassine Doghri
committed
release:
stage: release

Yassine Doghri
committed
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:

Yassine Doghri
committed
# make release scripts executable
- chmod +x ./scripts/bundle.sh
- chmod +x ./scripts/package.sh
# run semantic-release script (configured in `.releaserc.json` file)
- npm run release
dependencies:
- php-dependencies
- js-dependencies
only:
- main
- beta

Yassine Doghri
committed
- alpha
website:
stage: deploy
trigger: adaures/castopod.org
only:
- main
- beta
- alpha
documentation:
stage: deploy
trigger:
include: docs/.gitlab-ci.yml
strategy: depend
only:
changes:
- docs/**/*