Skip to content

Commit

Permalink
Merge pull request #360 from verdigado/187-cicd-ios-builds
Browse files Browse the repository at this point in the history
187,190: CI/CD build and deliver ios
  • Loading branch information
steffenkleinle authored Dec 6, 2024
2 parents ddb0019 + 9cdf237 commit c45ad10
Show file tree
Hide file tree
Showing 27 changed files with 935 additions and 267 deletions.
110 changes: 107 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ commands:
- run:
command: circleci config validate
name: Validate circle config
install_cocoapods:
description: Restores and saves the cocoa pods cache.
steps:
- restore_cache:
keys:
- 1-cocoapods-{{ arch }}-{{ checksum "ios/Podfile.lock" }}
name: Restore CocoaPods Cache
- run:
command: bundle exec pod install
name: Install CocoaPods
working_directory: ios
- save_cache:
key: 1-cocoapods-{{ arch }}-{{ checksum "ios/Podfile.lock" }}
name: Save CocoaPods Cache
paths:
- ~/Library/Caches/CocoaPods/
install_fastlane:
description: Restores and saves fastlane cache of the passed directory.
parameters:
Expand All @@ -40,18 +56,18 @@ commands:
keys:
- v1-gems-{{ arch }}-{{ checksum "<< parameters.directory >>/Gemfile.lock" }}
- v1-gems-{{ arch }}-
name: Restore Fastlane Cache
name: Restore Ruby Cache
- run:
command: bundle config set path 'vendor/bundle'
name: Configure Installation Directory
working_directory: << parameters.directory >>
- run:
command: bundle check || bundle install
name: '[FL] Install'
name: Bundle Install
working_directory: << parameters.directory >>
- save_cache:
key: v1-gems-{{ arch }}-{{ checksum "<< parameters.directory >>/Gemfile.lock" }}
name: Save Fastlane Cache
name: Save Ruby Cache
paths:
- << parameters.directory >>/vendor/bundle
install_flutter:
Expand Down Expand Up @@ -237,6 +253,34 @@ jobs:
- app-release.apk
root: .
- persist_environment_variables
build_ios:
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
macos:
xcode: 16.1.0
steps:
- checkout
- prepare_workspace
- run:
command: softwareupdate --install-rosetta --agree-to-license
name: Install rosetta
- restore_environment_variables
- install_flutter:
precache: ios
- prepare_project
- install_fastlane:
directory: ios
- install_cocoapods
- run:
command: bundle exec fastlane ios build version_name:${NEW_VERSION_NAME} version_code:${NEW_VERSION_CODE}
name: '[FL] Build'
working_directory: ios
- store_artifacts:
path: app-release.ipa
- persist_to_workspace:
paths:
- app-release.ipa
root: ~/
bump_version:
docker:
- image: cimg/node:20.13.1
Expand Down Expand Up @@ -308,6 +352,33 @@ jobs:
command: yarn github-release-asset upload android --releaseId ${ANDROID_RELEASE_ID} --files "$(ls ~/attached_workspace/*.apk)" --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME}
name: Upload Apks to Github Release
working_directory: tools
deliver_ios:
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
macos:
xcode: 16.1.0
parameters:
production_delivery:
description: Whether to deliver the build to production.
type: boolean
steps:
- checkout
- prepare_workspace
- restore_environment_variables
- install_node_modules
- install_fastlane:
directory: ios
- unless:
condition: << parameters.production_delivery >>
steps:
- run:
command: bundle exec fastlane ios beta_upload ipa_path:attached_workspace/app-release.ipa
name: '[FL] Beta Upload (TestFlight)'
working_directory: ios
- run:
command: yarn --silent github-release create ios ${NEW_VERSION_NAME} ${NEW_VERSION_CODE} --production-delivery << parameters.production_delivery >> --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME} --release-notes "Release v${NEW_VERSION_NAME}+${NEW_VERSION_CODE}"
name: Create Github Release
working_directory: tools
parameters:
api_triggered:
default: false
Expand All @@ -323,6 +394,39 @@ parameters:
type: enum
version: 2.1
workflows:
beta_delivery:
jobs:
- bump_version:
context:
- github
prepare_delivery: true
- build_android:
requires:
- bump_version
- deliver_android:
context:
- github
production_delivery: false
requires:
- build_android
- build_ios:
context:
- app_signing_ios
requires:
- bump_version
- deliver_ios:
context:
- github
- gruene_apple_appstore
production_delivery: false
requires:
- build_ios
when:
and:
- << pipeline.parameters.api_triggered >>
- equal:
- << pipeline.parameters.workflow_type >>
- beta_delivery
commit:
jobs:
- check
Expand Down
15 changes: 15 additions & 0 deletions .circleci/src/commands/install_cocoapods.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
description: Restores and saves the cocoa pods cache.
steps:
- restore_cache:
name: Restore CocoaPods Cache
keys:
- 1-cocoapods-{{ arch }}-{{ checksum "ios/Podfile.lock" }}
- run:
name: Install CocoaPods
command: bundle exec pod install
working_directory: ios
- save_cache:
name: Save CocoaPods Cache
key: 1-cocoapods-{{ arch }}-{{ checksum "ios/Podfile.lock" }}
paths:
- ~/Library/Caches/CocoaPods/
6 changes: 3 additions & 3 deletions .circleci/src/commands/install_fastlane.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ parameters:
type: string
steps:
- restore_cache:
name: Restore Fastlane Cache
name: Restore Ruby Cache
keys:
- v1-gems-{{ arch }}-{{ checksum "<< parameters.directory >>/Gemfile.lock" }}
- v1-gems-{{ arch }}-
Expand All @@ -13,11 +13,11 @@ steps:
command: bundle config set path 'vendor/bundle'
working_directory: << parameters.directory >>
- run:
name: '[FL] Install'
name: Bundle Install
command: bundle check || bundle install
working_directory: << parameters.directory >>
- save_cache:
name: Save Fastlane Cache
name: Save Ruby Cache
key: v1-gems-{{ arch }}-{{ checksum "<< parameters.directory >>/Gemfile.lock" }}
paths:
- << parameters.directory >>/vendor/bundle
27 changes: 27 additions & 0 deletions .circleci/src/jobs/build_ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
macos:
xcode: 16.1.0
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
steps:
- checkout
- prepare_workspace
- run:
name: Install rosetta
command: softwareupdate --install-rosetta --agree-to-license
- restore_environment_variables
- install_flutter:
precache: ios
- prepare_project
- install_fastlane:
directory: ios
- install_cocoapods
- run:
name: '[FL] Build'
command: bundle exec fastlane ios build version_name:${NEW_VERSION_NAME} version_code:${NEW_VERSION_CODE}
working_directory: ios
- store_artifacts:
path: app-release.ipa
- persist_to_workspace:
root: ~/
paths:
- app-release.ipa
1 change: 0 additions & 1 deletion .circleci/src/jobs/deliver_android.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Deliver the app to the Google Play Store.
parameters:
production_delivery:
description: Whether to deliver the build to production.
Expand Down
33 changes: 33 additions & 0 deletions .circleci/src/jobs/deliver_ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
parameters:
production_delivery:
description: Whether to deliver the build to production.
type: boolean
macos:
xcode: 16.1.0
environment:
FASTLANE_SKIP_UPDATE_CHECK: true
steps:
- checkout
- prepare_workspace
- restore_environment_variables
- install_node_modules
- install_fastlane:
directory: ios
# - when:
# condition: << parameters.production_delivery >>
# steps:
# - run:
# name: '[FL] Production Upload'
# command: bundle exec fastlane ios production_upload ipa_path:attached_workspace/app-release.ipa version_name:${NEW_VERSION_NAME}
# working_directory: ios
- unless:
condition: << parameters.production_delivery >>
steps:
- run:
name: '[FL] Beta Upload (TestFlight)'
command: bundle exec fastlane ios beta_upload ipa_path:attached_workspace/app-release.ipa
working_directory: ios
- run:
name: Create Github Release
command: yarn --silent github-release create ios ${NEW_VERSION_NAME} ${NEW_VERSION_CODE} --production-delivery << parameters.production_delivery >> --github-private-key ${GITHUB_PRIVATE_KEY} --owner ${CIRCLE_PROJECT_USERNAME} --repo ${CIRCLE_PROJECT_REPONAME} --release-notes "Release v${NEW_VERSION_NAME}+${NEW_VERSION_CODE}"
working_directory: tools
35 changes: 35 additions & 0 deletions .circleci/src/workflows/beta_delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
when:
and:
- << pipeline.parameters.api_triggered >>
- equal: [<< pipeline.parameters.workflow_type >>, beta_delivery]
jobs:
- bump_version:
context:
- github
prepare_delivery: true

- build_android:
# context:
# - app_signing_android
requires:
- bump_version
- deliver_android:
production_delivery: false
context:
- github
# - gruene_google_playstore
requires:
- build_android

- build_ios:
context:
- app_signing_ios
requires:
- bump_version
- deliver_ios:
production_delivery: false
context:
- github
- gruene_apple_appstore
requires:
- build_ios
1 change: 1 addition & 0 deletions .idea/gruene_app.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"FSharp.suggestGitignore": false,
"cSpell.words": [
"gruene",
"housenumber"
],
"files.eol": "\n"
{
"FSharp.suggestGitignore": false,
"cSpell.words": [
"gruene",
"housenumber"
],
"files.eol": "\n"
}
10 changes: 5 additions & 5 deletions android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.1006.0)
aws-sdk-core (3.212.0)
aws-partitions (1.1014.0)
aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.95.0)
aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.170.1)
aws-sdk-s3 (1.174.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -219,4 +219,4 @@ DEPENDENCIES
fastlane

BUNDLED WITH
2.5.23
2.5.10
7 changes: 7 additions & 0 deletions ios/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source "https://rubygems.org"

# https://github.com/fastlane/fastlane/issues/21794
gem "rb-readline"
gem "fastlane"
gem "cocoapods"

Loading

0 comments on commit c45ad10

Please sign in to comment.