-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEVOPS-18] Update project CI/CD (#1)
* [DEVOPS-18] add travis.yml * add test * add test * Try to deploy to server * Fixed stages in gitlab * Finalize
- Loading branch information
1 parent
94db926
commit 8615da0
Showing
6 changed files
with
175 additions
and
170 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
user www-data; | ||
worker_processes 1; | ||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
events { | ||
worker_connections 1024; | ||
} | ||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
log_format main '$remote_addr - $remote_user [$time_local]' | ||
'"$request" $status $body_bytes_sent' | ||
'"$http_referer" "$http_user_agent"' | ||
'"$http_x_forwarded_for"'; | ||
access_log /var/log/nginx/access.log main; | ||
|
||
server { | ||
|
||
listen 80 default_server; | ||
listen [::]:80 default_server; | ||
charset utf-8; | ||
|
||
etag on; | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri $uri.html $uri/ /index.html =404; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,148 +1,35 @@ | ||
stages: | ||
- test | ||
- build | ||
- deploy | ||
|
||
eslint: | ||
image: node:10.15 | ||
stage: test | ||
script: | ||
- npm i | ||
- npm run lint | ||
only: | ||
- merge_requests | ||
- master | ||
- develop | ||
tags: | ||
- docker | ||
|
||
tests: | ||
image: node:10.15 | ||
stage: test | ||
script: | ||
- npm i | ||
- npm run build | ||
- npm run test | ||
only: | ||
- merge_requests | ||
- master | ||
- develop | ||
tags: | ||
- docker | ||
|
||
build.develop: | ||
stage: build | ||
cache: | ||
key: $CI_COMMIT_REF_NAME | ||
paths: | ||
- node_modules | ||
script: | ||
- npm config set unsafe-perm true | ||
- rm -rf node_modules/node-sass | ||
- npm i | ||
- npm run build-web | ||
- rm -rf /home/frontend | ||
- cp -r ./dist /home/frontend | ||
only: | ||
- develop | ||
tags: | ||
- develop | ||
environment: | ||
name: development | ||
|
||
build.master: | ||
stage: build | ||
cache: | ||
key: $CI_COMMIT_REF_NAME | ||
paths: | ||
- node_modules | ||
script: | ||
- npm config set unsafe-perm true | ||
- rm -rf node_modules/node-sass | ||
- npm i | ||
- npm run build-web | ||
- rm -rf /home/frontend | ||
- cp -r ./dist /home/frontend | ||
only: | ||
- master | ||
tags: | ||
- stage | ||
environment: | ||
name: development | ||
|
||
build.package-linux: | ||
image: electronuserland/builder:10 | ||
build: | ||
stage: build | ||
variables: | ||
DOWNLOAD_ECHO_NODE_URL: "https://github.com/echoprotocol/echo/releases/download/0.6.1/echo_node" | ||
cache: | ||
key: $CI_COMMIT_REF_NAME | ||
paths: | ||
- node_modules | ||
NODE_APP_INSTANCE: $CI_COMMIT_REF_NAME | ||
before_script: | ||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY | ||
script: | ||
- npm config set unsafe-perm true | ||
- rm -rf node_modules/node-sass | ||
- npm i | ||
- DEBUG_PROD=true npm run package-linux | ||
- docker build --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME . | ||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME | ||
only: | ||
- master | ||
- develop | ||
tags: | ||
- docker | ||
artifacts: | ||
name: 'artifacts_linux_$CI_COMMIT_REF_NAME' | ||
paths: | ||
- release/*.deb | ||
- release/*.rpm | ||
expire_in: 1 week | ||
environment: | ||
name: development | ||
- echo-linux | ||
|
||
build.package-win: | ||
image: electronuserland/builder:wine | ||
stage: build | ||
cache: | ||
key: "win_$CI_COMMIT_REF_NAME" | ||
paths: | ||
- node_modules | ||
deploy: | ||
stage: deploy | ||
before_script: | ||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY | ||
- if [ "$CI_COMMIT_REF_NAME" != "master" ]; then export PORT=36640; fi | ||
variables: | ||
CI_COMMIT_REF_NAME: develop | ||
CI_FULL_REGISTRY: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME | ||
PORT: 26640 | ||
script: | ||
- npm config set unsafe-perm true | ||
- rm -rf node_modules/node-sass | ||
- npm i | ||
- DEBUG_PROD=true npm run package-win | ||
- docker-compose -p "blip-${CI_COMMIT_REF_NAME}" up -d | ||
only: | ||
- master | ||
- develop | ||
tags: | ||
- docker | ||
artifacts: | ||
name: 'artifacts_win_$CI_COMMIT_REF_NAME' | ||
paths: | ||
- release/*.exe | ||
- release/*.msi | ||
expire_in: 1 week | ||
environment: | ||
name: development | ||
|
||
build.package-mac: | ||
stage: build | ||
# cache: | ||
# key: $CI_COMMIT_REF_NAME | ||
# paths: | ||
# - node_modules | ||
script: | ||
- npm config set unsafe-perm true | ||
- npm i | ||
- DEBUG_PROD=true npm run package-mac | ||
only: | ||
- master | ||
- develop | ||
tags: | ||
- echo-mac | ||
artifacts: | ||
name: 'artifacts_mac_$CI_COMMIT_REF_NAME' | ||
paths: | ||
- release/*.dmg | ||
- release/*.zip | ||
expire_in: 1 week | ||
environment: | ||
name: development | ||
- echo-linux |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
sudo: required | ||
language: node_js | ||
node_js: | ||
- "10" | ||
install: | ||
- NODE_ENV=development npm i yarn | ||
|
||
|
||
|
||
env: | ||
global: | ||
- NODE_OPTIONS="--max-old-space-size=2048" | ||
- NODE_ENV="development" | ||
|
||
stages: | ||
- test | ||
- build | ||
|
||
jobs: | ||
include: | ||
|
||
- stage: test | ||
name: "Test" | ||
if: type = push | ||
script: | ||
- NODE_ENV=development npm install | ||
- npm run build | ||
- npm run test | ||
- npm run lint | ||
|
||
|
||
|
||
|
||
- stage: build | ||
name: "Build Linux App" | ||
env: | ||
- DOWNLOAD_ECHO_NODE_URL= "https://github.com/echoprotocol/echo/releases/download/0.6.1/echo_node" | ||
if: tag IS present | ||
script: | ||
- sudo apt-get install rpm | ||
- npm config set unsafe-perm true | ||
- rm -rf node_modules/node-sass | ||
- npm i | ||
- DEBUG_PROD=true npm run package-linux | ||
deploy: | ||
provider: releases | ||
api_key: $GITHUB_OAUTH_TOKEN | ||
file_glob: true | ||
file: | ||
- release/*.deb | ||
- release/*.rpm | ||
skip_cleanup: true | ||
on: | ||
tags: true | ||
|
||
|
||
- stage: build | ||
name: "Build Win App" | ||
if: tag IS present | ||
script: | ||
- npm config set unsafe-perm true | ||
- rm -rf node_modules/node-sass | ||
- "docker run --rm -v ${PWD}:/project -v ${PWD}/.cache/electron:/root/.cache/electron -v ${PWD}/.cache/electron-builder:/root/.cache/electron-builder electronuserland/builder:wine /bin/bash -c \"npm install && npm run package-win\"" | ||
- ls -la release/ | ||
deploy: | ||
provider: releases | ||
api_key: $GITHUB_OAUTH_TOKEN | ||
file_glob: true | ||
file: | ||
- release/*.exe | ||
- release/*.msi | ||
skip_cleanup: true | ||
on: | ||
tags: true | ||
|
||
|
||
- stage: build | ||
os: osx | ||
name: "Build macOS App" | ||
if: tag IS present | ||
script: | ||
- npm config set unsafe-perm true | ||
- npm i | ||
- DEBUG_PROD=true npm run package-mac | ||
deploy: | ||
provider: releases | ||
api_key: $GITHUB_OAUTH_TOKEN | ||
file_glob: true | ||
file: | ||
- release/*.dmg | ||
- release/*.zip | ||
skip_cleanup: true | ||
on: | ||
tags: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM node:10.16.1-alpine as builder | ||
|
||
RUN apk add --update-cache git python make g++ gcc libpng-dev automake libtool | ||
|
||
WORKDIR /app/ | ||
|
||
COPY package.json ./ | ||
|
||
RUN npm config set unsafe-perm true | ||
COPY . . | ||
RUN npm i | ||
RUN npm run build-web | ||
|
||
FROM nginx:stable | ||
|
||
RUN rm -rf /usr/share/nginx/html | ||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
COPY .build/nginx.conf /etc/nginx/nginx.conf | ||
|
||
WORKDIR /etc/nginx | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
blip-wallet: | ||
image: $CI_FULL_REGISTRY | ||
ports: | ||
- 127.0.0.1:${PORT}:80 | ||
restart: always |