Commit 4f5601c3 authored by Florent Chehab's avatar Florent Chehab
Browse files

Merge branch 'fix_doc_uml' into 'master'

Fix doc uml

Closes #16

See merge request !49
parents 1237854b 80dc3633
...@@ -2,6 +2,7 @@ stages: ...@@ -2,6 +2,7 @@ stages:
- check - check
- test - test
- lint - lint
- svg-gen-docu # required to be done before documentation and in separate stages
- documentation - documentation
variables: variables:
...@@ -22,8 +23,12 @@ check_back: ...@@ -22,8 +23,12 @@ check_back:
services: services:
- postgres:10.5 - postgres:10.5
script: script:
- cd backend - cd backend && ./manage.py check
- ./manage.py check - cd ../documentation && make extract_django # Try to generate .dot files for the system architecture
artifacts:
paths:
- documentation/generated/
expire_in: 1 hour
tags: tags:
- docker - docker
...@@ -51,7 +56,7 @@ test_back: ...@@ -51,7 +56,7 @@ test_back:
artifacts: artifacts:
paths: paths:
- backend/htmlcov/ - backend/htmlcov/
expire_in: 1 month expire_in: 1 hour
tags: tags:
- docker - docker
...@@ -76,15 +81,30 @@ eslint: ...@@ -76,15 +81,30 @@ eslint:
tags: tags:
- docker - docker
generate_UML_svg:
stage: svg-gen-docu
image: floawfloaw/plantuml
script: cd documentation && make convert_to_svg
dependencies:
- check_back
artifacts:
paths:
- documentation/generated/
expire_in: 1 hour
only:
- master
tags:
- docker
pages: pages:
stage: documentation stage: documentation
image: floawfloaw/plantuml image: floawfloaw/plantuml
dependencies: dependencies:
- test_back - test_back
- generate_UML_svg
script: script:
- mkdir .public - mkdir .public
- mv backend/htmlcov/ .public/coverage - mv backend/htmlcov/ .public/coverage
- make documentation
- mv documentation/ .public/documentation - mv documentation/ .public/documentation
- mv .public public - mv .public public
artifacts: artifacts:
......
...@@ -33,8 +33,10 @@ shell_frontend: ...@@ -33,8 +33,10 @@ shell_frontend:
django_shell: django_shell:
docker-compose exec backend sh -c "cd backend && ./manage.py shell" docker-compose exec backend sh -c "cd backend && ./manage.py shell"
# Create or update UML diagrams for the documentation
documentation: documentation:
cd documentation && $(MAKE) all docker-compose exec backend bash -c "cd documentation && make extract_django"
docker-compose exec gen_doc_uml bash -c "cd /usr/src/app/documentation && make convert_to_svg"
documentation_clean: documentation_clean:
cd documentation && $(MAKE) clean docker-compose exec backend bash -c "cd documentation && make clean"
...@@ -69,6 +69,13 @@ services: ...@@ -69,6 +69,13 @@ services:
ports: ports:
# replicate the server port # replicate the server port
- "5000:5000" - "5000:5000"
gen_doc_uml: # service to generate the UML of the backend
image: floawfloaw/plantuml
volumes:
- .:/usr/src/app
command: tail -F anything # keep the container alive
volumes: volumes:
# Create some local volume (should be stored in some directory on your computer) # Create some local volume (should be stored in some directory on your computer)
......
all: init:
mkdir -p generated mkdir -p generated
../manage.py graph_models backend --disable-fields -g \
| tail -n +2 > generated/architecture.dot extract_django: init
dot -Tsvg generated/architecture.dot -o generated/architecture.svg ../backend/manage.py graph_models backend_app --disable-fields -g \
> generated/architecture.dot
../manage.py graph_models backend --disable-abstract-fields -g -I \ ../backend/manage.py graph_models backend_app --disable-abstract-fields -g -I \
MyModel,MyModelVersionned,BasicModule,Scholarship,UserRestrictedModule \ MyModel,MyModelVersionned,BasicModule,Scholarship,UserRestrictedModule \
| tail -n +2 > generated/abstract.dot > generated/abstract.dot
dot -Tsvg generated/abstract.dot -o generated/abstract.svg
../manage.py graph_models backend --disable-abstract-fields -g -I \ ../backend/manage.py graph_models backend_app --disable-abstract-fields -g -I \
Specialty,Offer,Semester,Department,University \ Specialty,Offer,Semester,Department,University \
| tail -n +2 > generated/core.dot > generated/core.dot
dot -Tsvg generated/core.dot -o generated/core.svg
../manage.py graph_models backend --disable-abstract-fields -g -I \ ../backend/manage.py graph_models backend_app --disable-abstract-fields -g -I \
University,UniversityScholarship,UniversityInfo,UniversitySemestersDates,UniversityTaggedItems,UniversityDri,Campus,CampusTaggedItems \ University,UniversityScholarship,UniversityInfo,UniversitySemestersDates,UniversityTaggedItems,UniversityDri,Campus,CampusTaggedItems \
| tail -n +2 > generated/university.dot > generated/university.dot
dot -Tsvg generated/university.dot -o generated/university.svg
../manage.py graph_models backend --disable-abstract-fields -g -I \ ../backend/manage.py graph_models backend_app --disable-abstract-fields -g -I \
Country,City,CountryTaggedItems,CityTaggedItems,CountryScholarship,CountryDri\ Country,City,CountryTaggedItems,CityTaggedItems,CountryScholarship,CountryDri\
| tail -n +2 > generated/location.dot > generated/location.dot
dot -Tsvg generated/location.dot -o generated/location.svg
../manage.py graph_models backend --disable-abstract-fields -g -I \ ../backend/manage.py graph_models backend_app --disable-abstract-fields -g -I \
RecommendationsList,Recommendation,UserData,PreviousDeparture,PreviousDepartureFeedback,Semester,University,Sepcialty\ RecommendationsList,Recommendation,UserData,PreviousDeparture,PreviousDepartureFeedback,Semester,University,Sepcialty\
| tail -n +2 > generated/user.dot > generated/user.dot
convert_to_svg: init
dot -Tsvg generated/architecture.dot -o generated/architecture.svg
dot -Tsvg generated/abstract.dot -o generated/abstract.svg
dot -Tsvg generated/core.dot -o generated/core.svg
dot -Tsvg generated/university.dot -o generated/university.svg
dot -Tsvg generated/location.dot -o generated/location.svg
dot -Tsvg generated/user.dot -o generated/user.svg dot -Tsvg generated/user.dot -o generated/user.svg
.PHONY: clean
.PHONY: clean
clean: clean:
rm -rf generated/ rm -rf generated/
...@@ -15,6 +15,7 @@ The source of the documentation is available in the `documentation` folder from ...@@ -15,6 +15,7 @@ The source of the documentation is available in the `documentation` folder from
The documentation is automatically rendered locally when you run the `make up` command. It is then available on [http://localhost:5000](http://localhost:5000). The documentation is automatically rendered locally when you run the `make up` command. It is then available on [http://localhost:5000](http://localhost:5000).
To generate or update the UML diagrams, you need to run the command (from the root of the repository): `make documentation`.
## Issues ? ## Issues ?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment