Skip to content

[FEATURE] Improve generator's test-project docker testing workflow #1425

Description

@nightknighto

Why do we need this improvement?

There are some issues with the generator's tests test-project for Windows users, simplifications, and improvements that can be made, such as:

  • The documented command script is for Unix only, not Windows users. It is also big and can be simplified.
  • The shell scripts are downloaded automatically from git in CRLF for Windows users, which makes them unusable when mounted into the container unless changed manually.
  • A dockerfile can be introduced which would remove the need for the test-entrypoint.sh, would probably improve performance by replacing the need for mounting.
  • Some of the commands in test.sh could be moved to the dockerfile, but I will leave this to another issue.

How will this change help?

These improvements will:

  • Make the testing possible for Windows users without needing manual intervention.
  • Simplify the testing command.
  • Improve the workflow's performance, maintainability and scalability. (through Dockerfile)

Screenshots

Example of the problem when trying on Windows:

Image

How could it be implemented/designed?

1- Simplify the test command from docker-compose rm -f -s test-project verdaccio && NODE_IMAGE_TAG=18 docker-compose up --abort-on-container-exit --remove-orphans to NODE_IMAGE_TAG=18 docker-compose up --abort-on-container-exit --force-recreate:

  • Replace the first command with a flag --force-recreate.
  • Remove --remove-orphans as this is only needed if we are renaming the docker compose services. Also remove it from the github workflow.

2- Update the README to specify also the Windows version of the command.

3- Fix the line-ending problem of bash scripts. There are 2 approaches:

  • Local approach: copy the scripts inside the Dockerfile.
  • Global approach (recommended): add a .gitattributes file in the root of the project that forces all bash scripts to be downloaded as LF. This will fix the problem project-wide.

4- Add a Dockerfile, .dockerignore and update docker-compose to use it

  • Replace the mounting of the whole project.
  • Directly copy the project into /app. No longer need /apptemp then /app due to removing mounting.
  • Remove test-entrypoint.sh and set up the CMD or the ENTRYPOINT instead.

🚧 Breaking changes

No

👀 Have you checked for similar open issues?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions