my-notes-viewer/.drone.yml

188 lines
5.0 KiB
YAML
Raw Normal View History

2021-03-22 15:59:05 +01:00
kind: pipeline
type: docker
name: default
2021-09-14 14:45:47 +02:00
workspace:
path: /drone/workdir
2021-03-22 15:59:05 +01:00
steps:
2021-09-14 14:45:47 +02:00
- name: mongo
image: mongo
pull: if-not-exists
detach: true
- name: maildev
image: maildev/maildev
pull: if-not-exists
commands:
- node bin/maildev --web 80 --smtp 25 -v --hide-extensions=STARTTLS
detach: true
2021-03-22 15:59:05 +01:00
- name: load dependencies
image: node
2021-09-14 14:45:47 +02:00
pull: if-not-exists
environment:
FORCE_COLOR: "true"
volumes:
- name: cache
path: /cache
commands:
- mkdir -p /cache/node_modules
- mkdir -p /cache/user-cache
- ln -s /cache/node_modules ./node_modules
- ln -s /cache/user-cache ~/.cache
- echo cache=/cache/npm-cache >> .npmrc
- "echo 'enableGlobalCache: false' >> .yarnrc"
- 'echo ''cacheFolder: "/cache/yarn-cache"'' >> .yarnrc'
- 'echo ''yarn-offline-mirror "/cache/npm-packages-offline-cache"'' >> .yarnrc'
- "echo 'yarn-offline-mirror-pruning: true' >> .yarnrc"
- cat .yarnrc
- yarn install --verbose --frozen-lockfile
- name: liveserver
image: node
pull: if-not-exists
volumes:
- name: cache
path: /cache
commands:
- yarn run -- live-server --no-browser --port=80 --ignore='*' --entry-file=spa.html --no-css-inject --proxy=/api:http://wmbasic-api:8080/api/v1/_/__NAMESPACE__ dist
detach: true
- name: wmbasic-api
image: registry.webmakers.de/wmbasic/wmbasic-api
pull: never
environment:
DB_DIAL: mongodb://mongo
API_PORT: 8080
MAIL_HOST: maildev:25
detach: true
- name: cypress run
image: cypress/base
pull: if-not-exists
volumes:
- name: cache
path: /cache
environment:
FORCE_COLOR: "true"
CYPRESS_BASE_URL: http://liveserver
CYPRESS_CI: "true"
CYPRESS_mongodbUri: mongodb://mongo
CYPRESS_wmbasicApiUrl: http://wmbasic-api:8080/api/v1
CYPRESS_projectApiConfig: /drone/workdir/api/config.yml
2021-03-22 15:59:05 +01:00
commands:
2021-09-14 14:45:47 +02:00
- ln -s /cache/user-cache ~/.cache
- yarn build:instanbul
- yarn cy:run
2021-03-22 15:59:05 +01:00
- name: modify master config
image: bash
2021-09-14 14:45:47 +02:00
pull: if-not-exists
2021-03-22 15:59:05 +01:00
commands:
- bash scripts/modify-config.sh master __MASTER_URL__
when:
branch: [master]
- name: modify dev config
image: bash
2021-09-14 14:45:47 +02:00
pull: if-not-exists
2021-03-22 15:59:05 +01:00
commands:
- bash scripts/modify-config.sh dev __DEV_URL__
when:
branch: [dev]
- name: build
image: node
2021-09-14 14:45:47 +02:00
pull: if-not-exists
volumes:
- name: cache
path: /cache
2021-03-22 15:59:05 +01:00
commands:
- yarn build
- name: build ssr
image: node
2021-09-14 14:45:47 +02:00
pull: if-not-exists
volumes:
- name: cache
path: /cache
2021-03-22 15:59:05 +01:00
commands:
- yarn build:server
- name: build legacy
image: node
2021-09-14 14:45:47 +02:00
pull: if-not-exists
volumes:
- name: cache
path: /cache
2021-03-22 15:59:05 +01:00
commands:
- yarn build:legacy
- name: modify html
image: bash
2021-09-14 14:45:47 +02:00
pull: if-not-exists
2021-03-22 15:59:05 +01:00
commands:
- bash scripts/preload-meta.sh public/spa.html
- bash scripts/preload-meta.sh public/spa.html > dist/spa.html
- export stamp=`date +%s`
- echo $$stamp
- sed -i s/__TIMESTAMP__/$$stamp/g dist/spa.html
- sed -i s/__TIMESTAMP__/$$stamp/g dist/serviceworker.js
- cat dist/serviceworker.js
- cp dist/spa.html api/templates/spa.html
- cat dist/spa.html
- name: deploy master
image: instrumentisto/rsync-ssh
2021-09-14 14:45:47 +02:00
pull: if-not-exists
2021-03-22 15:59:05 +01:00
environment:
RSYNC_USER: USER_PROJECT_master
RSYNC_PASS:
from_secret: rsync_master
commands:
2021-09-14 14:45:47 +02:00
- apk add --no-cache sshpass
- scripts/deploy.sh ftp1.webmakers.de $${RSYNC_USER} $${RSYNC_PASS}
2021-03-22 15:59:05 +01:00
when:
branch: [master]
event: [push]
- name: deploy dev
image: instrumentisto/rsync-ssh
2021-09-14 14:45:47 +02:00
pull: if-not-exists
2021-03-22 15:59:05 +01:00
environment:
RSYNC_USER: USER_PROJECT_dev
RSYNC_PASS:
from_secret: rsync_dev
commands:
2021-09-14 14:45:47 +02:00
- apk add --no-cache sshpass
- scripts/deploy.sh ftp1.webmakers.de $${RSYNC_USER} $${RSYNC_PASS}
2021-03-22 15:59:05 +01:00
when:
branch: [dev]
event: [push]
2021-09-14 14:45:47 +02:00
- name: prepare notify
image: cypress/base
pull: if-not-exists
commands:
- find cypress -type f -wholename "cypress/videos/*" -or -wholename "cypress/screenshots/*" | tar -cvf cypress-media.tar -T -
when:
status:
- failure
- name: notify
image: drillster/drone-email
pull: if-not-exists
settings:
from: noreply@ci.gitbase.de
host: smtp.basehosts.de
attachment: cypress-media.tar
when:
status:
- failure
volumes:
- name: cache
host:
path: /tmp/cache/drone/${DRONE_REPO}