Commit 8e62c3d0 authored by Elias Häußler's avatar Elias Häußler 🐛 Committed by Elias Häußler

[WIP][TASK] Add Gitlab CI configuration

parent 26cb6c75
Pipeline #39 passed with stages
in 2 minutes and 25 seconds
image: php:7.1
cache:
paths:
- docs/cache/
- vendor/
stages:
- test
- build
- deploy
build:
stage: build
image: composer:1
script:
- composer install
- sh sbin/generate_documentation.sh
test:
stage: test
before_script:
- curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/latest/download/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer
- chmod +x /usr/local/bin/php-cs-fixer
script:
- php-cs-fixer fix --config=.php_cs.dist --dry-run --diff
deploy:
stage: deploy
image: composer:1
variables:
REMOTE_HOST: "${REMOTE_USER}@${REMOTE_HOSTNAME}"
before_script:
# Remote target configuration
- cp remote.env.dist remote.env
- sed -i "s|TARGET_HOST=.*|TARGET_HOST=$REMOTE_HOST|g" remote.env
- sed -i "s|TARGET_PATH=.*|TARGET_PATH=$REMOTE_PATH|g" remote.env
- sed -i "s|TARGET_PORT=.*|TARGET_PORT=$REMOTE_PORT|g" remote.env
- cat remote.env
# Environment configuration
- apk add rsync --update
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | ssh-add -
- ssh-keyscan -p ${REMOTE_PORT} ${REMOTE_HOSTNAME} >> ~/.ssh/known_hosts
script:
- find . -type d -exec chmod 755 {} \;
- sh sbin/deploy.sh
# only:
# - tags
......@@ -6,6 +6,10 @@ Version numbers are based on [Semantic Versioning](https://semver.org).
## [Unreleased]
### Added
- Support for Gitlab CI
### Updated
- Use optimized composer autoloader for production
......
[![license](https://img.shields.io/github/license/eliashaeussler/api.svg)](LICENSE)
[![release](https://img.shields.io/github/release/eliashaeussler/api.svg)](https://github.com/eliashaeussler/api/releases/)
[![pipeline status](http://gitlab.elias-haeussler.de/eliashaeussler/api/badges/master/pipeline.svg)](http://gitlab.elias-haeussler.de/eliashaeussler/api/commits/master)
# elias-haeussler.de API
......
......@@ -57,13 +57,14 @@ rsync -arq --delete --delete-excluded --port ${TARGET_PORT} "${ROOT_PATH}"/ ${TA
--exclude /temp \
--exclude /.php_cs* \
--exclude /.sami_config.php \
--exclude /docs/cache
--exclude /docs/cache \
--exclude /docs/__build__ \
--exclude /.gitlab-ci.yml
output " Done." ${SUCCESS}
# Set new release on remote
ssh ${TARGET_HOST} -p ${TARGET_PORT} -T << __EOF
$(typeset -f output)
typeset -f output
set -e
# Create revision and version file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment