summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-03 05:09:11 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-03 12:56:33 +0200
commit608fb3dad69e9f79283dd350639c2596379539a0 (patch)
tree13c1d62bebaa281b3630346206d1e46bf9920ab7
parentccd061d3cb2136b195a4f33adc1391c0042415ef (diff)
Updated .gitlab-ci.yaml and other files to build the frontend
-rw-r--r--.gitignore6
-rw-r--r--.gitlab-ci.yml20
-rw-r--r--README.md6
-rwxr-xr-xdeploy.sh5
4 files changed, 25 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 7dd682df..9d43ab82 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,5 +27,7 @@ _vimrc_local.vim
/vendor/
/composer.lock
-node_modules
-public/assets \ No newline at end of file
+# Frontend files
+/node_modules
+/public/assets
+/package-lock.json
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8018543b..9fed9ea0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ image: php
cache:
paths:
- - .composer
+ - .composer
services:
- mariadb:10.2
@@ -37,7 +37,16 @@ before_script:
# Install Composer
- &before_install_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
stage: test
@@ -61,11 +70,12 @@ test:7.1:
services: []
stage: deploy
only:
- - master
+ - master
before_script:
- *before_fix_permissions
- *before_install_packages
- *before_install_composer
+ - *before_install_yarn
.deploy_template_script:
# Configure SSH
@@ -78,8 +88,8 @@ test:7.1:
- &deployment_dependencies |-
chmod +x ./deploy.sh
apt update && apt install -yqq rsync openssh-client
- /usr/local/bin/composer --no-ansi install --no-dev
- /usr/local/bin/composer --no-ansi dump-autoload --optimize
+ composer --no-ansi install --no-dev
+ composer --no-ansi dump-autoload --optimize
deploy_staging:
<<: *deploy_definition
diff --git a/README.md b/README.md
index 0e5fa121..248adff0 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ To report bugs use [engelsystem/issues](https://github.com/engelsystem/engelsyst
## Installation
### Requirements:
- * PHP >= 7.0.0
+ * PHP >= 7.0
* MySQL-Server >= 5.5 or MariaDB-Server >= 5.5
* Webserver, i.e. lighttpd, nginx, or Apache
* Node >= 8 (Development/Building only)
@@ -18,7 +18,7 @@ To report bugs use [engelsystem/issues](https://github.com/engelsystem/engelsyst
### Directions:
* 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:
```bash
composer install
@@ -77,7 +77,7 @@ To use the deployment features the following secret variables need to be defined
```bash
SSH_PRIVATE_KEY # The ssh private key
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_PATH # Same as STAGING_REMOTE_PATH but for the production environment
```
diff --git a/deploy.sh b/deploy.sh
index f1569a61..9aa72ff5 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -50,7 +50,7 @@ fi
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" \
./ "${remote_host}:${remote_path}/${deploy_id}/"
@@ -63,7 +63,8 @@ ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${remote_hos
fi
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
echo \"Restoring config\"