Updated .gitlab-ci.yaml and other files to build the frontend

This commit is contained in:
Igor Scheller 2018-08-03 05:09:11 +02:00
parent ccd061d3cb
commit 608fb3dad6
4 changed files with 25 additions and 12 deletions

6
.gitignore vendored
View File

@ -27,5 +27,7 @@ _vimrc_local.vim
/vendor/ /vendor/
/composer.lock /composer.lock
node_modules # Frontend files
public/assets /node_modules
/public/assets
/package-lock.json

View File

@ -37,7 +37,16 @@ before_script:
# Install Composer # Install Composer
- &before_install_composer |- - &before_install_composer |-
curl -sS https://getcomposer.org/installer | php -- --no-ansi --install-dir /usr/local/bin/ --filename composer curl -sS https://getcomposer.org/installer | php -- --no-ansi --install-dir /usr/local/bin/ --filename composer
/usr/local/bin/composer --no-ansi install composer --no-ansi install
# Install Node.js and Yarn
- &before_install_yarn |-
apt -yqq install gnupg2 apt-transport-https
curl -sL https://deb.nodesource.com/setup_8.x | bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
apt -yqq update && apt -yqq install nodejs yarn
yarn install
yarn build
.test_template: &test_definition .test_template: &test_definition
stage: test stage: test
@ -66,6 +75,7 @@ test:7.1:
- *before_fix_permissions - *before_fix_permissions
- *before_install_packages - *before_install_packages
- *before_install_composer - *before_install_composer
- *before_install_yarn
.deploy_template_script: .deploy_template_script:
# Configure SSH # Configure SSH
@ -78,8 +88,8 @@ test:7.1:
- &deployment_dependencies |- - &deployment_dependencies |-
chmod +x ./deploy.sh chmod +x ./deploy.sh
apt update && apt install -yqq rsync openssh-client apt update && apt install -yqq rsync openssh-client
/usr/local/bin/composer --no-ansi install --no-dev composer --no-ansi install --no-dev
/usr/local/bin/composer --no-ansi dump-autoload --optimize composer --no-ansi dump-autoload --optimize
deploy_staging: deploy_staging:
<<: *deploy_definition <<: *deploy_definition

View File

@ -10,7 +10,7 @@ To report bugs use [engelsystem/issues](https://github.com/engelsystem/engelsyst
## Installation ## Installation
### Requirements: ### Requirements:
* PHP >= 7.0.0 * PHP >= 7.0
* MySQL-Server >= 5.5 or MariaDB-Server >= 5.5 * MySQL-Server >= 5.5 or MariaDB-Server >= 5.5
* Webserver, i.e. lighttpd, nginx, or Apache * Webserver, i.e. lighttpd, nginx, or Apache
* Node >= 8 (Development/Building only) * Node >= 8 (Development/Building only)
@ -18,7 +18,7 @@ To report bugs use [engelsystem/issues](https://github.com/engelsystem/engelsyst
### Directions: ### Directions:
* Clone the master branch: `git clone https://github.com/engelsystem/engelsystem.git` * Clone the master branch: `git clone https://github.com/engelsystem/engelsystem.git`
* Install [Composer](https://getcomposer.org/download/) and [Yarn](https://yarnpkg.com/en/docs/install) * Install [Composer](https://getcomposer.org/download/) and [Yarn](https://yarnpkg.com/en/docs/install) (which requires [Node.js](https://nodejs.org/en/download/package-manager/))
* Install project dependencies: * Install project dependencies:
```bash ```bash
composer install composer install
@ -77,7 +77,7 @@ To use the deployment features the following secret variables need to be defined
```bash ```bash
SSH_PRIVATE_KEY # The ssh private key SSH_PRIVATE_KEY # The ssh private key
STAGING_REMOTE # The staging server, e.g. user@remote.host STAGING_REMOTE # The staging server, e.g. user@remote.host
STAGING_REMOTE_PATH # The psth on the remote server, e.g. /var/www/engelsystem STAGING_REMOTE_PATH # The path on the remote server, e.g. /var/www/engelsystem
PRODUCTION_REMOTE # Same as STAGING_REMOTE but for the production environment PRODUCTION_REMOTE # Same as STAGING_REMOTE but for the production environment
PRODUCTION_REMOTE_PATH # Same as STAGING_REMOTE_PATH but for the production environment PRODUCTION_REMOTE_PATH # Same as STAGING_REMOTE_PATH but for the production environment
``` ```

View File

@ -50,7 +50,7 @@ fi
echo "syncing ${PWD}/ to ${remote_host}:${remote_path}/${deploy_id}/" echo "syncing ${PWD}/ to ${remote_host}:${remote_path}/${deploy_id}/"
rsync -vAax --exclude '.git*' --exclude .composer/ \ rsync -vAax --exclude '.git*' --exclude .composer/ --exclude node_modules/ \
-e "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \ -e "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \
./ "${remote_host}:${remote_path}/${deploy_id}/" ./ "${remote_host}:${remote_path}/${deploy_id}/"
@ -63,7 +63,8 @@ ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${remote_hos
fi fi
echo \"Changing symlink\" echo \"Changing symlink\"
unlink \"${remote_path}/current\" && ln -s \"${remote_path}/${deploy_id}\" \"${remote_path}/current\" unlink_cmd=\$(command -v unlink || command -v rm)
\$unlink_cmd \"${remote_path}/current\" && ln -s \"${remote_path}/${deploy_id}\" \"${remote_path}/current\"
if [[ -f \"${deploy_id}-config.php\" ]]; then if [[ -f \"${deploy_id}-config.php\" ]]; then
echo \"Restoring config\" echo \"Restoring config\"