Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Understand Basic CI Checks | Making and Reviewing Contributions
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Git for Open Source Contributors

bookUnderstand Basic CI Checks

Continuous integration, often abbreviated as CI, is a critical process in open source software development. CI automatically builds and tests your code every time you push changes or submit a pull request. Its main purpose is to catch errors early, ensure new contributions do not break existing features, and maintain a high standard of code quality across the project. For open source projects, CI is especially important because it allows maintainers and contributors from all over the world to collaborate confidently, knowing that automated checks will validate every contribution before it is merged.

When you submit a pull request, CI services like GitHub Actions, Travis CI, or similar tools will run a series of automated tests and checks on your code. These can include unit tests, style checks, and build verifications. If any of these checks fail, your pull request will be marked with errors that you need to address before your changes can be merged.

# Example: Output from a failed CI check
#
# ============================= test session starts ==============================
# platform linux -- Python 3.12.4, pytest-7.1.2, pytest-sugar-0.9.4
# collected 3 items
#
# tests/test_math_utils.py F..                                               [100%]
#
# =================================== FAILURES ===================================
# _________________________ test_addition_with_negative_numbers __________________
# def test_addition_with_negative_numbers():
#     result = add(-2, -3)
# >   assert result == -4
# E   AssertionError: assert -5 == -4
# E    +  where -5 = add(-2, -3)
# 
# tests/test_math_utils.py:12: AssertionError
# 
# =========================== short test summary info ============================
# FAILED tests/test_math_utils.py::test_addition_with_negative_numbers - AssertionError: assert -5 == -4
# ========================= 1 failed, 2 passed in 0.12s ==========================

When you encounter a failed CI check like the one above, you need to carefully read the error messages. The failure summary tells you which test failed, why it failed, and where the failure occurred. In this example, the function add(-2, -3) returned -5, but the test expected -4. This means either the test expectation is wrong, or the code in the add function has a bug.

To fix CI failures in your pull request, follow these steps:

  1. Review the CI logs to identify which tests or checks failed;
  2. Read the error messages and locate the relevant files and lines of code;
  3. Update your code or tests to fix the issues;
  4. Commit and push your changes to the same branch of your pull request;
  5. Wait for CI to re-run automatically and check if all tests now pass.

If you are unsure about the failure, reach out to the project maintainers or ask for help in the project's discussion channels. Consistently passing CI checks is a sign of a healthy contribution and shows that your changes are ready for review and merging.

question mark

What is the main role of continuous integration (CI) in open source projects?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 4

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

bookUnderstand Basic CI Checks

Swipe to show menu

Continuous integration, often abbreviated as CI, is a critical process in open source software development. CI automatically builds and tests your code every time you push changes or submit a pull request. Its main purpose is to catch errors early, ensure new contributions do not break existing features, and maintain a high standard of code quality across the project. For open source projects, CI is especially important because it allows maintainers and contributors from all over the world to collaborate confidently, knowing that automated checks will validate every contribution before it is merged.

When you submit a pull request, CI services like GitHub Actions, Travis CI, or similar tools will run a series of automated tests and checks on your code. These can include unit tests, style checks, and build verifications. If any of these checks fail, your pull request will be marked with errors that you need to address before your changes can be merged.

# Example: Output from a failed CI check
#
# ============================= test session starts ==============================
# platform linux -- Python 3.12.4, pytest-7.1.2, pytest-sugar-0.9.4
# collected 3 items
#
# tests/test_math_utils.py F..                                               [100%]
#
# =================================== FAILURES ===================================
# _________________________ test_addition_with_negative_numbers __________________
# def test_addition_with_negative_numbers():
#     result = add(-2, -3)
# >   assert result == -4
# E   AssertionError: assert -5 == -4
# E    +  where -5 = add(-2, -3)
# 
# tests/test_math_utils.py:12: AssertionError
# 
# =========================== short test summary info ============================
# FAILED tests/test_math_utils.py::test_addition_with_negative_numbers - AssertionError: assert -5 == -4
# ========================= 1 failed, 2 passed in 0.12s ==========================

When you encounter a failed CI check like the one above, you need to carefully read the error messages. The failure summary tells you which test failed, why it failed, and where the failure occurred. In this example, the function add(-2, -3) returned -5, but the test expected -4. This means either the test expectation is wrong, or the code in the add function has a bug.

To fix CI failures in your pull request, follow these steps:

  1. Review the CI logs to identify which tests or checks failed;
  2. Read the error messages and locate the relevant files and lines of code;
  3. Update your code or tests to fix the issues;
  4. Commit and push your changes to the same branch of your pull request;
  5. Wait for CI to re-run automatically and check if all tests now pass.

If you are unsure about the failure, reach out to the project maintainers or ask for help in the project's discussion channels. Consistently passing CI checks is a sign of a healthy contribution and shows that your changes are ready for review and merging.

question mark

What is the main role of continuous integration (CI) in open source projects?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 4
some-alt