diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec27833..bc30f6e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,20 +1,58 @@ -FROM php:7.4 +image: lorisleiva/laravel-docker:latest -# Update packages -RUN apt-get update +# Replace the last line with the following lines if you'd rather +# leave StrictHostKeyChecking enabled (replace yourdomain.com): +# +# ssh-keyscan yourdomain.com >> ~/.ssh/known_hosts +# chmod 644 ~/.ssh/known_hosts + +.change_file_permissions: &change_file_permissions | + find . -type f -not -path "./vendor/*" -exec chmod 664 {} \; + find . -type d -not -path "./vendor/*" -exec chmod 775 {} \; + +composer: + stage: build + cache: + key: ${CI_COMMIT_REF_SLUG}-composer + paths: + - vendor/ + script: + - composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts + - cp .env.example .env + - php artisan key:generate + artifacts: + expire_in: 1 month + paths: + - vendor/ + - .env -# Install PHP and composer dependencies -RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev +npm: + stage: build + cache: + key: ${CI_COMMIT_REF_SLUG}-npm + paths: + - node_modules/ + script: + - npm install + - npm run production + artifacts: + expire_in: 1 month + paths: + - node_modules/ + - public/css/ + - public/js/ -# Clear out the local repository of retrieved package files -RUN apt-get clean -# Install needed extensions -# Here you can install any other extension that you need during the test and deployment process -RUN docker-php-ext-install mcrypt pdo_mysql zip +codestyle: + stage: test + dependencies: [] + script: + - phpcs --standard=PSR2 --extensions=php --ignore=app/Support/helpers.php app + +phpunit: + stage: test + dependencies: + - composer + script: + - phpunit --coverage-text --colors=never -# Install Composer -RUN curl --silent --show-error "https://getcomposer.org/installer" | php -- --install-dir=/usr/local/bin --filename=composer - -# Install Laravel Envoy -RUN composer global require "laravel/envoy=~1.0"