קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אינטגרציה רציפה (CI) היא שיטה לפיתוח תוכנה שבה המפתחים מיזגים לעיתים קרובות את שינויי הקוד שלהם במאגר מרכזי, ולאחר מכן מריצים גרסאות build ובדיקות אוטומטיות.
אפשר להגדיר מערכת CI בסיסית כדי למנוע שינויים חדשים שיכולים לשבור את ה-build אחרי המיזוג. אפשר לתכנת מערכת CI מתקדמת יותר כדי לבדוק את האפליקציה באופן אוטומטי ולוודא שהיא פועלת כצפוי בסביבות שונות, כמו רמות API, גדלי מסך ופלטפורמות.
איור 1. מערכת CI שומרת על תקינות של מאגר הקוד על ידי הפעלת בדיקות לפני המיזוג.
במסמך הזה נסביר על אסטרטגיות נפוצות שמפתחים משתמשים בהן כדי להגדיר מערכות CI יעילות לפרויקטים של Android. ההנחיות האלה הן כלליות וחלות על רוב הפתרונות.
דוגמה אופיינית
מערכת CI אופיינית פועלת לפי תהליך עבודה או צינור עיבוד נתונים, שעשויים להיראות כך:
מערכת ה-CI מזהה שינוי בקוד, בדרך כלל כשמפתח יוצר בקשת משיכה (pull request), שנקראת גם 'רשימת שינויים' או 'בקשת מיזוג'.
הוא מקצה ומאתחלת שרת להרצת תהליך העבודה.
הוא מאחזר את הקוד וגם כלים כמו Android SDK או קובצי אימג' של אמולטור, לפי הצורך.
הוא יוצר את הפרויקט על ידי הפעלת פקודה נתונה, למשל ./gradlew
build.
הוא מפעיל את הבדיקות המקומיות על ידי הרצת פקודה מסוימת, למשל הרצת /gradlew test.
שיפור איכות התוכנה: CI יכול לעזור בשיפור איכות התוכנה על ידי זיהוי ופתרון בעיות בשלב מוקדם. כך תוכלו לצמצם את מספר הבאגים במהדורות התוכנה ולשפר את חוויית המשתמש הכוללת.
הפחתת הסיכון ל-builds שבורים: כשמפעילים אוטומציה של תהליך ה-build באמצעות CI, אפשר למנוע build שבור על ידי פתרון בעיות בשלב מוקדם יותר בתהליך.
ביטחון מוגבר בגרסאות: CI יכול לעזור לוודא שכל גרסה יציבה ומוכנה לייצור. הרצת בדיקות אוטומטיות מאפשרת ל-CI לזהות בעיות פוטנציאליות לפני שמפיצים אותן לציבור.
שיפור התקשורת והשיתוף פעולה: CI מספק מקום מרכזי שבו מפתחים יכולים לשתף קוד ותוצאות בדיקות, וכך עוזר למפתחים ולחברים אחרים בצוות לעבוד יחד ולעקוב אחרי ההתקדמות בקלות רבה יותר.
שיפור הפרודוקטיביות: CI יכול לעזור לשפר את הפרודוקטיביות של המפתחים על ידי אוטומציה של משימות שעלולות להיות זמן רב ומועדות לשגיאות.
מקורות מידע נוספים
למידע נוסף על השימוש בשילוב קבוע כדי לשפר את הפיתוח של האפליקציה, אפשר לעיין בדפים הבאים:
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-07-27 (שעון UTC)."],[],[],null,["# Continuous Integration basics\n\nContinuous Integration (CI) is a software development practice where developers\nfrequently merge their code changes into a central repository, after which\nautomated builds and tests run.\n\nYou can set up a basic CI system to prevent new changes that would break the\nbuild after merging in. You can program a more advanced CI system to\nautomatically test the app and make sure it behaves as expected in different\nenvironments, such as API levels, screen sizes, and platforms.\n**Figure 1.** A CI system keeps a code repository healthy by running checks before merging.\n\nThis document demonstrates common strategies developers use to set up effective\nCI systems for Android projects. These guidelines are generic and apply to the\nmajority of solutions.\n\nTypical example\n---------------\n\nA typical CI system follows a *workflow* or *pipeline*, which might look as\nfollows:\n\n1. The CI system detects a change in the code, usually when a developer creates a pull request, also called \"change list\" or \"merge request\".\n2. It provisions and initializes a server to run the workflow.\n3. It fetches the code as well as tools such as the Android SDK or emulator images if needed.\n4. It builds the project by running a given command, for example .`/gradlew\n build`.\n5. It runs the [local tests](/training/testing/local-tests) by running a given command, for example running .`/gradlew test`.\n6. It starts emulators and runs the [instrumented tests](/training/testing/instrumented-tests).\n7. It uploads artifacts such as test results and APKs.\n\n**Figure 2.** A basic CI workflow\n\nBenefits of CI\n--------------\n\nThe advantages of CI include:\n\n- **Improved quality of software**: CI can help to improve the quality of software by identifying and fixing problems early on. This can help to reduce the number of bugs in software releases and improve the overall user experience.\n- **Reduced risk of broken builds**: When you automate your build process with CI you can better avoid broken builds by resolving issues earlier in the process.\n- **Increased confidence in releases**: CI can help to ensure that each release is stable and ready for production. By running automated tests, CI can identify any potential problems before you release them to the public.\n- **Improved communication and collaboration**: By providing a central place for developers to share code and test results, CI can help to make it easier for developers and other team members to work together and track progress.\n- **Increased productivity**: CI can help to increase developer productivity by automating tasks that would otherwise be time-consuming and error-prone.\n\nFurther reading\n---------------\n\nMore more information on how you can use constant integration to improve\ndevelopment for your app, read the following pages:\n\n- **[CI Automation](/training/testing/continuous-integration/automation)**\n\n- **[CI Features](/training/testing/continuous-integration/features)**"]]