Add circleci config
This commit is contained in:
parent
b8944a3f04
commit
7fb7be3860
|
@ -0,0 +1,84 @@
|
|||
version: 2.1
|
||||
orbs:
|
||||
php: circleci/php@1.0.2
|
||||
node: circleci/node@1.1.6
|
||||
aws-cli: circleci/aws-cli@1.0.0
|
||||
jobs:
|
||||
install_composer_packages:
|
||||
executor: php/default
|
||||
steps:
|
||||
- checkout
|
||||
- php/install-composer
|
||||
|
||||
- run:
|
||||
name: Install php extensions
|
||||
command: |
|
||||
sudo add-apt-repository ppa:ondrej/php
|
||||
sudo apt install php-imap
|
||||
|
||||
- php/install-packages:
|
||||
app-dir: server/
|
||||
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- .
|
||||
|
||||
install_node_packages:
|
||||
docker:
|
||||
- image: circleci/node:11.15.0-stretch
|
||||
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
|
||||
- restore_cache:
|
||||
keys:
|
||||
- node-cache-{{ checksum "client/package.json" }}
|
||||
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: |
|
||||
sudo npm install -g npm@6.7.0
|
||||
sudo npm install -g mocha@6.2.0
|
||||
cd client && npm install
|
||||
|
||||
- save_cache:
|
||||
paths:
|
||||
- client/node_modules
|
||||
key: node-cache-{{ checksum "client/package.json" }}
|
||||
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- .
|
||||
|
||||
deploy_staging_files:
|
||||
docker:
|
||||
- image: circleci/node:11.15.0-stretch
|
||||
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
|
||||
- deploy:
|
||||
name: Deploy staging files
|
||||
command: |
|
||||
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
||||
sudo python get-pip.py pip==19.3.1
|
||||
sudo pip install awscli
|
||||
sudo apt-get update
|
||||
sudo apt-get install lftp
|
||||
if [ "$CIRCLE_BRANCH" = "master" ]; then make deploy-staging-files; fi
|
||||
|
||||
workflows:
|
||||
install:
|
||||
jobs:
|
||||
- install_composer_packages
|
||||
- install_node_packages:
|
||||
requires:
|
||||
- install_composer_packages
|
||||
- deploy_staging_files:
|
||||
requires:
|
||||
- install_node_packages
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
.idea
|
||||
.jshintrc
|
||||
.DS_Store
|
||||
client/package-lock.json
|
||||
tests/Gemfile.lock
|
||||
server/composer.lock
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
deploy-staging-files:
|
||||
./build.sh
|
||||
FOLDER=dev1 DOMAIN=dev1.opensupports.com make deploy-instance-files
|
||||
FOLDER=dev2 DOMAIN=dev2.opensupports.com make deploy-instance-files
|
||||
BUCKET=opensupports-packages FILE=dist/opensupports_dev.zip make s3upload
|
||||
|
||||
deploy-instance-files:
|
||||
cd client && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; mirror -R build /${FOLDER}" && \
|
||||
cd ../api && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; put -O /${FOLDER}/api/ index.php" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; put -O /${FOLDER}/api/ .htaccess" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; put -O /${FOLDER}/api/ composer.json" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; put -O /${FOLDER}/api/ composer.lock" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; mirror -R controllers/ /${FOLDER}/api/controllers/" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; mirror -R data/ /${FOLDER}/api/data/" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; mirror -R libs/ /${FOLDER}/api/libs/" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; mirror -R models/ /${FOLDER}/api/models/" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; mirror -R files/ /${FOLDER}/api/files" && \
|
||||
lftp -c "open -u $(FTP_USER),$(FTP_PASSWORD) $(FTP_HOST); set ssl:verify-certificate no; mirror -R vendor/ /${FOLDER}/api/vendor" || true && \
|
||||
(curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://${DOMAIN}/api/clear.php || true) && \
|
||||
cd .. ;
|
||||
|
||||
s3upload:
|
||||
aws s3 cp ${FILE} s3://$(BUCKET)/ --cache-control max-age=0
|
1
build.sh
1
build.sh
|
@ -4,7 +4,6 @@ npm run build
|
|||
rm build/index.html
|
||||
echo "2/3 Creating api folder..."
|
||||
cd ../server
|
||||
composer install
|
||||
echo -n > config.php
|
||||
mkdir files2
|
||||
mv files/.htaccess files2
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"scripts": {
|
||||
"start": "webpack-dev-server",
|
||||
"start-fixtures": "webpack-dev-server --env.FIXTURES=1",
|
||||
"build": "rimraf build && NODE_ENV=production webpack -p --devtool none",
|
||||
"build": "./node_modules/.bin/rimraf build && NODE_ENV=production ./node_modules/.bin/webpack -p --devtool none",
|
||||
"test": "export NODE_PATH=src && mocha src/lib-test/preprocessor.js --require @babel/register --recursive src/**/**/__tests__/*-test.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.1",
|
||||
"ext-fileinfo": "1.0.5"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"slim/slim": "~2.0",
|
||||
"respect/validation": "^1.1",
|
||||
|
|
Loading…
Reference in New Issue