For some time I wanted to learn a bit about CI/CD. Today I have given a go to Travis.
All this is based on Kirk Byers python course and his git repo.
So I just created an empty repo and started working on it:
$ git clone https://github.com/thomarite/test-ci.git $ cd test-ci $ pyenv local 3.7.3 $ python -m venv virt_env $ source virt_env/bin/active $ python -m pip install pylama $ python -m pip install black $ python -m pip install pytest $ python -m pip install tox $ mkdir tests $ vim tests/test_sample.py def increment(x): return x + 1 def test_answer(): assert increment(4) == 5 $ vim requirements.txt pytest==5.4.3 pylama==7.7.1 black==19.10b0 $ vim .travis.yml language: python python: "3.7" # command to install dependencies install: pip install -r requirements.txt # command to run tests script: pylama . black --check . py.test -s -v tests/
Then you create an account with Travis-ci.org that is “free” and you link up to your repo. As soon as you commit, you will how the tests run and if they are successful.
As I have now a basic setup, I hope I carry on using it to any new python stuff I try.