Created
June 12, 2020 12:42
-
-
Save makakken/ba4ac06dadf0f3c2dc45d3efa47ac1b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- build | |
- test | |
- deploy | |
image: lorisleiva/laravel-docker:latest | |
variables: | |
MYSQL_DATABASE: "test" | |
MYSQL_ROOT_PASSWORD: "test" | |
composer: | |
stage: build | |
cache: | |
key: ${CI_COMMIT_REF_SLUG}-composer | |
paths: | |
- vendor/ | |
script: | |
- composer install --no-interaction --no-progress | |
- cp .env.example .env | |
- php artisan key:generate | |
artifacts: | |
expire_in: 30 mins | |
paths: | |
- vendor/ | |
- fjord/ | |
- .env | |
npm: | |
stage: build | |
cache: | |
key: ${CI_COMMIT_REF_SLUG}-npm | |
paths: | |
- node_modules/ | |
script: | |
- npm install | |
- npm run production | |
artifacts: | |
expire_in: 30 mins | |
paths: | |
- public/css/ | |
- public/js/ | |
phpunit: | |
stage: test | |
services: | |
- mysql:5 | |
dependencies: | |
- composer | |
script: | |
- php artisan fjord:install | |
- composer dump-autoload | |
- php artisan config:clear | |
- php artisan migrate | |
- php artisan test | |
codestyle: | |
stage: test | |
dependencies: [] | |
script: | |
- phpcs --standard=PSR2 --extensions=php --ignore=app/Support/helpers.php app | |
publish_hetzner: | |
stage: deploy | |
image: ubuntu | |
only: | |
- master | |
script: | |
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' | |
- eval $(ssh-agent -s) | |
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null | |
- mkdir -p ~/.ssh | |
- chmod 700 ~/.ssh | |
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts | |
- chmod 644 ~/.ssh/known_hosts | |
- scp -rp ./ your_server_ip:/var/www/your_directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment