You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/testing-and-ci.rst
+56-35
Original file line number
Diff line number
Diff line change
@@ -258,67 +258,88 @@ Time to celebrate with the API :)
258
258
Continuous integration with CircleCI
259
259
---------------------------------------
260
260
261
-
Maintaining a solid rapport with the ongoing software development process always turns out to be a walk on air. Ensuring a software build integrity and quality in every single commit makes it much more exciting.
261
+
We have the tests, but we also want it to run on every commit. If you are using Github, CircleCI provides a very well in integrated servive to run you tests. We will use Circleci. v2
262
262
263
-
If the current software bulid is constantly available for testing, demo or release isn't it a developer's paradise on earth?
264
-
Giving a cold shoulder to "Integration hell" the 'Continuous integration' process stands out to deliver all the above assets.
263
+
We can configure our application to use Circle CI by adding a file named :code:`.circleci/circle.yml` which is a YAML(a human-readable data serialization format) text file. It automatically detects when a commit has been made and pushed to a Github repository that is using CircleCI, and each time this happens, it will try to build the project and runs tests. The build failure or success is notified to the developer.
265
264
266
-
Let us use circle CI software for our App.
267
-
268
-
We can configure our application to use Circle CI by adding a file named circle.yml which is a YAML(a human-readable data serialization format) text file. It automatically detects when a commit has been made and pushed to a GitHub repository that is using Circle CI, and each time this happens, it will try to build the project and runs tests. It also builds and once it is completed it notifies the developer in the way it is configured.
269
-
270
-
Steps to use Circle CI:
265
+
Setting up CircleCI
266
+
---------------------------------------
271
267
272
268
- Sign-in: To get started with Circle CI we can sign-in with our github account on circleci.com.
273
269
- Activate Github webhook: Once the Signup process gets completed we need to enable the service hook in the github profile page.
274
270
- Add circle.yml: We should add the yml file to the project.
275
271
276
272
Writing circle.yml file
277
273
------------------------
278
-
In order for circle CI to build our project we need to tell the system a little bit about it. we will be needed to add a file named circle.yml to the root of our repository. The basic options in the circle.yml should contain are language key which tells which language environment to select for our project and other options include the version of the language and command to run the tests, etc.
279
274
280
-
Below are the keywords that are used in writting circle.yml file.
275
+
In order for circle CI to build our project we need to tell the system a little bit about it. we will be needed to add a file named :code:`.circleci/config.yml` to the root of our repository. We also need to create a :code:`pollsapi/requirements.txt` to define our dependencies.
281
276
282
-
- machine: adjusting the VM to your preferences and requirements
283
-
- checkout: checking out and cloning your git repo
284
-
- dependencies: setting up your project's language-specific dependencies
285
-
- database: preparing the databases for your tests
286
-
- test: running your tests
287
-
- deployment: deploying your code to your web servers
277
+
Add this to your :code:`pollsapi/requirements.txt`
288
278
279
+
.. code-block:: txt
289
280
290
-
- pre: commands run before CircleCI's inferred commands
291
-
- override: commands run instead of CircleCI's inferred commands
292
-
- post: commands run after CircleCI's inferred commands
From now onwards whenever we push our code to our repository a new build will be created for it and the running of the test cases will be taken place. It gives us the potential to check how good our development process is taking place with out hitting a failed test case.
328
+
- store_artifacts:
329
+
path: test-reports
330
+
destination: test-reports
318
331
332
+
Below are the important keywords that are used in writting circle.yml file.
319
333
334
+
- :code:`image`: Defines the base image including the language and version to use
335
+
- :code:`run`: It specifies a :code:`command` which will be run to setup environent and run tests. :code:`pip install -r pollsapi/requirements.txt` sets up the environment and :code:`pip install -r pollsapi/requirements.txt`
320
336
337
+
If everything passed successfully, you should see a green checkmark
321
338
339
+
.. image:: circleci.png
322
340
341
+
Congratulations, you have tests running in a CI environment.
323
342
343
+
From now onwards whenever we push our code to our repository a new build will be created for it and the tests will run.
324
344
345
+
We are at the end of the first part of our book. You can read the appendix, which tell about some documentation tools and api consumption tools. Go forward and build some amazing apps and apis.
0 commit comments