I have succesfully installed and configured gitlab and gitlab-ci-multirunners. What i want to do now is configure the .gitlab-ci.yml file so that it runs python manage.py test
and succeed if the tests pass and fail otherwise.
What would be the best approach to achieve this?
test_app:
script: python manage.py test
Something like the above should do it. Note, the exit code of the script
command determines if the build passes or fails. If you need multiple lines of shell scripts you can use a yaml list:
test_app:
script:
- python dosetup.py
- python manage.py test
test_app
is the name of the build job while the script
property defines the shell commands to run for the given build job. When using multiple script lines, each line is run as a separate command. If any of the lines return exit code != 0 the build will fail.
By default a build job in .gitlab-ci.yml
runs as test. If you need multiple types of build steps you can define them as such:
types:
- build
- test
build_app:
type: build
script: echo Building!
test_app:
type: test
script: python manage.py test
More info in the official documentation: https://docs.gitlab.com/ce/ci/yaml/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With