From 115e97f1946efbb466c548cec7b22aae98f9d528 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Lapersonne Date: Tue, 13 Feb 2024 11:37:32 +0100 Subject: [PATCH] feat: CI and release tags, update doc Signed-off-by: Pierre-Yves Lapersonne --- OrangeDesignSystemDemo/fastlane/Fastfile | 53 ++++++++++++++---------- docs_release/README.md | 48 +++++++++++++++++++++ 2 files changed, 80 insertions(+), 21 deletions(-) diff --git a/OrangeDesignSystemDemo/fastlane/Fastfile b/OrangeDesignSystemDemo/fastlane/Fastfile index f273beb7..731b19a2 100644 --- a/OrangeDesignSystemDemo/fastlane/Fastfile +++ b/OrangeDesignSystemDemo/fastlane/Fastfile @@ -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 @@ -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 # --------- @@ -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 @@ -294,6 +304,7 @@ platform :ios do # ------- # Helpers # ------- + # Get version set in the Xcode project def get_app_version version = get_version_number( diff --git a/docs_release/README.md b/docs_release/README.md index 85fa9598..c0909032 100644 --- a/docs_release/README.md +++ b/docs_release/README.md @@ -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.

+## [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 git@github.com: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.