Skip to content

Commit

Permalink
feat(puml): change from local puml rendering to
Browse files Browse the repository at this point in the history
  server based approach, with a local docker puml server

feat(puml): working on deterministic .svg rendering

feat(puml): working on deterministic .svg rendering

feat(puml): pretty print svgs for better git diffing

feat(puml): rerender some svgs, see if better diffing

feat(puml): add file count to echo comment

feat(puml): add file count to echo comment

feat(puml): make build all build just 1 for debugging

feat(puml): add graphviz, does this fix rendering?

feat(puml): going crazy trying to fix empty diagrams!

feat(puml): using server renderer

feat(puml): using server renderer

feat(puml): update test diagram

feat(puml): update render all

feat(puml): add http error handling

feat(puml): improve error messages

feat(puml): checking final rendering

feat(puml): testing deterministic rendering

feat(puml): add docker run steps

feat(puml): changes for docker puml

feat(ci/cd): update svg check to use docker

feat(ci/cd): update svg check to use docker

feat(puml): add docker run steps

fix(puml): wrong url is parsed by ci/cd

feat(puml): cleanup url, make notes about svg determinism
  • Loading branch information
lewisdaly committed Dec 8, 2020
1 parent 2f4edf5 commit 00608a4
Show file tree
Hide file tree
Showing 103 changed files with 53,211 additions and 16,199 deletions.
91 changes: 55 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# CircleCI v2 Config
version: 2

defaults_working_directory: &defaults_working_directory
working_directory: /home/circleci/project

defaults_docker_node: &defaults_docker_node
docker:
- image: node:10.15-alpine

# CircleCI v2.1 Config
version: 2.1

##
# orbs
#
# Orbs used in this pipeline
##
orbs:
slack: circleci/slack@3.4.2

##
# defaults
#
# YAML defaults templates, in alphabetical order
##
defaults_Dependencies: &defaults_Dependencies
name: Install default dependencies
command: |
apk --no-cache add git
apk --no-cache add ca-certificates
apk --no-cache add curl
apk --no-cache add openssh-client
# for node 10.15-alpine, need to install from edge repo
apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
apk add --no-cache -t build-dependencies make gcc g++ python libtool autoconf automake
npm config set unsafe-perm true
npm install -g gitbook-cli
defaults_Environment: &defaults_environment
name: Set default environment
command: |
echo "Nothing to do here right now...move along!"
defaults_slack_announcement: &defaults_slack_announcement
name: Slack announcement for tag releases
Expand Down Expand Up @@ -77,17 +77,33 @@ defaults_publish_to_gh_pages: &defaults_publish_to_gh_pages
echo "Publishing $GITHUB_TAG release to $GITBOOK_TARGET_BRANCH on github..."
git push -q $GITHUB_PROJECT_USERNAME $GITBOOK_TARGET_BRANCH &> git.log
##
# Executors
#
# CircleCI Executors
##
executors:
default-docker:
working_directory: /home/circleci/project
docker:
- image: node:12.16.1-alpine

default-machine:
machine:
image: ubuntu-1604:201903-01

##
# Jobs
#
# A map of CircleCI jobs
##
jobs:
setup:
<<: *defaults_working_directory
<<: *defaults_docker_node
executor: default-docker
steps:
- checkout
- run:
<<: *defaults_Dependencies
- run:
<<: *defaults_environment
- run:
name: Access npm folder as root
command: cd $(npm root -g)/npm
Expand All @@ -103,14 +119,11 @@ jobs:
- node_modules

build:
<<: *defaults_working_directory
<<: *defaults_docker_node
executor: default-docker
steps:
- checkout
- run:
<<: *defaults_Dependencies
- run:
<<: *defaults_environment
- run:
name: Installing build dependencies
command: |
Expand All @@ -136,37 +149,38 @@ jobs:
- _book

test-svg:
<<: *defaults_working_directory
<<: *defaults_docker_node
executor: default-machine
steps:
- checkout
- run:
<<: *defaults_Dependencies
- restore_cache:
keys:
- dependency-cache-{{ .Revision }}
name: Set up NVM
command: |
echo ${NVM_DIR}
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install v12.16.1
nvm alias default v12.16.1
node --version
npm install
- run:
name: Check if plantuml has been updated correctly
command: |
set +o pipefail
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
npm run build:plantuml:all
FILE_COUNT=$(git diff --name-only | grep .svg | wc -l)
if [ ${FILE_COUNT} -ne "0" ]; then
echo 'Plantuml files are out of sync. Please run npm run build:plantuml and try again.';
echo "${FILE_COUNT} plantuml files are out of sync. Please run npm run build:plantuml and try again.";
exit 1;
else
echo 'Plantuml files are up to date';
fi
deploy:
<<: *defaults_working_directory
<<: *defaults_docker_node
executor: default-docker
steps:
- checkout
- run:
<<: *defaults_Dependencies
- run:
<<: *defaults_environment
- run:
name: setup environment vars
command: |
Expand All @@ -187,6 +201,11 @@ jobs:
- run:
<<: *defaults_slack_announcement

##
# Workflows
#
# CircleCI Workflow config
##
workflows:
version: 2
build_and_test:
Expand Down
5 changes: 5 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ We use a git commit hook to automatically rebuild `.svg` files from plantuml
sources. The magic of git hooks means that no extra work is required by you
after creating or editing a `.puml` file

Behind the scenes, this hook spins up a docker container to run the PUML server
and calls `./scripts/_render_svg.js` for each file that has changed. We use the
docker version instead of the public puml server to (1) get around rate limits, and
(2) ensure deterministic SVG output that is git diffable.

### Creating a new PUML

1. Create a new `*.puml/plantuml` file
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


# hmm... maybe we need to dig more into plantuml for this shit
java -Dplantuml.include.path=./ -Djava.awt.headless=true -jar ./node_modules/node-plantuml/vendor/plantuml.jar


BASE=mojaloop-technical-overview/transaction-requests-service/assets/diagrams/sequence/seq-trx-req-authorizations-3.0.0
./node_modules/.bin/puml generate -s ${BASE}.plantuml -o ${BASE}.svg -i ${BASE}.plantuml
cat ${BASE}.svg
ls ${BASE}.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,324 changes: 1,009 additions & 315 deletions ...bulk-transfers/assets/diagrams/sequence/seq-bulk-1.1.1-bulk-prepare-handler.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,430 changes: 1,092 additions & 338 deletions ...ral-bulk-transfers/assets/diagrams/sequence/seq-bulk-1.3.1-position-prepare.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,567 changes: 1,975 additions & 592 deletions ...bulk-transfers/assets/diagrams/sequence/seq-bulk-2.2.2-fulfil-handler-abort.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,693 changes: 1,297 additions & 396 deletions ...ntral-bulk-transfers/assets/diagrams/sequence/seq-bulk-2.3.2-position-abort.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,739 changes: 1,340 additions & 399 deletions ...tral-bulk-transfers/assets/diagrams/sequence/seq-bulk-3.1.1-timeout-handler.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 00608a4

Please sign in to comment.