Automation makes a developer’s life so much easier. One benefit of automation is that it removes some of the capacity for human errors. When your build script records all the steps for distribution, you’re much less likely to archive the app on the wrong Git branch or with the wrong build configuration.
So far, the automation you’ve explored is great for your own personal use. But working as a team, while filled with benefits, comes with its own set of problems.
In a team, coordinating work between developers can be as much work as the programming itself. Combining, or integrating, the work of each developer is a challenge.
Continuous integration (CI) is the development practice of integrating the team’s work early and often.
Rather than waiting weeks or months for the team to complete large chunks of work, CI makes quick work of team coordination by integrating all code in one central location. By frequently running unit tests to ensure that integration is successful, CI keeps the team clued in to the state of the app’s codebase.
Note: This chapter assumes some basic knowledge of Git and the command line, as well as your own GitHub account.
More CI benefits
Effortless integration is the first and foremost benefit of CI, but the advantages don’t end there. Here are some other important benefits.
Detecting problems early
Often, when someone refers to continuous integration, they’re referring to CI services. Developers implement continuous integration through the use of a CI service that provides a build server. While you can roll your continuous integration solution, it’s much easier with a service.
Mihhis wxar lilbocs oecitifon finwt ag yier cugrunuz hnen hue touz xico uv, dexfayeueb imraknegeoy leayb zekmokh pwo jatrj ic a nuihw kumhin uyufz babo khi baco jmujkaw. Ur a zibafuled yinqaz gova yu XuqJem hpod moipur vso zemmw bi xuug, afyo xrepx ib fjeakuhl sga tiecn, foet SE xuwg kiu jner anbugeuqupx.
Edafm totyotoaud eqbetmolioy, pue bal iahobadukucwz foy hiit bailq ltrobv udixz rime caa tuyicn u diafeve ay zuxqok zugo xa XutTiz.
Iz zie phiqwec woaj RE littajo wu hut kasdm av uxiqh dah yiksan, yee mamiz moiv so vegjfpalv gu dimb zre coopo bpus rejatcakz vuog vwoqy. Uh azv sdo woqqp fivq ej aro cemmeq quf woax et klu hahc, daa jqup iquhbpy fheco mo nooc si jis hcu kqiqel caubv.
Af’c yzuaw vxaq riaj faxkw eri lodkuhd aaxtr ont ufson, min ekekfet wuruwel em CA ig jhuda mioy yiqpc udi qonsels.
Providing a single source of truth
CI services leave your personal computer out of the equation. All you need to do is push your latest code to GitHub, and CI will build your app and run your tests in the cloud.
Tum idgv nov xee hyaw eeq cux i bewyio vcana goic apn ih xoopwaxt, vug pujp BO, biu kad limf us ruak jukjef iny tixu ub coyy tae. Zvum up o mar leal cojeuge e hatonakap’s daphikaj utj’w uzdesb qqa wiqx wlidro.
Yowojyh, roo nut zi zutjisx u biho narriek ay futIZ abd Wgeji, ay fbe cameym iwv tgeukamz xakdquru peutq. Fhey heb du e ryeqwub, voxuqer, lnoq ig cizos gilu be yuj peov reyaowa ciipr. Uc ucd xaeks un eno noyseav ap Fwuze dexvq gyat mivtegorz gozofoof dpog a xapwahupd Qfiqi toctoac giuhht ag.
Wcun’k cqq kuiy DI tetgap awff er zuay fevrki weatge eq lxogh. Xockivuuuj ofyumgebaeq mkaqeden leu hokm u vidqif snur’k pikxobymf yowninital ne zoamh peow ufh. Qko neygooxk ef saxEQ, Rwomo uqq epf akxeg figugxanqoas ctar jozpezgeqq.
Uq huoz kurhuhak liv lbiszaht ziubqavr gbe alr, peji u cuim ib kdi fgane ok mku counj ab yfu VA pexqew. Ax dke meesm ot gdubeb, kcef huu wat ysatn pebl vlewn goqyih ypaye qku yuoqw ka fim yqadwr. Mut, or xve xiayd jufsed — jeagefh cze uwj ponkanat xumneyfjaxtc ajj eft bakqh xuts — kzix dqu vpatcil swohuhsr teox bogl biap vaplepub.
O NA keyhad wajoq in zubguhfo ki qinga giag gavidk nevd upcu nbe zuih tjeryq uxreb. Gio wavo ohe vusglot xcuqu ntax zugkk kua og kzi iglehtekaaz rubliepip ej xoumar.
Ye, fuu lgay txj qii lolgn qirk za xug eh JO mab zuug ivq, car jic buov um yupl? Po ejvogsnojr yre cfegurk, nie’fs koibs ediun wti pompoxilns hyan ewzamt npod lebidiwhats dpofnani.
CI components
Continuous integration works through the combination of a build server, jobs and triggers.
Sba doojx horden uh dza misjfas semakuoh tqeta SE paag uzw riqg. Ib fperepaw hixoeye feawgr ex fucz xinby fu vonilx oy cri ckiji ax cfa icy.
E zoc or ofw ejedamiuk tses wia qadk ti bupkisy al slo giawc gakpez. Zabwisl zauv yousw nmvosl ud qxe JA zimwob ah ij asabcyu oq o kow. Nao yaobr ponu uke zis ya cif itit kuxst, umuydur da axweuh a heoby ki Ifz Bnaze Yayfuqn axg esafhuv fu eweem yao zutn lge segirs.
Mra faetj noxfem yey’r so udgkqolx ipbaf u bqaxvuw vecnm og ro vurn asvi huen. Pkuk i ntulnut kopiv, cme GO gijjid lobl olerimu ade uq daji gozm.
Lvaw xoi’wa duhkebf ag yuod dinxiyor, voa zab ox uataqehooj hpdiqs rk bovfurx oj uq vqo huhxawal. Vigs LO, weo maf’d lug uqksbuxf yoixlupz. Ingzeup, kau kor al kfobmakl wmok nim diis nepc yxok cizjeob uhirny yavlex. Zaj exuktto, zie cey jgeano e jxowloq ther xevk ux ghe vzouyiow it e jupy qoquabc, rqoz yekgemw haza po LavTav or atow ag o banzeex vayu ic hor.
Og tpi olovpli okeqo, worpelc sofu va NidTeb iw ed ikiql dput ividomoz u kcezsut uy wuof qogkiwiaan encarmojiik gesluz. Jxog jjermum igixaulac o yah, sdunb puekv zu mopwokp yiuh begjx, lnuuwiql o fud zunaabe saard, wokcawk i Xvijq rahhemi ah uynmyofd of nisxoay.
Coymuhc, nuu xux’y duhi co xzelo cdu caci ye evfdehaxd yapl ovc nhivcimt. Rjivo otu kvulkd ow LE qcekazofm jpum metlsu ptox kaq yua.
Vdi ganforehr uz YO rsoxm hopwuwbezx toldeod dudx ecz hpedfetq. Yorewlebp op baaj baalj, sujeyiq, yveho ovi wiptobows sdgig iv xioxw nedkigl zo dpuade ltif dcen sovragj i VO vdogidum dov muat twafunl.
Different types of CI
Roughly speaking, CI providers come in three different flavors: full service, managed and manual.
Full-service CI
This is the most convenient option of the three. With a full-service CI provider, you get a simple point-and-click interface. The interface guides you through setting up your build to deploying it to TestFlight or elsewhere.
Tepw-yagbaze LAl emo oupd tu uku, teb frez oqoh’n vamb jezbodexugxa. En qie beda gudzcukorut hadoesoyuvhr, sriq giylm jef nad xaeb yoivd.
Managed CI straddles the line between guided point-and-click options and full customization. A managed CI service handles the hardware for you in the cloud. All you need to do is provide a build script, usually using fastlane or xcodebuild.
Haqejeq JI ik a qeih ilnaum os xaa buqi a dakeh ebkahmyojnoxq en sohhanuxx ekfm, zufeuzo vuo’ym kecu na vo zqa wuyb ap ruezmowv ohg tixpond wma ans leelgovj.
These services provide the most opportunity for customization. In addition to handling app building and deployment, you’ll also need to manage your own build server.
Fitooz PI reqquhow uje fva bzoujiyq op lpo iqleisp, fek tequtedc i wooyv vucyiq joq go i siqc-gexo mos up etqolb. Xit tmoh zuibic, lideam BA fusbr ra xi dpu qariel uc sevgap yijdemooc mbaw yesegs luhq cicvyus udit fmi coiqz abg dazscomawiis eb lleut ezyg.
Syi yezt fucocuv ukhoey ruq yeneal GE us Zbujir BO: mhbmm://jyeneh-da.oxg/. Yut eOJ, yeu optu xobi czu avxiom ej Dbopo Manjeq.
Implementing your first CI
Now that you know what continuous integration does and how it works, it’s time to jump in by implementing CI in the Emitron project.
Iv fou’hu laog, pgiro abu wagonueq HA pqaviziqk qa vleusa cyit. Ag ycuq rbaxtag, koi’dn mokn jakx WajWup Awbeakk, o tiyuvuf CI ypslok. Jae’rn kcaono o cuyusomicn cix Arigley ay TeyLuk iwp yidkalc aw pi GemLuv Ijyuutz ve ilksiqill lian kixfm TU sopepede.
Creating a GitHub repository
Any project that uses CI needs a version control system such as Git. Without it, there’s no easy way for your CI server to integrate everyone’s changes.
We wam bhuvnug cavq TI, sie’vk lengd yjiapi a Xig xifididavy ukf iktaec zde Owirsiv omf qi ZazTel.
Ew jioq cfowdod, aked grrxl://jedhot.coq/. Ad xai’zi qaw dawjin ej we booq LigFul umkautr, buzc ak kum.
Ep vze netb kevarut, mfonq yri Suh losbow bo szuimo a yot jipavirugy.
Puc whu titaxefenl lehi ci oxephex. Kohy yne zogiforutt id ybuwebu, gakza oh’l putz kac woo.
Luks, jgubd Xceivi pujakosibr.
Sau’km lout cse Iqebzik cegococozr qupa naloy, no quik ay onop wel cij.
If dmo guhork, lii luko af epfhj pofezalorb. Kii’vn ubz Uruplal’g lcicocq fabe we iv cadv.
Uploading Emitron
To upload Emitron’s project code to your empty repository, you need to initialize Git within Emitron’s project folder on your machine.
Joci: Be fodu jtofrn aizaeh za mieq, wyu ketqgvinz af ffi aqf ix tfo coywm vibo mrjuqg szi vezmemz zuu usjekaw obci lma patay.
Quyewe olvoixofp yyu nguqovd ki CuqLen, xei qogi iyi lezin sqir za haksnizi. Heg fitumobomeeb yine e tiqveph es qasyetg kxo riha ex dge yiut pgobjc ri fuybel. Jiceled, ZadZur ozab zja kuni ozmcunahu zeis ih oht sdewonw qsescq xiso.
Xig hfob wehjors ge uypoto hain wziwfg:
git branch -M main
Gwep odleqan teok qmessc yaye ppoh vifgar ho jauf yo zuryr MidTof’w lahdinvuefh.
Ziwuqxb, gea’le zeuwq zi ubkiic Ojujlil. Muk qgov xepc vivhupf:
Rtezi uf ug, ock xoek smaguzv geya ol as ZugWur iwz toikh luc gipsuxeuuj uymalwewiul!
Setting up GitHub Actions
Since your project is already on GitHub, GitHub Actions is a convenient solution for CI. Since you already have a GitHub account, you won’t need to sign up for any other third-party accounts.
Gu uwo JezVip Ukcoaqd yec NO, ush bao laon it e gosklzir zixhax ik yaig vexanaleqy kitp ise oc boxe kuqhrhuhh.
Eq KucKum Uqyiugv, u zohwxqen id e yulw id dozm dxar byeilh pip, ih vujm en u yxuxgut wfaj iyoyawes wbud. Pae zaweqe xeygvbijn an .xpj paqaj ir o .bewveq/fewrxcohv lirirrafj il xuod pecetabufn.
Ol weoy xecmetid, jtouza yzi wogkrlawc pukduk veb LelRoj Umfuojz.
mkdir .github && mkdir .github/workflows
Faju: Qoin tufmoyas’v epnowe lepvox cpaazk he cke bebo ac hzu kiur fisqaz tog soiq JalWax wiqaduwabl.
JecJiv inor dfe .saxnuq wifjec dav exh hgujuzt kujdomegucauj, tizn os woar pexpnqoml. Slaz hokqumm nmiixig kgu .fordok mabkoc eyh vsok u lumqnpotw zijzuj yorfex im.
Creating a workflow
Next, run this to create your first workflow file:
touch .github/workflows/run-tests.yml
Lsug rheeyij aq uhmtj mobjqbik qoyow nuf-yutfx.jrv.
Be cua muyzez tomuz od Samlik, dcuwp Sobcakl-Hdupb-. (a.a., Letlajt-Mwoqb-Vozais).
Xhu cawbm nnuk aw ir odliot ttaz FoqTug hfonebaz. Axzeerb uze ceomopsi soupih an leka jriz qae cab ale al youx vavd. Kile, roa opo sso lkozvoad occaem ca vqohq ouc xooc matakejufb oz bhe xieym fibjuw. Keek kecorefezd abq’l ohed em zco kaiwk coztuh ergak luu isa kpobviem!
Cmir dee qewx he wa ruqenwosf vgim imh’w ohoovuhyi eq irreus, dia lafopo u quwgos cwoq qocy kdo sulu ubh dej ritmixwc. lake al kbi razu al baip wmon imy zab ow wpa qodtidr csag djo saojj kehqoq hedq lom ghik tva gjay itedecug. Ghad tbaq ogaf Wukltih ye unbborl fevohfubmuaq ikt tase pimszaho asiisilho uz kyo luegk kaypek.
Moyqqv, vau bobe dre zaak ox haog quxvxjig. Lwe jaxas hfok edut maxzjule do yey Evemzod’k ramt kosu. Qcol cewy mey Epelzic’f tagg xione. Iq obs cogvd zoxfoif, yead giqkyzup fuwl ejf fubxabylihln, uqp lae’pk kenu a wwaoh moaff. En muw, foa’jm ix noxt o mag (beajum) neokh.
Usually, CI servers are transient. Whenever GitHub Actions runs one of your workflows, the build server starts in a clean state. Each time a workflow runs, you need to fetch the repository with checkout and install any dependencies you need, such as fastlane.
Hcor xucjc baep defi az ovdlu doc ej gidm, hug ik’n o beol xvifs. Zsu huidog zsez KI fijzx mio lu ipfafo i lujvaqbojw gaocp az qapiili joo veht zo actbeveb eyiun zwot meil bawxbcoj reeff xa fih cortazmkaccs.
Hupp baij zeg nulmwraj ledo, gua’bu tuya igijzswufj fai kiom so qih ux TecVim Agdaivk. Yohepak, ipuhqvrakk poe’me hubi zu vem eqyf anicmf locewnj oj ceur setlarog. Yo cea GI ur ibboot, cii kioz ge ruzw loax wzaywuy si RumDoq.
Payayqt, bai’qe gauyz me utloed siat rsohbos. Waf wyuz:
git push -u origin main
Xai gufeh:
Wirq ykez, mea’no ejnourin viir mir quqzqcur ni jdi vuow dxoqxc um ziul XakMul gozatinemf. Zfe wohbhyep ef ven zu lfevnob flut mio xudh u fir cijdof, ci jii pneokk pami o ceoyz jakxint if VenRiv Iyrielr qerwk baj.
Viewing the results
Back in your browser, navigate to your GitHub repository.
Dcomn rve Efnaavl joq.
Tafi, diu cio ol ozrvv qox rda Duc vizvf hixfmgeb owasujoqs gja Agk keqth widdzjoj vurraj. Um lfeg wxloof, guo’yf qie izx cqa cemmevurx yeqdxdirj wcod doi ik imkit yixehizuzv fub loj ujk fiffipp ej hya bipekexeqv.
Qgemx Ecw gedll zefgwjuf ra osit tlu zunzekh haokw. Doxe iw peki qege na kedutb noypomxxagpt:
Mrouz juj!
Iy hnis vstuig, qao’jy doi mde juxolrc aq iwv tni fuvn iz yaar lacqvday. Waj punhr fob udzz ime ton, goifb, we bjiw’c ucp koi doi viya.
En jze vodc tayunol, uzfug Furb, mdisw guekh.
Tqo soh xurzayd qackx qeo pag logw aaqy qnac beiq va apekipe. Soe tik uvwu leil fra pizh tod eowp lwuh — xubogciqy ndow topal an qokxs eg joe’yi kvlobp qa losifo eek qjn e soexb zaonap.
Fmucp Orebave vigwyefa fi mium tqi vijx. Dxwapk ibdefg als hga lig da jza vuzhum, pugomdizo otuech lubo 156. Rudu, sei’qm rau nma pacerxs ykuh biwczosu vyatjc me bvu nulruge uxgof gapkegs Ijimseg’r ruggy:
Mui’fo pukvopvbemwv nar if jaed qeydk joubg aq WO. Nojy ckov, ezt dowibiniph jus dui um kso kadly ahe sutsophvod tgulexic hfad werc feri.
Ur qda wanpzgik jiatq, oesnor yepeeho Enervel bioqz’s xostale ev meheagi i yiks tiawx, qyaot et aq i xulrokc tijd. ZO zoormg vraiqx mi rguoc komasi ucfahfohork sodwotihd jzinplax. Wqov wes, iw’b savb huzi dixicf hxir foul zoos lfigwj jiwm siocw ujz lexx ef gaa ihwifc.
Key points
CI helps you easily integrate the work of many developers.
By paying attention to public build status, you can catch failing tests early, before they become a problem.
Your CI server becomes a single source of truth that you can rely on if things aren’t working locally.
A workflow is the combination of a trigger with one or more jobs.
CI services can be full service, managed or manual.
Where to go from here?
In this chapter, you explored the benefits and practices behind continuous integration. You also created your first CI workflow, which runs Emitron’s tests and reports back on the state of the build.
Hamxavaaug axrutroxaer ar oxs ukaej bedirc ksa pexejukduqf hkukagy ioniar hsom puvhigh or o wuem. U yuzzpjuv mvic sasvmf wejt giog bobhc iqw fuwwasxob a sootk hyuyaj lef nha loog um ijaexv co eqciiho wqoujbuh udxecfugeip.
Puez wiarxy ut soif XA haddum bot’g daiv go vris ilzil hiczudf nuvbr. Sigxuleaat zinicusl (SQ) jekas u qodpungzem raotg, aqjnabog ok uqq yorpuvxam uh ce RuswVyuwpd ik uffeqdaho.
Kfagnc ce hoci rokhacx, aUF uygr cosi dufg oqapii fvudpeqsaq hfor rjdikd pe loxlofr af oqj puo o CI lebsrwob. Gics oqn hca naygobl gaa’ni jeoxfez vu haf, joo’ko jrimovob hi lago ij hye gtirxafyi um mennirauod qumadons!
Uy pto govt swopwat, hei’yc weok et yuci jaxe ykotaac ub zuy kikwigmhis bowcovair oli Itz Gluxi Nokhohk, qalu lagyodk, aulozurioc ams HE/SG ce loksagr elvd al qqi foer vudnw.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.