Skip to content

Commit

Permalink
feat: CI and release tags, update doc
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp committed Feb 13, 2024
1 parent c85d90c commit 115e97f
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 21 deletions.
53 changes: 32 additions & 21 deletions OrangeDesignSystemDemo/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,36 @@
# Software description: A SwiftUI components library with code examples for Orange Design System
#

# App features configuration
# --------------------------

APPS_PLUS_SERVICE_URL = ENV["ODS_APPS_PLUS_SERVICE_URL"]

# Apple configuration
# -------------------

APPLE_ISSUER_ID = ENV["ODS_APPLE_ISSUER_ID"]
APPLE_KEY_ID = ENV["ODS_APPLE_KEY_ID"]
APPLE_KEY_CONTENT = ENV["ODS_APPLE_KEY_CONTENT"]
DEVELOPER_APP_IDENTIFIER = ENV["ODS_DEVELOPER_APP_IDENTIFIER"]

# Notifications and hooks
# -----------------------

MATTERMOST_HOOK_URL = ENV["ODS_MATTERMOST_HOOK_URL"]
MATTERMOST_HOOK_BOT_NAME = ENV["ODS_MATTERMOST_HOOK_BOT_NAME"]
MATTERMOST_HOOK_BOT_ICON_URL = ENV["ODS_MATTERMOST_HOOK_BOT_ICON_URL"]

# App features configuration
APPS_PLUS_SERVICE_URL = ENV["ODS_APPS_PLUS_SERVICE_URL"]

# Project configuration
ODS_PROPROFILE = ENV["ODS_PROPROFILE"]
# ---------------------

ODS_WORKSPACE = "OrangeDesignSystemDemo.xcworkspace"
ODS_PROJECT = "OrangeDesignSystemDemo.xcodeproj"
ODS_SCHEME = "OrangeDesignSystemDemo"

# Lanes
# ------

default_platform(:ios)

platform :ios do
Expand All @@ -39,6 +49,23 @@ platform :ios do
xcodes(select_for_current_build_only: true)
end

# ------------------------------------------------------------
# ADD APPS PLUS CREDENTIALS (About module)
# ------------------------------------------------------------
desc "ADD APPS PLUS CREDENTIALS"
lane :add_credentials_appsplus do
if APPS_PLUS_SERVICE_URL.nil? || APPS_PLUS_SERVICE_URL.empty?
publish_mattermost_notification("⚠️ @channel Warning: APPS_PLUS_SERVICE_URL is not defined, are you aware of that?")
end

update_plist(
plist_path: "OrangeDesignSystemDemo/Resources/Info.plist",
block: proc do |plist|
plist[:APPS_PLUS_URL] = APPS_PLUS_SERVICE_URL
end
)
end

# ---------
# RUN TESTS
# ---------
Expand All @@ -56,23 +83,6 @@ platform :ios do
raise error
end
end

# ------------------------------------------------------------
# ADD APPS PLUS CREDENTIALS (About module)
# ------------------------------------------------------------
desc "ADD APPS PLUS CREDENTIALS"
lane :add_credentials_appsplus do
if APPS_PLUS_SERVICE_URL.nil? || APPS_PLUS_SERVICE_URL.empty?
publish_mattermost_notification("⚠️ @channel Warning: APPS_PLUS_SERVICE_URL is not defined, are you aware of that?")
end

update_plist(
plist_path: "OrangeDesignSystemDemo/Resources/Info.plist",
block: proc do |plist|
plist[:APPS_PLUS_URL] = APPS_PLUS_SERVICE_URL
end
)
end

# ------------------------------------------------------------
# UPDATE BUILD NUMBER WITH TIMESTAMP
Expand Down Expand Up @@ -294,6 +304,7 @@ platform :ios do
# -------
# Helpers
# -------

# Get version set in the Xcode project
def get_app_version
version = get_version_number(
Expand Down
48 changes: 48 additions & 0 deletions docs_release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,54 @@ This file lists all the steps to follow when releasing a new version of ODS iOS.
- Create a new pull request named `Update release U.V.W` on GitHub to merge your branch into `qualif`.
- Review and merge this pull request on GitHub.<br /><br />
## [About CI/CD with GitLabCI]
You can setup in your side a _GitLab CI_ runner which can trigger some _Fastlane_ actions for example each night.
You can find bellow some pipeline script to fill and use. Ensure all environement variables are filled (used in _Fastfile_ and _Appfile_).
```yaml
stages:
- prepare
- test
- build
# Define in .common the tags matching your runners, and the rule smatching at least "schedule"
checkout:
extends: .common
stage: prepare
script:
- rm -rf qualif
- git clone [email protected]:Orange-OpenSource/ods-ios qualif
- cd qualif
prepare_workspace:
extends: .common
stage: prepare
needs: [checkout]
script:
- git clean -dxf
- gem install bundler -v $(tail -n1 Gemfile.lock)'
- bundle --version
- bundle check || (bundle install --jobs $(sysctl -n hw.logicalcpu) --path=vendor/bundle
test-ios:
extends: .common
stage: test
needs: [prepare_workspace]
script:
- bundle exec fastlane ios test
build-ios:
extends: .common
stage: build
needs: [test-ios]
script:
- bundle exec fastlane add_credentials_appsplus
- bundle exec fastlane qualif
```

## [About CI/CD with Jenkins]

You can setup in your side a _Jenkins_ runner which can trigger some _Fastlane_ actions for example each night.
Expand Down

0 comments on commit 115e97f

Please sign in to comment.