It’s time to find out what Travis CI is.

  ci, php, travis-ci

clipboard.png

My life’s articles will be put here, my blog, I hope every line of code, every paragraph of text can help you.https://github.com/CrazyCodes …

Preface

First of all, I wish you all a happy New Year, smooth work, successful career and no bugs.

Some friends have been wondering what Travis CI is. After searching on the Internet, the answer is automatic test and release. The term automatic xx seems to be very popular. this is also part of DevOps. what? What is DevOps? We will talk about this in the next chapter.

First, let’s explain the word “automatic”. As the name implies, automatic completion of some things. The above-mentioned automatic test is not a human flesh test in your cognition, but a test through our own rules, such as running all tests in tests. Automatic release is also to release existing projects into the production environment or pre-release environment through scripts.

All things are difficult in the beginning, let’s only play simple.

Use

TravisCi does not need to install any software to play, its website ishttps://travis-ci.org/, you can choose to log in to GitHub.

clipboard.png

Then we can build a github library, just call it travis_ci_test, and use it at will. Then click Project Managementhttps://travis-ci.org/account …, will list all your GitHub libraries

clipboard.png

Add libraries to TravisCi by clicking the radio button. After the addition is completed, it is not finished. At this time, we should carefully look at how to write the scripts for automatic testing, integration and release.

Configuration file

TravisCi has prepared excellent configuration files for us. You can do whatever you want in the configuration files, such as opening a directory and executing a command. He is very similar to a dockerfile file or a shell script. It’s just that the running container is on travisCi, not your own.

Development documentation:https://docs.travis-ci.com/us …

clipboard.png

From a simple start, create a file. travis.yml in the root directory. The following are the specific configuration items

language: php
 php:
 - 7.1
 before_script:
 - composer install

Yes, the five elements configuration is enough, then we will return tohttps://travis-ci.com/dashboard, click trigger a build.

clipboard.png

Click on the current project to see the details.https://travis-ci.org/CrazyCo …

clipboard.png

TravisCi did a few simple things.

  1. Boot
  2. Clone your GITHUB project
  3. composer install
  4. phpunit

If you pass the test, you will see success. If you fail, you will see error. Let’s look at what’s on this detail page.

clipboard.png

The above figure shows the following points

  • Branch name
  • Submit version
  • execution time
  • Submission time
  • Development language
  • Author name
  • Wait ….

The following is the command line to run. I still need to study the specific configuration files myself. I hope I’ve got a good start.

Reflections

When you understand Travis CI, you will feel what an excellent product it is. Programmers are required to write good code, and these products are expanded. As a good programmer, you can actually do this

  • Write test cases
  • Realize business
  • Submission branch (TravisCi automatically detects and tests submissions)
  • Automatic deployment
  • End task

It seems very complicated, why don’t you give it a try?

Thank you

Thank you for seeing here. I hope this article can help you. Thank you