diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcfde75..0636ebf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,7 @@ jobs: docker compose -f tests/ymls/networks/docker-compose.yml config -q docker compose -f tests/ymls/ports/docker-compose.yml config -q docker compose -f tests/ymls/volumes/docker-compose.yml config -q + docker compose -f examples/full-stack-node-app/docker-compose.yml config -q - name: Setup Python 3.10.4 uses: actions/setup-python@v3 diff --git a/.gitignore b/.gitignore index 5d7a886..14acc5b 100644 --- a/.gitignore +++ b/.gitignore @@ -159,3 +159,5 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +*.png diff --git a/examples/full-stack-node-app/docker-compose.yml b/examples/full-stack-node-app/docker-compose.yml new file mode 100644 index 0000000..c3602de --- /dev/null +++ b/examples/full-stack-node-app/docker-compose.yml @@ -0,0 +1,59 @@ +version: "3.9" + +services: + node: + build: + context: . + dockerfile: Dockerfile.node + + api: + image: "awesome/api" + extends: + service: node + build: + args: + PACKAGE_PATH: api + WORKING_DIR: /usr/src/ + expose: + - 8000 + ports: + - 8000:8000 + environment: + - NODE_ENV=development + volumes: + - ./api:/usr/src + depends_on: + - postgres + - adminer + command: ["npm", "start"] + + frontend: + extends: + service: node + build: + args: + PACKAGE_PATH: frontend + WORKING_DIR: /usr/src/ + expose: + - 3000 + ports: + - 3000:3000 + environment: + - REACT_APP_ENV=development + - BACKEND=api:8000 + - HTTPS=true + - NODE_PATH=/usr/src/ + volumes: + - ./frontend:/usr/src + depends_on: + - api + command: ["npm", "start"] + + postgres: + image: postgres + restart: always + + adminer: + image: adminer + ports: + - 8080:8080 diff --git a/tests/test_cli.py b/tests/test_cli.py index 5b1ae39..7c28d72 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -11,17 +11,19 @@ runner = CliRunner() @pytest.mark.parametrize( "test_file_path", [ - "builds/docker-compose", - "depends_on/docker-compose", - "extends/docker-compose", - "links/docker-compose", - "networks/docker-compose", - "ports/docker-compose", - "volumes/docker-compose", + "tests/ymls/builds/docker-compose.yml", + "tests/ymls/depends_on/docker-compose.yml", + "tests/ymls/extends/docker-compose.yml", + "tests/ymls/links/docker-compose.yml", + "tests/ymls/networks/docker-compose.yml", + "tests/ymls/others/docker-compose.yml", + "tests/ymls/ports/docker-compose.yml", + "tests/ymls/volumes/docker-compose.yml", + "examples/full-stack-node-app/docker-compose.yml", ], ) def test_cli(test_file_path: str) -> None: - input_path = f"tests/ymls/{test_file_path}.yml" + input_path = f"{test_file_path}" output_path = "compose-viz-test.png" result = runner.invoke(cli.app, ["-o", output_path, input_path]) diff --git a/tests/ymls/builds/docker-compose.yml b/tests/ymls/builds/docker-compose.yml index e55248f..322a355 100644 --- a/tests/ymls/builds/docker-compose.yml +++ b/tests/ymls/builds/docker-compose.yml @@ -9,4 +9,4 @@ services: image: awesome/backend build: context: backend - dockerfile: ../backend.Dockerfile \ No newline at end of file + dockerfile: ../backend.Dockerfile diff --git a/tests/ymls/extends/docker-compose.yml b/tests/ymls/extends/docker-compose.yml index 149b396..caf2a1e 100644 --- a/tests/ymls/extends/docker-compose.yml +++ b/tests/ymls/extends/docker-compose.yml @@ -11,4 +11,4 @@ services: derive_from_file: extends: file: web.yml - service: web \ No newline at end of file + service: web diff --git a/tests/ymls/extends/web.yml b/tests/ymls/extends/web.yml index 1452125..1676371 100644 --- a/tests/ymls/extends/web.yml +++ b/tests/ymls/extends/web.yml @@ -2,4 +2,4 @@ version: "3.9" services: web: - image: awesome/web \ No newline at end of file + image: awesome/web diff --git a/tests/ymls/links/docker-compose.yml b/tests/ymls/links/docker-compose.yml index 56fcc07..cac78e9 100644 --- a/tests/ymls/links/docker-compose.yml +++ b/tests/ymls/links/docker-compose.yml @@ -6,4 +6,4 @@ services: links: - "db:database" db: - image: mysql \ No newline at end of file + image: mysql