Our tech process, how we make apps using React Native on Gitlab with Gitlab CI (Continuous Integration) and CD (Continuous Delivery)
Reveal JS source on GitHub: https://github.com/Lingvokot/gitlab-and-lingvokot
19. Short info about Gitlab CI
differences
Runner
A server that processes builds. It receives commands from
GitLab CI.
Build
Execution of a particular job.
Job
"Wrapped" bash script (before_script, "only" git ref, runner tags,
cache...)
Stage
Group of jobs. Builds of next stage are run after success of
previous.
Environment
Just a group of deploy jobs for now. Later will have approvement
28. TL;DR: How to create CD
process
both for beta and prod
Find a tool for working with stores (upload apk, ipa, upload
metadata of app), get wraps for xcode, gradle
Export your secrets (keys, accounts) into servers, make these
servers tagged Gitlab CI runners
Create a super-tweaked job in .gitlab-ci.yml
31. Fastlane can (for us)...
Run native tests (still a TODO)
Build & sign xcode project in a CLI with dozen options (builds
gradle projects for sure)
Upload builded bundle (apk, ipa) to store on all 3 channels for
GPlay and TestFlight+AppStore for iOS
Also, upload app metadata (screenshots, description,
changelogs...) on that stores
Send slack messages by the way (may be useless...)
32. And magic Gitlab CI job
Not so magic, but how to do it?
A Condition: Fastlane lanes are written (build, deploy for android &
iOS), remote servers handle it just ne, they attached to Gitlab CI as
runners and have tags
Build: Job depends on npm test job. run fastlane ios build on a
build stage, capture your XCode archive and ipa as artifacts
Deploy: Job depends on build job. run fastlane ios beta on a
deploy stage, on some environment beta and prod
Almost same for android
35. About versioning
A contract: v1.0 for beta releases, v1.0-production for production
releases
Use git tags for deployment
Restrict executing of deploy jobs for that git tags with a regexp:
/^v[0-9.]+/ for beta and /^v[0-9.]+-production/
Use git commit count as a version code (xcode) or build number
(gradle)
In a job scripts, capture git tag and use it as version name
If no git tag speci ed, use 0.0.1 by default (fallback)
41. Github flow
Master is always stable and deployable
For every feature (or bug x) new branch is created from master
Developer pushes feature branch on a server many times
After work seems done, developer creates Pull Request into
master
After PR gets merged into master, feature branch is removed
42. Redux ducks
TL;DR; actionCreators, actionTypes, reducers are in one le
And:
ducks export default a reducer function
exports actionTypes and actionCreators as named exports
actionType naming form: module/action
actionType variable is UPPER_UNDERSCORE_CASE
46. How my commit gets
deployed?
1. It gets reviewed on Merge Request rst
2. At same time, CI server runs [unit] tests and analyzes coverage
3. After commit gets merged into master, CI server runs [unit] tests
for master branch
4. After "Green", build job are launched for iOS and android in
parallel, resulting in artifacts (ipa + apk)
5. Then, after "Green" build, on a master branch, nothing is
happened
6. We download artifacts, launch and test (if you want), then add a
tag on that commit
7. Gitlab CI runs all sequence of test+build for tag ref (v1.0)
8. Then, nally, it runs deploy job for git tag ref. Channel (beta, prod)
47. is selected by tag name (v1.0 for beta, v1.0-production for
production)
Rollback
Stores are immutable, so you need to add a next version with patch
version bump and release it
v1.0
➡ OMG, fail
➡ git bisect to stable or fix a bug
➡ v1.0.1