I have an app using PHP and ReactJS for the frontend. I have unit tests for the PHP project and e2e for the frontend project. I deploy my project using Jenkins and Docker for the app.
When a developer push on a branch, I'd like to run the tests (unit, e2e) in the CI. If everything is OK, we can deploy the project. I'd like to know the right way to do that ?
Today I am doing these steps :
- one dev pushes the code, the job "test-app" is triggered in jenkins
- the job build the docker image in a "dev" environment, with the dev dependencies in PHP
- the app is started, let's say the url is "tests-app.com"
- the tests are executed (unit, e2e using Selenium and tests-app.com)
- the tests are OK, a job "app-deploy" is triggered and "tests-app.com" is shut down
- the job app-deploy build the docker image in a "prod" environment, without the dev dependencies in PHP
- the app is started the url is now "app.com"
Is that the right way to do that ? From the push by the developer and the end of the Jenkins builds it can take 5-10 minutes.