You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

3.0 KiB

Development Guide

Docker local development setup

You should have docker installed in your system, if not click here.

  1. Go to diagrams root directory.

  2. Build the docker image.

    docker build --tag diagrams:1.0 -f ./docker/dev/Dockerfile .
    
  3. Create the container, run in background and mount the project source code.

    docker run -d \
    -it \
    --name diagrams \
    --mount type=bind,source="$(pwd)",target=/usr/src/diagrams \
    diagrams:1.0
    
  4. Run unit tests in the host using the container to confirm that it’s working.

    docker exec diagrams python -m unittest tests/*.py -v
    
  5. Run the bash script autogen.sh to test.

    docker exec diagrams ./autogen.sh
    
  6. If the unit tests and the bash script autogen.sh is working correctly, then your system is now ready for development.

Mac local development setup

To be able to develop and run diagrams locally on you Mac device, you should have Python, Go, and brew installed on your system.

  1. Go to diagrams root directory.

  2. Install poetry, the Python project management package used by diagrams.

    pip install poetry
    
  3. Install the project’s Python dependencies.

    poetry install
    
  4. Install diagrams binary dependencies.

    brew install imagemagick inkscape black
    go get github.com/mingrammer/round
    
  5. Run unit tests to confirm that it’s working.

    python -m unittest tests/*.py -v
    
  6. Run the bash script autogen.sh to test.

    ./autogen.sh
    
  7. If the unit tests and the bash script autogen.sh is working correctly, then your system is now ready for development.

Windows local development setup

  1. Go to diagrams root directory.

  2. Modify the Dockerfile when install fonts

    # Install fonts
    RUN curl -O https://noto-website.storage.googleapis.com/pkgs/NotoSansCJKjp-hinted.zip \
    & mkdir -p /usr/share/fonts/NotoSansCJKjp \
    & unzip NotoSansCJKjp-hinted.zip -d /usr/share/fonts/NotoSansCJKjp/ \
    & rm NotoSansCJKjp-hinted.zip \
    & fc-cache -fv
    
  3. Build the docker image.

    docker build --tag diagrams:1.0 -f ./docker/dev/Dockerfile .
    
  4. Run the docker-compose file to create the container, run in background and mount the project source code.

    docker-compose up -d
    
  5. Run unit tests in the host using the container to confirm that it’s working.

    docker exec -it diagrams bash
    
    python -m unittest tests/*.py -v
    
  6. Run the bash script autogen.sh to test.

    docker exec diagrams ./autogen.sh
    
  7. If the unit tests and the bash script autogen.sh is working correctly, then your system is now ready for development.

  8. If you use Windows change CRLF to LF in the autogen.sh file.